kolla-ansible/ansible/roles/freezer/tasks/bootstrap.yml
Mark Goddard 496904d650 Performance: use import_tasks for register and bootstrap
Including tasks has a performance penalty when compared with importing
tasks. If the include has a condition associated with it, then the
overhead of the include may be lower than the overhead of skipping all
imported tasks. In the case of the register.yml and bootstrap.yml
includes, all of the tasks in the included file use run_once: True.
The run_once flag improves performance at scale drastically, so
importing these tasks unconditionally will have a lower overhead than a
conditional include task.  It therefore makes sense to switch to use
import_tasks there.

See [1] for benchmarks of run_once.

[1] https://github.com/stackhpc/ansible-scaling/blob/master/doc/run-once.md

Change-Id: Ic67631ca3ea3fb2081a6f8978e85b1522522d40d
Partially-Implements: blueprint performance-improvements
2020-08-28 16:31:04 +00:00

39 lines
1.2 KiB
YAML

---
- name: Creating Freezer database
kolla_toolbox:
module_name: mysql_db
module_args:
login_host: "{{ database_address }}"
login_port: "{{ database_port }}"
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ freezer_database_name }}"
become: true
run_once: True
delegate_to: "{{ groups['freezer-api'][0] }}"
when:
- freezer_database_backend == 'mariadb'
- not use_preconfigured_databases | bool
- name: Creating Freezer database user and setting permissions
kolla_toolbox:
module_name: mysql_user
module_args:
login_host: "{{ database_address }}"
login_port: "{{ database_port }}"
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ freezer_database_user }}"
password: "{{ freezer_database_password }}"
host: "%"
priv: "{{ freezer_database_name }}.*:ALL"
append_privs: "yes"
become: true
run_once: True
delegate_to: "{{ groups['freezer-api'][0] }}"
when:
- freezer_database_backend == 'mariadb'
- not use_preconfigured_databases | bool
- import_tasks: bootstrap_service.yml