mirror of
https://github.com/HanXHX/ansible-nginx.git
synced 2026-04-07 12:32:09 +07:00
Fix deprecations (#35)
* Drop Nagios support * Fix start PHP-FPM on Docker * 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:
@@ -60,11 +60,6 @@
|
||||
state: 'absent'
|
||||
- name: 'hanx'
|
||||
password: 'qwerty'
|
||||
- name: 'nagios'
|
||||
description: 'Please login to Nagios!'
|
||||
users:
|
||||
- name: 'nagiosadmin'
|
||||
password: 'nagios'
|
||||
- name: 'deleteme'
|
||||
description: 'Please login!'
|
||||
users: []
|
||||
@@ -221,9 +216,6 @@
|
||||
- name: 'backuppc.local'
|
||||
template: '_backuppc'
|
||||
htpasswd: 'hello'
|
||||
- name: 'nagios3.local'
|
||||
template: '_nagios3'
|
||||
htpasswd: 'nagios'
|
||||
- name: 'test-ssl.local'
|
||||
proto: ['http', 'https']
|
||||
template: '_base'
|
||||
@@ -284,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'
|
||||
@@ -293,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'
|
||||
@@ -327,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
|
||||
|
||||
@@ -341,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
|
||||
|
||||
@@ -351,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
|
||||
|
||||
@@ -363,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')
|
||||
@@ -428,33 +420,6 @@
|
||||
when: ansible_distribution != 'FreeBSD'
|
||||
failed_when: authbpc.content.find('BackupPC Server Status') == -1
|
||||
|
||||
# --------------------------------
|
||||
# Nagios (not avaiblable on Debian >= 9 and not tested on FreeBSD)
|
||||
# --------------------------------
|
||||
- block:
|
||||
|
||||
- name: -- VERIFY NAGIOS3 PHP --
|
||||
uri:
|
||||
url: "http://nagios3.local/side.php"
|
||||
user: "nagiosadmin"
|
||||
password: "nagios"
|
||||
force_basic_auth: yes
|
||||
return_content: yes
|
||||
register: nagios_php
|
||||
failed_when: nagios_php.content.find('Nagios Core') == -1
|
||||
|
||||
- name: -- VERIFY NAGIOS3 CGI --
|
||||
uri:
|
||||
url: "http://nagios3.local/cgi-bin{% if ansible_distribution == 'Debian' %}/nagios3{% endif %}/summary.cgi"
|
||||
user: "nagiosadmin"
|
||||
password: "nagios"
|
||||
force_basic_auth: yes
|
||||
return_content: yes
|
||||
register: nagios_cgi
|
||||
failed_when: nagios_cgi.content.find('Nagios Event Summary') == -1
|
||||
|
||||
when: ansible_distribution == 'Debian' and ansible_distribution_major_version | version_compare('9', 'lt')
|
||||
|
||||
# --------------------------------
|
||||
# SSL
|
||||
# --------------------------------
|
||||
@@ -465,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'
|
||||
@@ -480,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'
|
||||
|
||||
Reference in New Issue
Block a user