diff --git a/handlers/main.yml b/handlers/main.yml index 110cf85c..d36cb801 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -13,19 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Reload systemd daemon - command: "systemctl daemon-reload" - notify: - - Restart swift services - - name: Restart swift services service: name: "{{ item.value.program_name }}" + enabled: yes state: "restarted" - with_dict: "{{ swift_services }}" - when: - - inventory_hostname in groups[item.value.group] - - "{{ item.value.service_en | default(true) }}" + daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" + with_dict: "{{ filtered_swift_services }}" - name: Restart rsyslog service: diff --git a/tasks/main.yml b/tasks/main.yml index 835219d7..25aa57dd 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -27,60 +27,69 @@ # Check the swift_hash_path_* variables haven't changed - include: swift_check_hashes.yml static: no - when: not swift_force_change_hashes | bool + when: + - "not swift_force_change_hashes | bool" tags: - swift-config - include: swift_pre_install.yml + static: no when: - - swift_do_setup | bool - - inventory_hostname in groups['swift_all'] + - "swift_do_setup | bool" + - "'swift_all' in group_names" tags: - swift-install - include: swift_install.yml + static: no when: - - swift_do_setup | bool - - inventory_hostname in groups['swift_all'] + - "swift_do_setup | bool" + - "'swift_all' in group_names" tags: - swift-install - include: swift_post_install.yml + static: no when: - - swift_do_setup | bool - - inventory_hostname in groups['swift_all'] + - "swift_do_setup | bool" + - "'swift_all' in group_names" tags: - swift-config - include: swift_calculate_addresses.yml + static: no when: - - inventory_hostname in groups['swift_hosts'] + - "'swift_hosts' in group_names" tags: - always - include: swift_storage_hosts.yml + static: no when: - - inventory_hostname in groups['swift_hosts'] - - swift_do_setup | bool + - "swift_do_setup | bool" + - "'swift_hosts' in group_names" tags: - swift-config - include: swift_proxy_hosts.yml + static: no when: - - inventory_hostname in groups['swift_proxy'] - - swift_do_setup | bool + - "swift_do_setup | bool" + - "'swift_proxy' in group_names" tags: - swift-config -- include: swift_init_common.yml +- include: "swift_init_{{ ansible_service_mgr }}.yml" + static: no tags: - swift-config - include: swift_service_setup.yml + static: no when: - - inventory_hostname == groups['swift_all'][0] + - "swift_do_setup | bool" - '"keystoneauth" in swift_middleware_list' - - swift_do_setup | bool + - "inventory_hostname == ((groups['swift_all'] | intersect(ansible_play_hosts)) | list)[0]" tags: - swift-config @@ -100,27 +109,19 @@ - include: swift_key_setup.yml static: no when: - - swift_do_sync | bool - - need_sync is defined + - "swift_do_sync | bool" + - "need_sync is defined" tags: - swift-config - include: swift_rings.yml static: no when: - - swift_do_sync | bool - - need_sync is defined + - "swift_do_sync | bool" + - "need_sync is defined" tags: - swift-config - swift-rings - name: Flush handlers meta: flush_handlers - -- include: swift_sync_post_install.yml - static: no - when: - - swift_do_sync | bool - - not swift_do_setup | bool - tags: - - swift-config diff --git a/tasks/swift_init_common.yml b/tasks/swift_init_common.yml deleted file mode 100644 index 771ef14a..00000000 --- a/tasks/swift_init_common.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -# Copyright 2014, Rackspace US, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -- include: swift_init_systemd.yml - static: no - when: - - ansible_service_mgr == 'systemd' - -- name: Load service - service: - name: "{{ item.value.program_name }}" - enabled: "yes" - with_dict: "{{ filtered_swift_services }}" - notify: - - Restart swift services diff --git a/tasks/swift_init_systemd.yml b/tasks/swift_init_systemd.yml index 2a4c7319..ef4b7912 100644 --- a/tasks/swift_init_systemd.yml +++ b/tasks/swift_init_systemd.yml @@ -60,5 +60,5 @@ config_type: "ini" with_dict: "{{ filtered_swift_services }}" notify: - - Reload systemd daemon + - Restart swift services diff --git a/tasks/swift_sync_post_install.yml b/tasks/swift_sync_post_install.yml deleted file mode 100644 index 3a657a1d..00000000 --- a/tasks/swift_sync_post_install.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- -# Copyright 2014, Rackspace US, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -- name: "Ensure services are started" - service: - name: "{{ item.value.program_name }}" - state: "started" - with_dict: "{{ swift_services }}" - when: - - inventory_hostname in groups[item.value.group] - - "{{ item.value.service_en | default(true) }}"