Fix deprecations on Ansible 2.7

- with_ -> loop
- fix filters as test
- test version_compare -> version
- set min_version to 2.5
This commit is contained in:
Emilien Mantel
2019-01-22 22:08:14 +01:00
parent d168219c29
commit 682339d818
17 changed files with 63 additions and 77 deletions

View File

@@ -2,11 +2,12 @@
- name: APT | Install webapps
apt:
pkg: "{{ item }}"
pkg: "{{ packages }}"
state: present
install_recommends: no
with_items:
- backuppc
vars:
packages:
- backuppc
- name: SERVICE | Ensure backuppc is started
service:

View File

@@ -45,19 +45,20 @@
- name: APT | Install needed packages
apt:
pkg: "{{ item }}"
pkg: "{{ packages }}"
update_cache: yes
cache_valid_time: 3600
state: present
with_items:
- cron
- curl
- fcgiwrap
- jq
- nghttp2
- strace
- vim
- unzip
vars:
packages:
- cron
- curl
- fcgiwrap
- jq
- nghttp2
- strace
- vim
- unzip
- name: APT | Install daemonize from Stretch
apt:
@@ -69,7 +70,7 @@
update_cache: yes
cache_valid_time: 3600
state: present
with_items: "{{ nginx_php }}"
loop: "{{ nginx_php }}"
register: apt_php
- name: SERVICE | Force start fcgiwrap
@@ -77,10 +78,11 @@
name: "fcgiwrap"
state: started
# Bypasses Ansible 2.4 issue (cannot use service module)... With service module... php is not really started!
- name: COMMAND | Force start PHP
command: "service {{ item.version | php_fpm_service }} start"
with_items: "{{ nginx_php }}"
service:
name: "{{ item.version | php_fpm_service }}"
state: started
loop: "{{ nginx_php }}"
when: apt_php.changed
- name: GET_URL | Download ngrok

View File

@@ -15,17 +15,18 @@
- name: PKGNG | Install needed packages
pkgng:
pkg: "{{ item }}"
pkg: "{{ packages }}"
state: present
with_items:
- curl
- daemonize
- fcgiwrap
- GeoIP
- jq
- nghttp2
- php72
- vim
vars:
packages:
- curl
- daemonize
- fcgiwrap
- GeoIP
- jq
- nghttp2
- php72
- vim
- name: COMMAND | Get geoip database
command: geoipupdate.sh
@@ -38,7 +39,7 @@
state: started
enabled: yes
register: sf
with_items:
loop:
- php-fpm
- fcgiwrap

View File

@@ -14,6 +14,8 @@
- name: SHELL | Get ngrok public address
shell: curl 'http://127.0.0.1:4040/api/tunnels/command_line' | jq '.public_url' | grep -oE '[[:alnum:]]+\.ngrok\.io'
args:
warn: false
register: ngrok
changed_when: false
@@ -22,6 +24,6 @@
line: "set mouse="
dest: "{{ item }}/.vimrc"
create: yes
with_items:
loop:
- /root
- /home/vagrant

View File

@@ -276,7 +276,7 @@
copy:
dest: "{{ nginx_root }}/{{ item }}/public/index.php"
content: "<?php phpinfo();"
with_items:
loop:
- 'test-php.local'
- 'test-php-index.local'
- 'test-php-index2.local'
@@ -285,7 +285,7 @@
copy:
dest: "{{ item }}/index.html"
content: "Index HTML test OK\n"
with_items:
loop:
- '{{ nginx_root }}/first-test/public'
- '/var/tmp'
- '{{ nginx_root }}/test-htpasswd-all.local/public'
@@ -319,7 +319,7 @@
url: "http://{{ item | nginx_site_name }}{% if item.listen is defined %}:{{ item.listen[0] }}{% endif %}/"
status_code: '200,301,302,401,403'
follow_redirects: none
with_items: "{{ nginx_sites }}"
loop: "{{ nginx_sites }}"
when: item.state is undefined or item.state != "absent"
changed_when: false
@@ -333,7 +333,7 @@
url: "http://{{ item.redirect_from[0] }}/"
status_code: 301
follow_redirects: none
with_items: "{{ nginx_sites }}"
loop: "{{ nginx_sites }}"
when: item.redirect_from is defined and (item.state is undefined or item.state != "absent") and (item.proto is not defined or 'https' not in item.proto)
changed_when: false
@@ -343,7 +343,7 @@
status_code: 301
follow_redirects: none
validate_certs: no
with_items: "{{ nginx_sites }}"
loop: "{{ nginx_sites }}"
when: item.redirect_from is defined and (item.state is undefined or item.state != "absent") and item.proto is defined and 'https' in item.proto
changed_when: false
@@ -355,7 +355,7 @@
url: "http://{{ item.name}}/"
return_content: yes
register: p
with_items: "{{ nginx_sites }}"
loop: "{{ nginx_sites }}"
when: >
item.template is defined and
(item.template == '_php' or item.template == '_php_index' or item.template == '_php_index2')
@@ -430,7 +430,7 @@
validate_certs: no
register: sslok
failed_when: sslok.content.find('Index HTML test OK') == -1
with_items:
loop:
- 'test-ssl-predeployed.local'
- 'test-ssl-selfsigned.local'
- 'test-ssl.local'
@@ -445,7 +445,7 @@
follow_redirects: none
register: sslredirok
failed_when: '"https://%s%s" % (item.name, ":" + item.port if item.port is defined else "") not in sslredirok.location'
with_items:
loop:
- name: 'test-ssl-redirect.local'
- name: 'test-ssl-redirect-many.local'
port: '8443'