fb3a8f5fa9
Most roles are not leveraging the jinja filters available. According to [1] filtering the list of services makes the execution faster than skipping the tasks. This patchset also includes some cosmetic changes to genconfig. Individual services are now also using a jinja filter. This has no impact on performance, just makes the tasks look cleaner. Naming of some vars in genconfig was changed to "service" to make the tasks more uniform as some were previously using the service name and some were using "service". Three metrics from the deployment were taken and those were - overall deployment time [s] - time spent on the specific role [s] - CPU usage (measured with perf) [-] Overall genconfig time went down on avg. from 209s to 195s Time spent on the loadbalancer role went down on avg. from 27s to 23s Time spent on the neutron role went down on avg from 102s to 95s Time spent on the nova-cell role went down on avg. from 54s to 52s Also the average CPUs utilized reported by perf went down from 3.31 to 3.15. For details of how this was measured see the comments in gerrit. [1] - https://github.com/stackhpc/ansible-scaling/blob/master/doc/skip.md Change-Id: Ib0f00aadb6c7022de6e8b455ac4b9b8cd6be5b1b Signed-off-by: Roman Krček <roman.krcek@tietoevry.com>
229 lines
7.2 KiB
YAML
229 lines
7.2 KiB
YAML
---
|
|
- name: Ensuring config directories exist
|
|
file:
|
|
path: "{{ node_config_directory }}/{{ item.key }}"
|
|
state: "directory"
|
|
owner: "{{ config_owner_user }}"
|
|
group: "{{ config_owner_group }}"
|
|
mode: "0770"
|
|
become: true
|
|
with_dict: "{{ keystone_services | select_services_enabled_and_mapped_to_host }}"
|
|
|
|
- name: Check if policies shall be overwritten
|
|
stat:
|
|
path: "{{ item }}"
|
|
delegate_to: localhost
|
|
run_once: True
|
|
register: keystone_policy
|
|
with_first_found:
|
|
- files: "{{ supported_policy_format_list }}"
|
|
paths:
|
|
- "{{ node_custom_config }}/keystone/"
|
|
skip: true
|
|
|
|
- name: Set keystone policy file
|
|
set_fact:
|
|
keystone_policy_file: "{{ keystone_policy.results.0.stat.path | basename }}"
|
|
keystone_policy_file_path: "{{ keystone_policy.results.0.stat.path }}"
|
|
when:
|
|
- keystone_policy.results
|
|
|
|
- name: Check if Keystone domain-specific config is supplied
|
|
stat:
|
|
path: "{{ node_custom_config }}/keystone/domains"
|
|
delegate_to: localhost
|
|
run_once: True
|
|
register: keystone_domain_directory
|
|
|
|
- include_tasks: copy-certs.yml
|
|
when:
|
|
- kolla_copy_ca_into_containers | bool or keystone_enable_tls_backend | bool
|
|
|
|
- name: Copying over config.json files for services
|
|
template:
|
|
src: "{{ item.key }}.json.j2"
|
|
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
|
|
mode: "0660"
|
|
become: true
|
|
with_dict: "{{ keystone_services | select_services_enabled_and_mapped_to_host }}"
|
|
notify:
|
|
- Restart {{ item.key }} container
|
|
|
|
- name: Copying over keystone.conf
|
|
vars:
|
|
service_name: "{{ item.key }}"
|
|
merge_configs:
|
|
sources:
|
|
- "{{ role_path }}/templates/keystone.conf.j2"
|
|
- "{{ node_custom_config }}/global.conf"
|
|
- "{{ node_custom_config }}/keystone.conf"
|
|
- "{{ node_custom_config }}/keystone/{{ item.key }}.conf"
|
|
- "{{ node_custom_config }}/keystone/{{ inventory_hostname }}/keystone.conf"
|
|
dest: "{{ node_config_directory }}/{{ item.key }}/keystone.conf"
|
|
mode: "0660"
|
|
become: true
|
|
with_dict: "{{ keystone_services | select_services_enabled_and_mapped_to_host }}"
|
|
when:
|
|
- item.key in [ "keystone", "keystone-fernet" ]
|
|
notify:
|
|
- Restart {{ item.key }} container
|
|
|
|
- name: Copying keystone-startup script for keystone
|
|
vars:
|
|
service: "{{ keystone_services['keystone'] }}"
|
|
template:
|
|
src: "keystone-startup.sh.j2"
|
|
dest: "{{ node_config_directory }}/keystone/keystone-startup.sh"
|
|
mode: "0660"
|
|
become: true
|
|
when: service | service_enabled_and_mapped_to_host
|
|
notify:
|
|
- Restart keystone container
|
|
|
|
- name: Create Keystone domain-specific config directory
|
|
vars:
|
|
service: "{{ keystone_services['keystone'] }}"
|
|
file:
|
|
dest: "{{ node_config_directory }}/keystone/domains/"
|
|
state: "directory"
|
|
mode: "0770"
|
|
become: true
|
|
when:
|
|
- service | service_enabled_and_mapped_to_host
|
|
- keystone_domain_directory.stat.exists
|
|
|
|
- name: Get file list in custom domains folder
|
|
find:
|
|
path: "{{ node_custom_config }}/keystone/domains"
|
|
recurse: no
|
|
file_type: file
|
|
delegate_to: localhost
|
|
register: keystone_domains
|
|
when: keystone_domain_directory.stat.exists
|
|
|
|
- name: Copying Keystone Domain specific settings
|
|
vars:
|
|
service: "{{ keystone_services['keystone'] }}"
|
|
template:
|
|
src: "{{ item.path }}"
|
|
dest: "{{ node_config_directory }}/keystone/domains/"
|
|
mode: "0660"
|
|
become: true
|
|
register: keystone_domains
|
|
when:
|
|
- service | service_enabled_and_mapped_to_host
|
|
- keystone_domain_directory.stat.exists
|
|
with_items: "{{ keystone_domains.files | default([]) }}"
|
|
notify:
|
|
- Restart keystone container
|
|
|
|
- name: Copying over existing policy file
|
|
template:
|
|
src: "{{ keystone_policy_file_path }}"
|
|
dest: "{{ node_config_directory }}/{{ item.key }}/{{ keystone_policy_file }}"
|
|
mode: "0660"
|
|
become: true
|
|
when:
|
|
- item.key in [ "keystone", "keystone-fernet" ]
|
|
- keystone_policy_file is defined
|
|
with_dict: "{{ keystone_services | select_services_enabled_and_mapped_to_host }}"
|
|
notify:
|
|
- Restart {{ item.key }} container
|
|
|
|
- include_tasks: config-federation-oidc.yml
|
|
when:
|
|
- keystone_enable_federation_openid | bool
|
|
|
|
- name: Copying over wsgi-keystone.conf
|
|
vars:
|
|
service: "{{ keystone_services['keystone'] }}"
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: "{{ node_config_directory }}/keystone/wsgi-keystone.conf"
|
|
mode: "0660"
|
|
become: true
|
|
when: service | service_enabled_and_mapped_to_host
|
|
with_first_found:
|
|
- "{{ node_custom_config }}/keystone/{{ inventory_hostname }}/wsgi-keystone.conf"
|
|
- "{{ node_custom_config }}/keystone/wsgi-keystone.conf"
|
|
- "wsgi-keystone.conf.j2"
|
|
notify:
|
|
- Restart keystone container
|
|
|
|
- name: Checking whether keystone-paste.ini file exists
|
|
vars:
|
|
service: "{{ keystone_services['keystone'] }}"
|
|
stat:
|
|
path: "{{ node_custom_config }}/keystone/keystone-paste.ini"
|
|
delegate_to: localhost
|
|
run_once: True
|
|
register: check_keystone_paste_ini
|
|
when: service | service_enabled_and_mapped_to_host
|
|
|
|
- name: Copying over keystone-paste.ini
|
|
vars:
|
|
service: "{{ keystone_services['keystone'] }}"
|
|
template:
|
|
src: "{{ node_custom_config }}/keystone/keystone-paste.ini"
|
|
dest: "{{ node_config_directory }}/keystone/keystone-paste.ini"
|
|
mode: "0660"
|
|
become: true
|
|
when:
|
|
- service | service_enabled_and_mapped_to_host
|
|
- check_keystone_paste_ini.stat.exists
|
|
notify:
|
|
- Restart keystone container
|
|
|
|
- name: Generate the required cron jobs for the node
|
|
command: >
|
|
{{ ansible_playbook_python }} {{ role_path }}/files/fernet_rotate_cron_generator.py
|
|
-t {{ (fernet_key_rotation_interval | int) // 60 }}
|
|
-i {{ groups['keystone'].index(inventory_hostname) }}
|
|
-n {{ (groups['keystone'] | length) }}
|
|
changed_when: false
|
|
check_mode: false
|
|
register: cron_jobs_json
|
|
connection: local
|
|
delegate_to: localhost
|
|
|
|
- name: Set fact with the generated cron jobs for building the crontab later
|
|
set_fact:
|
|
cron_jobs: "{{ (cron_jobs_json.stdout | from_json).cron_jobs }}"
|
|
ignore_errors: "{{ ansible_check_mode }}"
|
|
|
|
- name: Copying files for keystone-fernet
|
|
vars:
|
|
service: "{{ keystone_services['keystone-fernet'] }}"
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ node_config_directory }}/keystone-fernet/{{ item.dest }}"
|
|
mode: "0660"
|
|
become: true
|
|
ignore_errors: "{{ ansible_check_mode }}"
|
|
with_items:
|
|
- { src: "crontab.j2", dest: "crontab" }
|
|
- { src: "fernet-rotate.sh.j2", dest: "fernet-rotate.sh" }
|
|
- { src: "fernet-node-sync.sh.j2", dest: "fernet-node-sync.sh" }
|
|
- { src: "fernet-push.sh.j2", dest: "fernet-push.sh" }
|
|
- { src: "fernet-healthcheck.sh.j2", dest: "fernet-healthcheck.sh" }
|
|
- { src: "id_rsa", dest: "id_rsa" }
|
|
- { src: "ssh_config.j2", dest: "ssh_config" }
|
|
when: service | service_enabled_and_mapped_to_host
|
|
notify:
|
|
- Restart keystone-fernet container
|
|
|
|
- name: Copying files for keystone-ssh
|
|
vars:
|
|
service: "{{ keystone_services['keystone-ssh'] }}"
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ node_config_directory }}/keystone-ssh/{{ item.dest }}"
|
|
mode: "0660"
|
|
become: true
|
|
with_items:
|
|
- { src: "sshd_config.j2", dest: "sshd_config" }
|
|
- { src: "id_rsa.pub", dest: "id_rsa.pub" }
|
|
when: service | service_enabled_and_mapped_to_host
|
|
notify:
|
|
- Restart keystone-ssh container
|