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 474d3ba232
commit c306a1308c
8 changed files with 61 additions and 29 deletions

View File

@ -127,21 +127,24 @@ swift_apt_packages:
- python-dev
- rsync
swift_program_names:
- swift-proxy-server
- swift-object-server
- swift-object-auditor
- swift-object-replicator
- swift-object-updater
- swift-object-server-replicator
swift_account_program_names:
- swift-account-server
- swift-account-auditor
- swift-account-replicator
- swift-account-reaper
swift_container_program_names:
- swift-container-server
- swift-container-auditor
- swift-container-replicator
- swift-container-sync
- swift-container-updater
- swift-container-server-replicator
- swift-account-server
- swift-account-auditor
- swift-account-replicator
- swift-account-reaper
- swift-account-server-replicator
swift_object_program_names:
- swift-object-server
- swift-object-auditor
- swift-object-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
# limitations under the License.
- name: Restart swift services
- name: Restart swift account services
service:
name: "{{ item }}"
state: "restarted"
pattern: "{{ item }}"
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
- name: Restart service

View File

@ -23,7 +23,11 @@
- { src: "swift.conf.j2", dest: "/etc/swift/swift.conf" }
- { src: "swift-rsyslog.conf.j2", dest: "/etc/rsyslog.d/49-swift.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:
- swift-config
- swift-post-install

View File

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

View File

@ -75,7 +75,7 @@
mode: "0644"
with_items:
- { 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
- name: "Swift account server replicator configuration"
@ -90,4 +90,4 @@
when: >
swift.replication_network is defined and
swift.replication_network != swift.storage_network
notify: Restart swift services
notify: Restart swift account services

View File

@ -84,7 +84,7 @@
mode: "0644"
with_items:
- { 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
- name: "Swift container server configuration"
@ -99,4 +99,4 @@
when: >
swift.replication_network is defined and
swift.replication_network != swift.storage_network
notify: Restart swift services
notify: Restart swift container services

View File

@ -75,7 +75,7 @@
mode: "0644"
with_items:
- { 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
- name: "Swift object server configuration"
@ -90,4 +90,4 @@
when: >
swift.replication_network is defined and
swift.replication_network != swift.storage_network
notify: Restart swift services
notify: Restart swift object services

View File

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