| 
2 | 2 | - name: Validate wordpress_sites  | 
3 | 3 |   fail:  | 
4 | 4 |     msg: "{{ lookup('template', 'wordpress_sites.j2') }}"  | 
5 |  | -  when: wordpress_sites.keys() | difference(vault_wordpress_sites.keys()) | count  | 
 | 5 | +  when: wordpress_sites.keys() | difference(vault_wordpress_sites.keys()) | count > 0  | 
6 | 6 |   tags: [wordpress]  | 
7 | 7 | 
 
  | 
8 | 8 | - name: Validate format of site_hosts  | 
 | 
11 | 11 |   loop: "{{ wordpress_sites | dict2items }}"  | 
12 | 12 |   loop_control:  | 
13 | 13 |     label: "{{ item.key }}"  | 
14 |  | -  when: item.value.site_hosts | rejectattr('canonical', 'defined') | list | count  | 
 | 14 | +  when: item.value.site_hosts | rejectattr('canonical', 'defined') | list | count > 0  | 
15 | 15 |   tags: [letsencrypt, wordpress]  | 
16 | 16 | 
 
  | 
17 | 17 | - name: Import PHP version specific vars  | 
 | 
29 | 29 | - name: Verify dict format for package component variables  | 
30 | 30 |   fail:  | 
31 | 31 |     msg: "{{ lookup('template', 'package_vars_wrong_format_msg.j2') }}"  | 
32 |  | -  when: package_vars_wrong_format | count  | 
 | 32 | +  when: package_vars_wrong_format | count > 0  | 
33 | 33 |   vars:  | 
34 | 34 |     package_vars:  | 
35 | 35 |       apt_packages_default: "{{ apt_packages_default }}"  | 
 | 
40 | 40 |       php_extensions_custom: "{{ php_extensions_custom }}"  | 
41 | 41 |       sshd_packages_default: "{{ sshd_packages_default }}"  | 
42 | 42 |       sshd_packages_custom: "{{ sshd_packages_custom }}"  | 
43 |  | -    package_vars_wrong_format: "[{% for k,v in package_vars.items() | list if v | type_debug != 'dict' %}'{{ k }}',{% endfor %}]"  | 
 | 43 | +    package_vars_wrong_format: "{{ package_vars | dict2items | rejectattr('value', 'mapping') | map(attribute='key') | list }}"  | 
44 | 44 |   tags: [memcached, php, sshd]  | 
45 | 45 | 
 
  | 
46 | 46 | - name: Verify dict format for package combined variables  | 
47 | 47 |   fail:  | 
48 | 48 |     msg: "{{ lookup('template', 'package_vars_wrong_format_msg.j2') }}"  | 
49 |  | -  when: package_vars_wrong_format | count  | 
 | 49 | +  when: package_vars_wrong_format | count > 0  | 
50 | 50 |   vars:  | 
51 | 51 |     package_vars:  | 
52 | 52 |       apt_packages: "{{ apt_packages }}"  | 
53 | 53 |       memcached_packages: "{{ memcached_packages }}"  | 
54 | 54 |       php_extensions: "{{ php_extensions }}"  | 
55 | 55 |       sshd_packages: "{{ sshd_packages }}"  | 
56 |  | -    package_vars_wrong_format: "[{% for k,v in package_vars.items() | list if v | type_debug != 'dict' %}'{{ k }}',{% endfor %}]"  | 
 | 56 | +    package_vars_wrong_format: "{{ package_vars | dict2items | rejectattr('value', 'mapping') | map(attribute='key') | list }}"  | 
57 | 57 |   tags: [memcached, php, sshd]  | 
58 | 58 | 
 
  | 
59 | 59 | - name: Validate Ubuntu version  | 
 | 
0 commit comments