aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/letsencrypt
diff options
context:
space:
mode:
authorRoman Krček <roman.krcek@tietoevry.com>2024-03-30 22:22:43 +0100
committerRoman Krček <roman.krcek@tietoevry.com>2024-06-28 09:04:43 +0200
commitfb3a8f5fa9373e0412bd8fd8317d7f1cd1083e37 (patch)
tree3b277f9c42143bcd9eaa987cf0cf8f19a0e979e1 /ansible/roles/letsencrypt
parent6e88d3dc794dc58856c8f6e14eea8f5761972064 (diff)
downloadkolla-ansible-fb3a8f5fa9373e0412bd8fd8317d7f1cd1083e37.tar.gz
kolla-ansible-fb3a8f5fa9373e0412bd8fd8317d7f1cd1083e37.zip
Performance: use filters for service dicts
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>
Diffstat (limited to 'ansible/roles/letsencrypt')
-rw-r--r--ansible/roles/letsencrypt/tasks/check-containers.yml5
-rw-r--r--ansible/roles/letsencrypt/tasks/config.yml18
-rw-r--r--ansible/roles/letsencrypt/tasks/precheck.yml3
3 files changed, 6 insertions, 20 deletions
diff --git a/ansible/roles/letsencrypt/tasks/check-containers.yml b/ansible/roles/letsencrypt/tasks/check-containers.yml
index 559baba73..0c20e0523 100644
--- a/ansible/roles/letsencrypt/tasks/check-containers.yml
+++ b/ansible/roles/letsencrypt/tasks/check-containers.yml
@@ -10,9 +10,6 @@
dimensions: "{{ item.value.dimensions }}"
healthcheck: "{{ item.value.healthcheck | default(omit) }}"
environment: "{{ item.value.environment | default(omit) }}"
- when:
- - inventory_hostname in groups[item.value.group]
- - item.value.enabled | bool
- with_dict: "{{ letsencrypt_services }}"
+ with_dict: "{{ letsencrypt_services | select_services_enabled_and_mapped_to_host }}"
notify:
- "Restart {{ item.key }} container"
diff --git a/ansible/roles/letsencrypt/tasks/config.yml b/ansible/roles/letsencrypt/tasks/config.yml
index 44011ee7e..5117f9d1c 100644
--- a/ansible/roles/letsencrypt/tasks/config.yml
+++ b/ansible/roles/letsencrypt/tasks/config.yml
@@ -7,10 +7,7 @@
group: "{{ config_owner_group }}"
mode: "0770"
become: true
- when:
- - inventory_hostname in groups[item.value.group]
- - item.value.enabled | bool
- with_dict: "{{ letsencrypt_services }}"
+ with_dict: "{{ letsencrypt_services | select_services_enabled_and_mapped_to_host }}"
- name: Copying over config.json files for services
template:
@@ -18,10 +15,7 @@
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
mode: "0660"
become: true
- when:
- - inventory_hostname in groups[item.value.group]
- - item.value.enabled | bool
- with_dict: "{{ letsencrypt_services }}"
+ with_dict: "{{ letsencrypt_services | select_services_enabled_and_mapped_to_host }}"
notify:
- "Restart {{ item.key }} container"
@@ -37,9 +31,7 @@
- "{{ node_custom_config }}/letsencrypt/{{ inventory_hostname }}/letsencrypt-webserver.conf"
- "{{ node_custom_config }}/letsencrypt/letsencrypt-webserver.conf"
- "letsencrypt-webserver.conf.j2"
- when:
- - inventory_hostname in groups[service.group]
- - service.enabled | bool
+ when: service | service_enabled_and_mapped_to_host
notify:
- Restart letsencrypt-webserver container
@@ -55,9 +47,7 @@
- { src: "crontab.j2", dest: "crontab" }
- { src: "id_rsa.j2", dest: "id_rsa" }
- { src: "letsencrypt-lego-run.sh.j2", dest: "letsencrypt-lego-run.sh" }
- when:
- - inventory_hostname in groups[service.group]
- - service.enabled | bool
+ when: service | service_enabled_and_mapped_to_host
notify:
- Restart letsencrypt-lego container
diff --git a/ansible/roles/letsencrypt/tasks/precheck.yml b/ansible/roles/letsencrypt/tasks/precheck.yml
index 6ad18cb53..ce8dac2f1 100644
--- a/ansible/roles/letsencrypt/tasks/precheck.yml
+++ b/ansible/roles/letsencrypt/tasks/precheck.yml
@@ -18,8 +18,7 @@
state: stopped
when:
- container_facts['letsencrypt_webserver'] is not defined
- - inventory_hostname in groups[service.group]
- - service.enabled | bool
+ - service | service_enabled_and_mapped_to_host
- name: Validating letsencrypt email variable
run_once: true