Skip to content

Commit d31b64b

Browse files
committed
Ansible 2.19 support
1 parent aa1905c commit d31b64b

File tree

15 files changed

+37
-21
lines changed

15 files changed

+37
-21
lines changed

dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
- { role: mailpit, tags: [mailpit, mailhog, mail] }
1616
- { role: php, tags: [php] }
1717
- { role: xdebug, tags: [php, xdebug] }
18-
- { role: memcached, tags: [memcached], when: sites_using_memcached | count }
19-
- { role: redis, tags: [redis], when: sites_using_redis | count }
18+
- { role: memcached, tags: [memcached], when: sites_using_memcached | count > 0 }
19+
- { role: redis, tags: [redis], when: sites_using_redis | count > 0 }
2020
- { role: nginx, tags: [nginx] }
2121
- { role: logrotate, tags: [logrotate] }
2222
- { role: composer, tags: [composer] }

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
ansible>=2.10.0
2-
ansible-core<2.19.0

roles/common/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ apt_packages_default:
1212
libnss-myhostname: "{{ apt_package_state }}"
1313
python3: "{{ apt_package_state }}"
1414
python3-software-properties: "{{ apt_package_state }}"
15-
python3-mysqldb: "{{ apt_package_state }}"
15+
python3-pymysql: "{{ apt_package_state }}"
1616
python3-pycurl: "{{ apt_package_state }}"
1717
unzip: "{{ apt_package_state }}"
1818

roles/common/tasks/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- name: Validate wordpress_sites
33
fail:
44
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
66
tags: [wordpress]
77

88
- name: Validate format of site_hosts
@@ -11,7 +11,7 @@
1111
loop: "{{ wordpress_sites | dict2items }}"
1212
loop_control:
1313
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
1515
tags: [letsencrypt, wordpress]
1616

1717
- name: Import PHP version specific vars
@@ -29,7 +29,7 @@
2929
- name: Verify dict format for package component variables
3030
fail:
3131
msg: "{{ lookup('template', 'package_vars_wrong_format_msg.j2') }}"
32-
when: package_vars_wrong_format | count
32+
when: package_vars_wrong_format | count > 0
3333
vars:
3434
package_vars:
3535
apt_packages_default: "{{ apt_packages_default }}"
@@ -40,20 +40,20 @@
4040
php_extensions_custom: "{{ php_extensions_custom }}"
4141
sshd_packages_default: "{{ sshd_packages_default }}"
4242
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 }}"
4444
tags: [memcached, php, sshd]
4545

4646
- name: Verify dict format for package combined variables
4747
fail:
4848
msg: "{{ lookup('template', 'package_vars_wrong_format_msg.j2') }}"
49-
when: package_vars_wrong_format | count
49+
when: package_vars_wrong_format | count > 0
5050
vars:
5151
package_vars:
5252
apt_packages: "{{ apt_packages }}"
5353
memcached_packages: "{{ memcached_packages }}"
5454
php_extensions: "{{ php_extensions }}"
5555
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 }}"
5757
tags: [memcached, php, sshd]
5858

5959
- name: Validate Ubuntu version

roles/letsencrypt/tasks/nginx.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
src: acme-challenge-location.conf.j2
55
dest: "{{ nginx_path }}/acme-challenge-location.conf"
66
mode: '0644'
7+
become: yes
78

89
- name: Get list of hosts in current Nginx conf
910
shell: |
@@ -24,10 +25,11 @@
2425
register: challenge_site_confs
2526
when:
2627
- site_uses_letsencrypt
27-
- missing_hosts | count
28+
- missing_hosts | count > 0
2829
loop: "{{ wordpress_sites | dict2items }}"
2930
loop_control:
3031
label: "{{ item.key }}"
32+
become: yes
3133

3234
- name: Enable Nginx sites
3335
file:
@@ -37,10 +39,11 @@
3739
register: challenge_sites_enabled
3840
when:
3941
- site_uses_letsencrypt
40-
- missing_hosts | count
42+
- missing_hosts | count > 0
4143
loop: "{{ wordpress_sites | dict2items }}"
4244
loop_control:
4345
label: "{{ item.key }}"
46+
become: yes
4447
notify: disable temporary challenge sites
4548

4649
- import_tasks: "{{ playbook_dir }}/roles/common/tasks/reload_nginx.yml"

roles/mariadb/tasks/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@
5757
host: "{{ item }}"
5858
password: "{{ mysql_root_password }}"
5959
check_implicit_admin: yes
60+
column_case_sensitive: no
6061
state: present
62+
login_unix_socket: /var/run/mysqld/mysqld.sock
6163
no_log: true
6264
loop:
6365
- "{{ inventory_hostname }}"
@@ -67,9 +69,10 @@
6769

6870
- name: Delete anonymous MySQL server users
6971
mysql_user:
70-
user: ""
72+
name: ""
7173
host: "{{ item }}"
7274
state: absent
75+
column_case_sensitive: no
7376
no_log: true
7477
loop:
7578
- localhost

roles/nginx/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
path: "{{ nginx_path }}/{{ item }}"
2525
state: directory
2626
mode: '0755'
27+
owner: root
28+
group: root
2729
loop:
2830
- sites-available
2931
- sites-enabled

roles/sshd/templates/ssh_config.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Host *
1717
KexAlgorithms {{ (ssh_kex_algorithms_default | default(sshd_kex_algorithms_default) + ssh_kex_algorithms_extra | default(sshd_kex_algorithms_extra)) | join(',') }}
1818
MACs {{ (ssh_macs_default | default(sshd_macs_default) + ssh_macs_extra | default(sshd_macs_extra)) | join(',') }}
1919
PasswordAuthentication {{ ssh_password_authentication | default(sshd_password_authentication) | ternary('yes', 'no') }}
20-
{% if ssh_send_env | count %}
20+
{% if ssh_send_env | count > 0 %}
2121
SendEnv {{ ssh_send_env | join(' ') }}
2222
{% endif -%}
2323
StrictHostKeyChecking {{ ssh_strict_host_key_checking }}

roles/sshd/templates/sshd_config.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ListenAddress {{ address }}
1313

1414
Protocol {{ sshd_protocol }}
1515

16-
{% if sshd_accept_env | count %}
16+
{% if sshd_accept_env | count > 0 %}
1717
AcceptEnv {{ sshd_accept_env | join(' ') }}
1818
{% endif -%}
1919
AllowAgentForwarding {{ sshd_allow_agent_forwarding | ternary('yes', 'no') }}

roles/wordpress-install/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
args:
6666
chdir: "{{ www_root }}/{{ item.item.key }}/{{ item.item.value.current_path | default('current') }}/"
6767
loop: "{{ wp_install.results }}"
68+
loop_control:
69+
label: "{{ item.item.key }}"
6870
when: item is changed
6971

7072
- name: Update WP Multisite Home URL

0 commit comments

Comments
 (0)