Ensure rsync restarts fully during swift setup

Existing rsync stop/start handlers were relying on the pattern
parameter to the Ansible service module which relies on the results
of ps to determine if the service is running. This is unnecessary
because the rsync service script is well-behaved and responds
appropriately to start stop and restart commands. Removal of the
pattern param ensures that the response from the service command is
used instead.

Root cause of the bug is that when Keystone was changed to share
fernet secrets via rsync over ssh tunnel, an rsync process was
introduced in AIOs, Swift stand-alones, and other deployment
configurations that contain Keystone containers on the storage hosts.

The resulting rsync processes within Keystone containers pollute the
results of ps commands on the host, fooling Ansible into thinking
that an rsync service is running on the standard port when it is not.

Secondly, the handler responsible for stopping rsync was not causing
the notice for "Ensure rsync service running" to trigger cleanly in
my testing, so the tasks were changed to trigger both notices in an
ordered list.

Change-Id: I5ed47f7c1974d6b22eeb2ff5816ee6fa30ee9309
Closes-Bug: 1481121
This commit is contained in:
Steve Lewis 2015-08-26 11:29:48 -07:00 committed by Jesse Pretorius
parent b2f8a07e72
commit f32a31d585
2 changed files with 3 additions and 6 deletions

View File

@ -62,21 +62,18 @@
name: "rsyslog" name: "rsyslog"
state: "restarted" state: "restarted"
- name: Restart rsync service - name: Ensure rsync service stopped
service: service:
name: "rsync" name: "rsync"
state: "stopped" state: "stopped"
pattern: "rsync"
register: service_restart register: service_restart
failed_when: "'msg' in service_restart and 'FAIL' in service_restart.msg|upper" failed_when: "'msg' in service_restart and 'FAIL' in service_restart.msg|upper"
register: service_restart register: service_restart
until: add_service|success until: add_service|success
retries: 3 retries: 3
delay: 2 delay: 2
notify: Ensure rsync service running
- name: Ensure rsync service running - name: Ensure rsync service running
service: service:
name: "rsync" name: "rsync"
state: "started" state: "started"
pattern: "rsync"

View File

@ -38,14 +38,14 @@
owner: "root" owner: "root"
group: "root" group: "root"
mode: "0644" mode: "0644"
notify: Restart rsync service notify: ["Ensure rsync service stopped", "Ensure rsync service running"]
- name: "Enable rsync in defaults" - name: "Enable rsync in defaults"
lineinfile: lineinfile:
dest: "/etc/default/rsync" dest: "/etc/default/rsync"
line: "RSYNC_ENABLE=true" line: "RSYNC_ENABLE=true"
regexp: "^RSYNC_ENABLE*" regexp: "^RSYNC_ENABLE*"
notify: Restart rsync service notify: ["Ensure rsync service stopped", "Ensure rsync service running"]
# We need the location of swift-recon-cron # We need the location of swift-recon-cron
- name: "Get location of swift-recon-cron" - name: "Get location of swift-recon-cron"