Use synchronize module for rings distribution

Instead of using rsync which do not respect ssh ports, we fetch rings
to the deploy host and distribute them back to swift hosts

Change-Id: I9f8bc0af9803d2a235b3da956b5618adfe195c00
Closes-Bug: #1904935
This commit is contained in:
Dmitriy Rabotyagov 2020-12-03 19:31:58 +02:00
parent 569c8cfb00
commit c2665d032c
1 changed files with 11 additions and 33 deletions

View File

@ -13,37 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE(cloudnull): These methods have been changed to use the rsync command
# instead of the Synchronize module. The change was required due to an upstream
# issue with the module when running with delegate_to and become. Sadly the fix
# does not seem to be trivial. "https://github.com/ansible/ansible/issues/15405"
- name: Pull swift rings to localhost
synchronize:
src: /etc/swift/ring_build_files/
dest: "{{ lookup('env', 'OSA_CONFIG_DIR') }}/ring_build_files/"
mode: pull
when: _swift_is_first_play_host
# TODO(logan): Change to synchronize module to pass ANSIBLE0006
# and remove the skip_ansible_lint tag at that time.
- name: "Get swift rings"
command: >
rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
-avz {{ swift_system_user_name }}@{{ hostvars[groups['swift_hosts'][0]]['ansible_host'] }}:/etc/swift/ring_build_files/
/etc/swift/
args:
warn: no
become: yes
become_user: "{{ swift_system_user_name }}"
changed_when: false
tags:
- skip_ansible_lint
# TODO(logan): Change to synchronize module to pass ANSIBLE0006
# and remove the skip_ansible_lint tag at that time.
- name: "Get swift rings for backup in ring_build_files directory"
command: >
rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
-avz {{ swift_system_user_name }}@{{ hostvars[groups['swift_hosts'][0]]['ansible_host'] }}:/etc/swift/ring_build_files/
/etc/swift/ring_build_files/
args:
warn: no
become: yes
become_user: "{{ swift_system_user_name }}"
changed_when: false
tags:
- skip_ansible_lint
- name: Upload swift rings
synchronize:
src: "{{ lookup('env', 'OSA_CONFIG_DIR') }}/ring_build_files/"
dest: /etc/swift/
mode: push