Handler should only restart relevent swift services

* Adjust the handler to include a "restart" handler for each of account,
container, object and proxy service groups.
* Add a variable in defaults listing program names for each swift
service group.
* Remove the over-arching "all swift program_names" variable.
* Change the storage and proxy host tasks to call the appropriate
* handler.

Change-Id: I25adfa152fc7a3da83ca7c12d57977eec8b51d7b
Closes-Bug: #1427601
This commit is contained in:
Andy McCrae 2015-03-03 11:50:01 +00:00 committed by Jesse Pretorius
parent 8cf39b11ff
commit 98aba34aa1
8 changed files with 61 additions and 29 deletions

View File

@ -127,21 +127,24 @@ swift_apt_packages:
- python-dev - python-dev
- rsync - rsync
swift_program_names: swift_account_program_names:
- swift-proxy-server - swift-account-server
- swift-object-server - swift-account-auditor
- swift-object-auditor - swift-account-replicator
- swift-object-replicator - swift-account-reaper
- swift-object-updater
- swift-object-server-replicator swift_container_program_names:
- swift-container-server - swift-container-server
- swift-container-auditor - swift-container-auditor
- swift-container-replicator - swift-container-replicator
- swift-container-sync - swift-container-sync
- swift-container-updater - swift-container-updater
- swift-container-server-replicator
- swift-account-server swift_object_program_names:
- swift-account-auditor - swift-object-server
- swift-account-replicator - swift-object-auditor
- swift-account-reaper - swift-object-replicator
- swift-account-server-replicator - swift-object-updater
swift_proxy_program_names:
- swift-proxy-server

View File

@ -13,13 +13,40 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Restart swift services - name: Restart swift account services
service: service:
name: "{{ item }}" name: "{{ item }}"
state: "restarted" state: "restarted"
pattern: "{{ item }}" pattern: "{{ item }}"
register: service_restart register: service_restart
with_items: swift_program_names with_items: swift_account_program_names
failed_when: false
- name: Restart swift container services
service:
name: "{{ item }}"
state: "restarted"
pattern: "{{ item }}"
register: service_restart
with_items: swift_container_program_names
failed_when: false
- name: Restart swift object services
service:
name: "{{ item }}"
state: "restarted"
pattern: "{{ item }}"
register: service_restart
with_items: swift_object_program_names
failed_when: false
- name: Restart swift proxy services
service:
name: "{{ item }}"
state: "restarted"
pattern: "{{ item }}"
register: service_restart
with_items: swift_proxy_program_names
failed_when: false failed_when: false
- name: Restart service - name: Restart service

View File

@ -23,7 +23,11 @@
- { src: "swift.conf.j2", dest: "/etc/swift/swift.conf" } - { src: "swift.conf.j2", dest: "/etc/swift/swift.conf" }
- { src: "swift-rsyslog.conf.j2", dest: "/etc/rsyslog.d/49-swift.conf" } - { src: "swift-rsyslog.conf.j2", dest: "/etc/rsyslog.d/49-swift.conf" }
- { src: "swift-dispersion.conf.j2", dest: "/etc/swift/dispersion.conf" } - { src: "swift-dispersion.conf.j2", dest: "/etc/swift/dispersion.conf" }
notify: Restart swift services notify:
- Restart swift account services
- Restart swift container services
- Restart swift object services
- Restart swift proxy services
tags: tags:
- swift-config - swift-config
- swift-post-install - swift-post-install

View File

@ -28,4 +28,4 @@
dest: "/etc/swift/proxy-server/proxy-server.conf" dest: "/etc/swift/proxy-server/proxy-server.conf"
owner: "{{ swift_system_user_name }}" owner: "{{ swift_system_user_name }}"
mode: "0644" mode: "0644"
notify: Restart swift services notify: Restart swift proxy services

View File

@ -75,7 +75,7 @@
mode: "0644" mode: "0644"
with_items: with_items:
- { src: "account-server.conf.j2", dest: "/etc/swift/account-server/account-server.conf" } - { src: "account-server.conf.j2", dest: "/etc/swift/account-server/account-server.conf" }
notify: Restart swift services notify: Restart swift account services
# We only create the dedicated replicator configuration when using a dedicated replication_network # We only create the dedicated replicator configuration when using a dedicated replication_network
- name: "Swift account server replicator configuration" - name: "Swift account server replicator configuration"
@ -90,4 +90,4 @@
when: > when: >
swift.replication_network is defined and swift.replication_network is defined and
swift.replication_network != swift.storage_network swift.replication_network != swift.storage_network
notify: Restart swift services notify: Restart swift account services

View File

@ -84,7 +84,7 @@
mode: "0644" mode: "0644"
with_items: with_items:
- { src: "container-server.conf.j2", dest: "/etc/swift/container-server/container-server.conf" } - { src: "container-server.conf.j2", dest: "/etc/swift/container-server/container-server.conf" }
notify: Restart swift services notify: Restart swift container services
# We only create the dedicated replicator configuration when using a dedicated replication_network # We only create the dedicated replicator configuration when using a dedicated replication_network
- name: "Swift container server configuration" - name: "Swift container server configuration"
@ -99,4 +99,4 @@
when: > when: >
swift.replication_network is defined and swift.replication_network is defined and
swift.replication_network != swift.storage_network swift.replication_network != swift.storage_network
notify: Restart swift services notify: Restart swift container services

View File

@ -75,7 +75,7 @@
mode: "0644" mode: "0644"
with_items: with_items:
- { src: "object-server.conf.j2", dest: "/etc/swift/object-server/object-server.conf" } - { src: "object-server.conf.j2", dest: "/etc/swift/object-server/object-server.conf" }
notify: Restart swift services notify: Restart swift object services
# We only create the dedicated replicator configuration when using a dedicated replication_network # We only create the dedicated replicator configuration when using a dedicated replication_network
- name: "Swift object server configuration" - name: "Swift object server configuration"
@ -90,4 +90,4 @@
when: > when: >
swift.replication_network is defined and swift.replication_network is defined and
swift.replication_network != swift.storage_network swift.replication_network != swift.storage_network
notify: Restart swift services notify: Restart swift object services

View File

@ -20,8 +20,7 @@
mode: "0644" mode: "0644"
owner: "root" owner: "root"
group: "root" group: "root"
notify: register: init_script
- Restart swift services
tags: tags:
- upstart-init - upstart-init
- swift-init - swift-init
@ -29,8 +28,7 @@
- name: Reload init scripts - name: Reload init scripts
shell: | shell: |
initctl reload-configuration initctl reload-configuration
notify: when: init_script|changed
- Restart swift services
tags: tags:
- upstart-init - upstart-init
- swift-init - swift-init
@ -39,8 +37,8 @@
service: service:
name: "{{ program_name }}" name: "{{ program_name }}"
enabled: "yes" enabled: "yes"
notify: state: restarted
- Restart swift services when: init_script|changed
tags: tags:
- upstart-init - upstart-init
- swift-init - swift-init