diff --git a/CHANGELOG.md b/CHANGELOG.md index f994d98f..46475fb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ The **patch** part changes incrementally at each release. ### Changed -* Use 'loop' syntax instead of 'with_first_found/with_items/with_dict' +* Use 'loop' syntax instead of 'with_first_found/with_items/with_dict/with_nested' * 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+ diff --git a/kvm-host/tasks/ssh.yml b/kvm-host/tasks/ssh.yml index 7e42238b..1b0f7915 100644 --- a/kvm-host/tasks/ssh.yml +++ b/kvm-host/tasks/ssh.yml @@ -21,9 +21,10 @@ state: present key: "{{ item[0] }}" delegate_to: "{{ item[1] }}" - with_nested: - - "{{ ssh_keys.stdout }}" - - "{{ groups['hypervisors'] }}" + loop: "{{ _keys | product(_servers) | list }}" + vars: + _keys: ssh_keys.stdout + _servers: groups['hypervisors'] when: item[1] != inventory_hostname - name: Crontab for sync libvirt xml file diff --git a/mysql-oracle/tasks/users.yml b/mysql-oracle/tasks/users.yml index 508ab4cc..da1ca05f 100644 --- a/mysql-oracle/tasks/users.yml +++ b/mysql-oracle/tasks/users.yml @@ -71,11 +71,12 @@ option: '{{ item[1].option }}' value: '{{ item[1].value }}' create: yes - with_nested: - - [ "client", "mysql_upgrade" ] - - [ { option: 'user', value: 'debian-sys-maint' }, - { option: 'password', value: '{{ mysql_debian_password.stdout }}' } - ] + loop: "{{ _sections | product(_credentials) | list }}" + vars: + _sections: [ 'client', 'mysql_upgrade' ] + _credentials: + - { option: 'user', value: 'debian-sys-maint' } + - { option: 'password', value: '{{ mysql_debian_password.stdout }}' } when: create_debian_user is changed tags: - mysql diff --git a/mysql/tasks/users_stretch.yml b/mysql/tasks/users_stretch.yml index 0613de19..bca16bc6 100644 --- a/mysql/tasks/users_stretch.yml +++ b/mysql/tasks/users_stretch.yml @@ -63,7 +63,7 @@ config_file: "/root/.my.cnf" register: create_debian_user tags: - - mysql + - mysql - name: store debian-sys-maint user credentials ini_file: @@ -73,14 +73,15 @@ option: '{{ item[1].option }}' value: '{{ item[1].value }}' create: yes - with_nested: - - [ "client", "mysql_upgrade" ] - - [ { option: 'user', value: 'debian-sys-maint' }, - { option: 'password', value: '{{ mysql_debian_password.stdout }}' } - ] + loop: "{{ _sections | product(_credentials) | list }}" + vars: + _sections: [ 'client', 'mysql_upgrade' ] + _credentials: + - { option: 'user', value: 'debian-sys-maint' } + - { option: 'password', value: '{{ mysql_debian_password.stdout }}' } when: create_debian_user.changed tags: - - mysql + - mysql - name: remove root user mysql_user: @@ -89,4 +90,4 @@ config_file: "/root/.my.cnf" state: absent tags: - - mysql + - mysql diff --git a/postgresql/tasks/munin.yml b/postgresql/tasks/munin.yml index 5292b017..4e62ddf6 100644 --- a/postgresql/tasks/munin.yml +++ b/postgresql/tasks/munin.yml @@ -28,8 +28,9 @@ state: link src: '/usr/share/munin/plugins/{{item[0]}}' dest: '/etc/munin/plugins/{{item[0]}}{{item[1]}}' - with_nested: - - ['postgres_cache_', 'postgres_connections_', 'postgres_locks_', 'postgres_querylength_', 'postgres_scans_', 'postgres_size_', 'postgres_transactions_', 'postgres_tuples_'] - - '{{postgresql_databases}}' + loop: "{{ _plugins | product(_databases) | list }}" + vars: + _plugins: ['postgres_cache_', 'postgres_connections_', 'postgres_locks_', 'postgres_querylength_', 'postgres_scans_', 'postgres_size_', 'postgres_transactions_', 'postgres_tuples_'] + _databases: postgresql_databases notify: restart munin-node when: etc_munin_plugins.stat.exists and usr_share_munin_plugins.stat.exists