From f32a31d58546838f7fa951d0801fb24571b315cf Mon Sep 17 00:00:00 2001 From: Steve Lewis Date: Wed, 26 Aug 2015 11:29:48 -0700 Subject: [PATCH] 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 --- playbooks/roles/os_swift/handlers/main.yml | 5 +---- playbooks/roles/os_swift/tasks/swift_storage_hosts_setup.yml | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/playbooks/roles/os_swift/handlers/main.yml b/playbooks/roles/os_swift/handlers/main.yml index 97b662392a..2cea1ee8e9 100644 --- a/playbooks/roles/os_swift/handlers/main.yml +++ b/playbooks/roles/os_swift/handlers/main.yml @@ -62,21 +62,18 @@ name: "rsyslog" state: "restarted" -- name: Restart rsync service +- name: Ensure rsync service stopped service: name: "rsync" state: "stopped" - pattern: "rsync" register: service_restart failed_when: "'msg' in service_restart and 'FAIL' in service_restart.msg|upper" register: service_restart until: add_service|success retries: 3 delay: 2 - notify: Ensure rsync service running - name: Ensure rsync service running service: name: "rsync" state: "started" - pattern: "rsync" diff --git a/playbooks/roles/os_swift/tasks/swift_storage_hosts_setup.yml b/playbooks/roles/os_swift/tasks/swift_storage_hosts_setup.yml index 335c3a7cb8..2db0748e5a 100644 --- a/playbooks/roles/os_swift/tasks/swift_storage_hosts_setup.yml +++ b/playbooks/roles/os_swift/tasks/swift_storage_hosts_setup.yml @@ -38,14 +38,14 @@ owner: "root" group: "root" mode: "0644" - notify: Restart rsync service + notify: ["Ensure rsync service stopped", "Ensure rsync service running"] - name: "Enable rsync in defaults" lineinfile: dest: "/etc/default/rsync" line: "RSYNC_ENABLE=true" regexp: "^RSYNC_ENABLE*" - notify: Restart rsync service + notify: ["Ensure rsync service stopped", "Ensure rsync service running"] # We need the location of swift-recon-cron - name: "Get location of swift-recon-cron"