Fix Ansible Lint

This commit is contained in:
Emilien Mantel
2021-09-01 11:58:39 +02:00
parent a2780d3d95
commit 8c6c4dc813
13 changed files with 113 additions and 111 deletions

View File

@@ -4,13 +4,13 @@
pre_tasks:
- name: INCLUDE_TASKS | Pre_tasks related to OS version
include_tasks: "includes/pre_{{ ansible_distribution }}.yml"
ansible.builtin.include_tasks: "includes/pre_{{ ansible_distribution }}.yml"
- name: IMPORT_TASKS | Pre_tasks common
import_tasks: "includes/pre_common.yml"
ansible.builtin.import_tasks: "includes/pre_common.yml"
- name: FILE | Create an internal SSL dir
file:
ansible.builtin.file:
path: "{{ int_ansible_ssl_dir }}"
state: directory
mode: 0750
@@ -18,7 +18,7 @@
group: root
- name: COPY | Deploy test certificate
copy:
ansible.builtin.copy:
src: "file/test.crt"
dest: "{{ int_ansible_ssl_dir }}/test.crt"
mode: 0640
@@ -26,7 +26,7 @@
group: root
- name: COPY | Deploy test key
copy:
ansible.builtin.copy:
src: "file/test.key"
dest: "{{ int_ansible_ssl_dir }}/test.key"
mode: 0640
@@ -34,7 +34,7 @@
group: root
- name: COPY | Add all hosts in /etc/hosts
copy:
ansible.builtin.copy:
content: |
127.0.0.1 localhost
{% for s in nginx_sites %}
@@ -299,13 +299,13 @@
# Apps
# --------------------------------
- name: INCLUDE_TASKS | Post_tasks related to OS version
include_tasks: "includes/post_{{ ansible_distribution }}.yml"
ansible.builtin.include_tasks: "includes/post_{{ ansible_distribution }}.yml"
# --------------------------------
# Deploy index files
# --------------------------------
- name: -- Add PHP file --
copy:
ansible.builtin.copy:
dest: "{{ nginx_root }}/{{ item }}/public/index.php"
content: "<?php phpinfo();"
mode: 0644
@@ -317,7 +317,7 @@
- 'test-php-index2.local'
- name: -- Add HTML file --
copy:
ansible.builtin.copy:
dest: "{{ item }}/index.html"
content: "Index HTML test OK\n"
mode: 0644
@@ -334,7 +334,7 @@
- '{{ nginx_root }}/{{ ngrok.stdout }}/public'
- name: -- Create directory --
file:
ansible.builtin.file:
path: "{{ nginx_root }}/test-htpasswd.local/public/hello"
state: directory
mode: 0755
@@ -342,7 +342,7 @@
group: root
- name: -- Add HTML file hello --
copy:
ansible.builtin.copy:
dest: "{{ nginx_root }}/test-htpasswd.local/public/hello/index.html"
content: "hello\n"
mode: 0644
@@ -353,14 +353,14 @@
# Test custom facts
# --------------------------------
- name: -- CHECK FACTS --
assert:
ansible.builtin.assert:
that: "'{{ ansible_local.nginx.fact_nginx_sites[0].name[0] }}' == 'test.local'"
# --------------------------------
# Simple sites tests
# --------------------------------
- name: -- VERIFY SITES --
uri:
ansible.builtin.uri:
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
@@ -369,12 +369,12 @@
changed_when: false
- name: -- VERIFY FORBIDDEN --
uri:
ansible.builtin.uri:
url: "http://test-php-index.local/phpinfo.php"
status_code: 403
- name: -- VERIFY REDIRECT SITES --
uri:
ansible.builtin.uri:
url: "http://{{ item.redirect_from[0] }}/"
status_code: 301
follow_redirects: none
@@ -383,7 +383,7 @@
changed_when: false
- name: -- VERIFY REDIRECT HTTPS SITES --
uri:
ansible.builtin.uri:
url: "https://{{ item.redirect_from[0] }}:{{ item.listen_ssl[0] | default(443) }}/"
status_code: 301
follow_redirects: none
@@ -396,7 +396,7 @@
# PHP
# --------------------------------
- name: -- VERIFY PHP SITES --
uri:
ansible.builtin.uri:
url: "http://{{ item.name }}/"
return_content: true
register: p
@@ -407,7 +407,7 @@
failed_when: p.content.find('PHP Version') == -1
- name: -- VERIFY INDEX2 --
uri:
ansible.builtin.uri:
url: "http://test-php-index2.local/lorem.php?ipsum=sit&dolor=amet"
return_content: true
register: p2
@@ -417,12 +417,12 @@
# Basic Auth
# --------------------------------
- name: -- VERIFY AUTH BASIC NONE --
uri:
ansible.builtin.uri:
url: "http://test-htpasswd.local/hello/"
status_code: 401
- name: -- VERIFY AUTH BASIC FAIL --
uri:
ansible.builtin.uri:
url: "http://test-htpasswd.local/hello/"
status_code: 401
user: "fail"
@@ -430,14 +430,14 @@
force_basic_auth: true
- name: -- VERIFY AUTH BASIC OK --
uri:
ansible.builtin.uri:
url: "http://test-htpasswd.local/hello/"
user: "hanx"
password: "qwerty"
force_basic_auth: true
- name: -- VERIFY AUTH BASIC FAIL GLOBAL --
uri:
ansible.builtin.uri:
url: "http://test-htpasswd-all.local/"
status_code: 401
user: "fail"
@@ -445,7 +445,7 @@
force_basic_auth: true
- name: -- VERIFY AUTH BASIC OK GLOBAL --
uri:
ansible.builtin.uri:
url: "http://test-htpasswd-all.local/"
user: "hanx"
password: "qwerty"
@@ -455,7 +455,7 @@
# SSL
# --------------------------------
- name: -- VERIFY SSL --
uri:
ansible.builtin.uri:
url: "https://{{ item }}/"
return_content: true
validate_certs: false
@@ -468,7 +468,7 @@
- '{{ ngrok.stdout }}'
- name: -- VERIFY SSL REDIRECT --
uri:
ansible.builtin.uri:
url: "http://{{ item.name }}/"
validate_certs: false
status_code: 301
@@ -487,7 +487,7 @@
# Default sites
# --------------------------------
- name: -- VERIFY DEFAULT SITE --
uri:
ansible.builtin.uri:
url: 'http://127.0.0.1/'
return_content: true
register: vdefault
@@ -496,7 +496,7 @@
vdefault.x_ansible_default is not defined
- name: -- VERIFY DEFAULT SITE + STUB STATUS--
uri:
ansible.builtin.uri:
url: 'http://127.0.0.1/status'
return_content: true
register: vdefault_status
@@ -505,7 +505,7 @@
vdefault_status.x_ansible_default is not defined
- name: -- VERIFY DEFAULT SSL SITE --
uri:
ansible.builtin.uri:
url: 'https://127.0.0.1/'
return_content: true
validate_certs: false
@@ -515,14 +515,14 @@
vdefault.x_ansible_default is not defined
- name: -- VERIFY NOT DEFAULT SITE --
uri:
ansible.builtin.uri:
url: 'http://test-php.local/'
return_content: true
register: vphp
failed_when: vphp.x_ansible_default is defined
- name: -- VERIFY NOT DEFAULT SSL SITE --
uri:
ansible.builtin.uri:
url: 'https://test-ssl.local/'
return_content: true
validate_certs: false
@@ -536,14 +536,14 @@
- block:
- name: SHELL | Check HTTP proxy protocol
shell: set -o pipefail && curl -I --haproxy-protocol http://test-ssl-proxy-protocol.local:20080 | grep -qi 'X-Proxy-Protocol'
ansible.builtin.shell: set -o pipefail && curl -I --haproxy-protocol http://test-ssl-proxy-protocol.local:20080 | grep -qi 'X-Proxy-Protocol'
args:
executable: /bin/bash
warn: false
changed_when: false
- name: SHELL | Check HTTPS proxy protocol
shell: set -o pipefail && curl -I --haproxy-protocol -k https://test-ssl-proxy-protocol.local:20443 | grep -qi 'X-Proxy-Protocol'
ansible.builtin.shell: set -o pipefail && curl -I --haproxy-protocol -k https://test-ssl-proxy-protocol.local:20443 | grep -qi 'X-Proxy-Protocol'
args:
executable: /bin/bash
warn: false
@@ -555,7 +555,7 @@
# Check HTTP2
# --------------------------------
- name: SHELL | Check HTTP2
shell: set -o pipefail && nghttp -nv https://localhost 2> /dev/null | grep -q h2
ansible.builtin.shell: set -o pipefail && nghttp -nv https://localhost 2> /dev/null | grep -q h2
args:
executable: /bin/bash
changed_when: false