Use 'loop' syntax instead of 'with_first_found'
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jérémy Lecour 2021-05-04 13:39:47 +02:00 committed by Jérémy Lecour
parent b3a62aa9d8
commit debc4a82ca
12 changed files with 87 additions and 62 deletions

View File

@ -19,6 +19,7 @@ The **patch** part changes incrementally at each release.
### Changed
* Use 'loop' syntax instead of 'with_first_found'
* apt: store keys in /etc/apt/trusted.gpg.d in ascii format
* evolinux-base: copy GPG key instead of using apt-key
* ntpd: Add leapfile configuration setting to ntpd on debian 10+

View File

@ -6,11 +6,13 @@
dest: "{{ evobackup_client__cron_path }}"
force: true
mode: 0755
with_first_found:
- "templates/evobackup-client/{{ evobackup_client__cron_template_name }}.{{ inventory_hostname }}.sh.j2"
- "templates/evobackup-client/{{ evobackup_client__cron_template_name }}.{{ host_group }}.sh.j2"
- "templates/evobackup-client/{{ evobackup_client__cron_template_name }}.sh.j2"
- "zzz_evobackup.default.sh.j2"
loop: "{{ query('first_found', templates) }}"
vars:
templates:
- "templates/evobackup-client/{{ evobackup_client__cron_template_name }}.{{ inventory_hostname }}.sh.j2"
- "templates/evobackup-client/{{ evobackup_client__cron_template_name }}.{{ host_group }}.sh.j2"
- "templates/evobackup-client/{{ evobackup_client__cron_template_name }}.sh.j2"
- "templates/zzz_evobackup.default.sh.j2"
tags:
- evobackup_client
- evobackup_client_backup_scripts

View File

@ -7,11 +7,11 @@
owner: root
group: root
mode: "0644"
with_first_found:
- files:
loop: "{{ query('first_found', templates, errors='ignore') }}"
vars:
templates:
- "motd/motd.{{ inventory_hostname }}.j2"
- "motd/motd.{{ host_group }}.j2"
- "motd/motd.default.j2"
skip: True
tags:
- motd

View File

@ -145,11 +145,13 @@
src: "{{ item }}"
dest: /etc/filebeat/filebeat.yml
force: "{{ filebeat_force_config }}"
with_first_found:
loop: "{{ query('first_found', templates) }}"
vars:
templates:
- "templates/filebeat/filebeat.{{ inventory_hostname }}.yml.j2"
- "templates/filebeat/filebeat.{{ host_group }}.yml.j2"
- "templates/filebeat/filebeat.default.yml.j2"
- "filebeat.default.yml.j2"
- "templates/filebeat.default.yml.j2"
notify: restart filebeat
when: filebeat_update_config
when: filebeat_use_config_template

View File

@ -103,10 +103,10 @@
loop: "{{ query('first_found', templates) }}"
vars:
templates:
- "templates/haproxy/haproxy.{{ inventory_hostname }}.cfg.j2"
- "templates/haproxy/haproxy.{{ host_group | default('all') }}.cfg.j2"
- "templates/haproxy/haproxy.default.cfg.j2"
- "haproxy.default.cfg.j2"
- "templates/haproxy/haproxy.{{ inventory_hostname }}.cfg.j2"
- "templates/haproxy/haproxy.{{ host_group | default('all') }}.cfg.j2"
- "templates/haproxy/haproxy.default.cfg.j2"
- "templates/haproxy.default.cfg.j2"
notify: reload haproxy
when: haproxy_update_config
tags:

View File

@ -72,11 +72,13 @@
group: logstash
mode: "0640"
force: yes
with_first_found:
- "templates/logstash/logstash.{{ inventory_hostname }}.conf.j2"
- "templates/logstash/logstash.{{ host_group }}.conf.j2"
- "templates/logstash/logstash.default.conf.j2"
- "logstash.default.conf.j2"
loop: "{{ query('first_found', templates) }}"
vars:
templates:
- "templates/logstash/logstash.{{ inventory_hostname }}.conf.j2"
- "templates/logstash/logstash.{{ host_group }}.conf.j2"
- "templates/logstash/logstash.default.conf.j2"
- "templates/logstash.default.conf.j2"
register: logstash_template
- debug:

View File

@ -119,11 +119,13 @@
src: "{{ item }}"
dest: /etc/metricbeat/metricbeat.yml
force: "{{ metricbeat_force_config }}"
with_first_found:
loop: "{{ query('first_found', templates) }}"
vars:
templates:
- "templates/metricbeat/metricbeat.{{ inventory_hostname }}.yml.j2"
- "templates/metricbeat/metricbeat.{{ host_group }}.yml.j2"
- "templates/metricbeat/metricbeat.default.yml.j2"
- "metricbeat.default.yml.j2"
- "templates/metricbeat.default.yml.j2"
notify: restart metricbeat
when: metricbeat_update_config
when: metricbeat_use_config_template

View File

@ -4,11 +4,13 @@
src: "{{ item }}"
dest: "{{ minifirewall_tail_file }}"
force: "{{ minifirewall_tail_force | bool }}"
with_first_found:
- "templates/minifirewall-tail/minifirewall.{{ inventory_hostname }}.tail.j2"
- "templates/minifirewall-tail/minifirewall.{{ host_group }}.tail.j2"
- "templates/minifirewall-tail/minifirewall.default.tail.j2"
- "minifirewall.default.tail.j2"
loop: "{{ query('first_found', templates) }}"
vars:
templates:
- "templates/minifirewall-tail/minifirewall.{{ inventory_hostname }}.tail.j2"
- "templates/minifirewall-tail/minifirewall.{{ host_group }}.tail.j2"
- "templates/minifirewall-tail/minifirewall.default.tail.j2"
- "templates/minifirewall.default.tail.j2"
register: minifirewall_tail_template
- debug:

View File

@ -84,15 +84,17 @@
dest: "{{ varnish_config_file }}"
mode: "0644"
force: yes
with_first_found:
- "templates/varnish/varnish.{{ inventory_hostname }}.vcl.j2"
- "templates/varnish/default.{{ inventory_hostname }}.vcl.j2"
- "templates/varnish/varnish.{{ host_group }}.vcl.j2"
- "templates/varnish/default.{{ host_group }}.vcl.j2"
- "templates/varnish/varnish.default.vcl.j2"
- "templates/varnish/default.default.vcl.j2"
- "varnish.vcl.j2"
- "default.vcl.j2"
loop: "{{ query('first_found', templates) }}"
vars:
templates:
- "templates/varnish/varnish.{{ inventory_hostname }}.vcl.j2"
- "templates/varnish/default.{{ inventory_hostname }}.vcl.j2"
- "templates/varnish/varnish.{{ host_group }}.vcl.j2"
- "templates/varnish/default.{{ host_group }}.vcl.j2"
- "templates/varnish/varnish.default.vcl.j2"
- "templates/varnish/default.default.vcl.j2"
- "templates/varnish.vcl.j2"
- "templates/default.vcl.j2"
notify: reload varnish
tags:
- varnish

View File

@ -11,11 +11,13 @@
src: "{{ item }}"
dest: /etc/evolinux/web-add.conf
force: "{{ evoadmin_add_conf_force }}"
with_first_found:
loop: "{{ query('first_found', templates) }}"
vars:
templates:
- "templates/evoadmin-web/web-add.{{ inventory_hostname }}.conf.j2"
- "templates/evoadmin-web/web-add.{{ host_group }}.conf.j2"
- "templates/evoadmin-web/web-add.conf.j2"
- "web-add.conf.j2"
- "templates/web-add.conf.j2"
register: evoadmin_add_conf_template
- name: Configure web-add template file for mail
@ -23,9 +25,11 @@
src: "{{ item }}"
dest: "{{ evoadmin_scripts_dir }}/web-mail.tpl"
force: "{{ evoadmin_mail_tpl_force }}"
with_first_found:
- "templates/evoadmin-web/web-mail.{{ inventory_hostname }}.tpl.j2"
- "templates/evoadmin-web/web-mail.{{ host_group }}.tpl.j2"
- "templates/evoadmin-web/web-mail.tpl.j2"
- "web-mail.tpl.j2"
loop: "{{ query('first_found', templates) }}"
vars:
templates:
- "templates/evoadmin-web/web-mail.{{ inventory_hostname }}.tpl.j2"
- "templates/evoadmin-web/web-mail.{{ host_group }}.tpl.j2"
- "templates/evoadmin-web/web-mail.tpl.j2"
- "templates/web-mail.tpl.j2"
register: evoadmin_mail_tpl_template

View File

@ -112,9 +112,11 @@
mode: "0600"
force: "{{ evoadmin_sudoers_conf_force }}"
validate: "visudo -cf %s"
with_first_found:
- "templates/evoadmin-web/sudoers.{{ inventory_hostname }}.j2"
- "templates/evoadmin-web/sudoers.{{ host_group }}.j2"
- "templates/evoadmin-web/sudoers.j2"
- "sudoers.j2"
loop: "{{ query('first_found', templates) }}"
vars:
templates:
- "templates/evoadmin-web/sudoers.{{ inventory_hostname }}.j2"
- "templates/evoadmin-web/sudoers.{{ host_group }}.j2"
- "templates/evoadmin-web/sudoers.j2"
- "templates/sudoers.j2"
register: evoadmin_sudoers_conf

View File

@ -32,11 +32,13 @@
src: "{{ item }}"
dest: /etc/apache2/sites-available/evoadmin.conf
force: "{{ evoadmin_force_vhost }}"
with_first_found:
- "templates/evoadmin-web/evoadmin.{{ inventory_hostname }}.conf.j2"
- "templates/evoadmin-web/evoadmin.{{ host_group }}.conf.j2"
- "templates/evoadmin-web/evoadmin.conf.j2"
- "evoadmin.conf.j2"
loop: "{{ query('first_found', templates) }}"
vars:
templates:
- "templates/evoadmin-web/evoadmin.{{ inventory_hostname }}.conf.j2"
- "templates/evoadmin-web/evoadmin.{{ host_group }}.conf.j2"
- "templates/evoadmin-web/evoadmin.conf.j2"
- "templates/evoadmin.conf.j2"
register: evoadmin_vhost_template
notify: reload apache2
@ -62,11 +64,13 @@
owner: root
group: www-data
force: "{{ evoadmin_htpasswd_force }}"
with_first_found:
- "templates/evoadmin-web/htpasswd.{{ inventory_hostname }}.j2"
- "templates/evoadmin-web/htpasswd.{{ host_group }}.j2"
- "templates/evoadmin-web/htpasswd.j2"
- "htpasswd.j2"
loop: "{{ query('first_found', templates) }}"
vars:
templates:
- "templates/evoadmin-web/htpasswd.{{ inventory_hostname }}.j2"
- "templates/evoadmin-web/htpasswd.{{ host_group }}.j2"
- "templates/evoadmin-web/htpasswd.j2"
- "templates/htpasswd.j2"
register: evoadmin_htpasswd_template
when: evoadmin_htpasswd
@ -78,9 +82,11 @@
owner: evoadmin
group: evoadmin
force: "{{ evoadmin_config_local_php_force }}"
with_first_found:
- "templates/evoadmin-web/config.local.{{ inventory_hostname }}.php.j2"
- "templates/evoadmin-web/config.local.{{ host_group }}.php.j2"
- "templates/evoadmin-web/config.local.php.j2"
- "config.local.php.j2"
loop: "{{ query('first_found', templates) }}"
vars:
templates:
- "templates/evoadmin-web/config.local.{{ inventory_hostname }}.php.j2"
- "templates/evoadmin-web/config.local.{{ host_group }}.php.j2"
- "templates/evoadmin-web/config.local.php.j2"
- "templates/config.local.php.j2"
register: evoadmin_config_local_php_template