Optimise the execution of the role
This patch implements the use of dynamic includes,
the filtered service list and the elimination of
redundant tasks in order to optimise the role
execution.
Conflicts:
>------tasks/main.yml
Change-Id: Ia957bd80ec6a97a29b4b3a1c28bf37dfc9226ab1
(cherry picked from commit 01c3728efc
)
This commit is contained in:
parent
a279b08103
commit
84e939a4d0
@ -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:
|
||||
|
@ -27,83 +27,85 @@
|
||||
# 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"
|
||||
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
|
||||
|
||||
- include: swift_key_setup.yml
|
||||
static: no
|
||||
when: swift_do_sync | bool
|
||||
when:
|
||||
- "swift_do_sync | bool"
|
||||
tags:
|
||||
- swift-config
|
||||
|
||||
- include: swift_rings.yml
|
||||
static: no
|
||||
when: swift_do_sync | bool
|
||||
when:
|
||||
- "swift_do_sync | bool"
|
||||
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
|
||||
|
@ -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
|
@ -60,5 +60,5 @@
|
||||
config_type: "ini"
|
||||
with_dict: "{{ filtered_swift_services }}"
|
||||
notify:
|
||||
- Reload systemd daemon
|
||||
- Restart swift services
|
||||
|
||||
|
@ -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) }}"
|
Loading…
Reference in New Issue
Block a user