Optimise the role execution
This patch does the following: - Instead of scoping to the inventory group name, we scope to the play hosts. This allows the execution of the role using limits to still execute the necessary tasks. - A little style update is done to improve readability. - Some includes are changed from static to dynamic to improve execution speed. - The tag for the translations async finalisation is changed to 'horizon-config' to match the rest of the config related tasks, including the task which starts the async process. - The enabling and starting up of Apache is moved to the handler so that it's all done in one task. Change-Id: If9726035d1fae0ec78aead38eb85f4d30a45a07c
This commit is contained in:
parent
88d8b84d5d
commit
faa5b91e1f
@ -16,4 +16,6 @@
|
|||||||
- name: Restart apache2
|
- name: Restart apache2
|
||||||
service:
|
service:
|
||||||
name: "{{ horizon_system_service_name }}"
|
name: "{{ horizon_system_service_name }}"
|
||||||
|
enabled: yes
|
||||||
state: "restarted"
|
state: "restarted"
|
||||||
|
daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}"
|
||||||
|
@ -41,8 +41,8 @@
|
|||||||
template:
|
template:
|
||||||
src: "{{ item.src }}"
|
src: "{{ item.src }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
owner: "{{ item.owner|default(horizon_system_user_name) }}"
|
owner: "{{ item.owner | default(horizon_system_user_name) }}"
|
||||||
group: "{{ item.group|default(horizon_system_group_name) }}"
|
group: "{{ item.group | default(horizon_system_group_name) }}"
|
||||||
with_items: "{{ horizon_apache_configs }}"
|
with_items: "{{ horizon_apache_configs }}"
|
||||||
notify: Restart apache2
|
notify: Restart apache2
|
||||||
|
|
||||||
@ -83,17 +83,11 @@
|
|||||||
line: "ServerSignature {{ horizon_apache_serversignature }}"
|
line: "ServerSignature {{ horizon_apache_serversignature }}"
|
||||||
notify: Restart apache2
|
notify: Restart apache2
|
||||||
|
|
||||||
# Removing the Listen from apache config to prevent conflick with ports.conf on CentOS
|
# Removing the Listen from apache config to prevent conflicts with ports.conf on CentOS
|
||||||
- name: remove Listen from Apache config
|
- name: Remove Listen from Apache config
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: "{{ horizon_apache_security_conf }}"
|
dest: "{{ horizon_apache_security_conf }}"
|
||||||
regexp: '^(Listen.*)'
|
regexp: '^(Listen.*)'
|
||||||
backrefs: yes
|
backrefs: yes
|
||||||
line: '#\1'
|
line: '#\1'
|
||||||
notify: Restart apache2
|
notify: Restart apache2
|
||||||
|
|
||||||
- name: Load service
|
|
||||||
service:
|
|
||||||
name: "{{ horizon_system_service_name }}"
|
|
||||||
enabled: "yes"
|
|
||||||
state: "started"
|
|
||||||
|
@ -37,28 +37,29 @@
|
|||||||
- horizon-config
|
- horizon-config
|
||||||
|
|
||||||
- include: horizon_db_setup.yml
|
- include: horizon_db_setup.yml
|
||||||
when: inventory_hostname == groups['horizon_all'][0]
|
static: no
|
||||||
|
when: inventory_hostname == ansible_play_hosts[0]
|
||||||
tags:
|
tags:
|
||||||
- horizon-config
|
- horizon-config
|
||||||
|
|
||||||
- include: horizon_ssl_self_signed.yml
|
- include: horizon_ssl_self_signed.yml
|
||||||
static: no
|
static: no
|
||||||
when:
|
when:
|
||||||
- not horizon_external_ssl|bool
|
- not horizon_external_ssl | bool
|
||||||
- horizon_user_ssl_cert is not defined or horizon_user_ssl_key is not defined
|
- horizon_user_ssl_cert is not defined or horizon_user_ssl_key is not defined
|
||||||
tags:
|
tags:
|
||||||
- horizon-config
|
- horizon-config
|
||||||
|
|
||||||
- include: horizon_ssl_user_provided.yml
|
- include: horizon_ssl_user_provided.yml
|
||||||
static: no
|
static: no
|
||||||
when: not horizon_external_ssl|bool
|
when: not horizon_external_ssl | bool
|
||||||
tags:
|
tags:
|
||||||
- horizon-config
|
- horizon-config
|
||||||
|
|
||||||
- name: Update the ca certificates
|
- name: Update the ca certificates
|
||||||
command: "update-ca-certificates -f"
|
command: "update-ca-certificates -f"
|
||||||
when:
|
when:
|
||||||
- not horizon_external_ssl|bool
|
- not horizon_external_ssl | bool
|
||||||
- ansible_pkg_mgr == 'apt'
|
- ansible_pkg_mgr == 'apt'
|
||||||
tags:
|
tags:
|
||||||
- horizon-config
|
- horizon-config
|
||||||
@ -101,9 +102,10 @@
|
|||||||
- horizon-config
|
- horizon-config
|
||||||
|
|
||||||
- include: horizon_translations_update.yml
|
- include: horizon_translations_update.yml
|
||||||
|
static: no
|
||||||
when: horizon_translations_update | bool
|
when: horizon_translations_update | bool
|
||||||
tags:
|
tags:
|
||||||
- horizon-translations-update
|
- horizon-config
|
||||||
|
|
||||||
- name: Flush handlers
|
- name: Flush handlers
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
Loading…
Reference in New Issue
Block a user