Fix linter
parent
55e075ac2b
commit
9f727adcb5
|
@ -2,4 +2,4 @@
|
||||||
*.swp
|
*.swp
|
||||||
*.retry
|
*.retry
|
||||||
*.pyc
|
*.pyc
|
||||||
/tests/HanXHX.php
|
/tests/hanxhx.php
|
||||||
|
|
|
@ -28,7 +28,7 @@ install:
|
||||||
- sudo pip install "ansible-core$ANSIBLE_VERSION"
|
- sudo pip install "ansible-core$ANSIBLE_VERSION"
|
||||||
- sudo pip install ansible-lint
|
- sudo pip install ansible-lint
|
||||||
- ansible-galaxy collection install community.general
|
- ansible-galaxy collection install community.general
|
||||||
- ansible-galaxy install -p ./tests HanXHX.php
|
- ansible-galaxy install -p ./tests hanxhx.php
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- VAGRANT_DEFAULT_PROVIDER=docker vagrant up $PLATFORM
|
- VAGRANT_DEFAULT_PROVIDER=docker vagrant up $PLATFORM
|
||||||
|
|
|
@ -1,46 +1,46 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: reload nginx
|
- name: Reload nginx
|
||||||
ansible.builtin.command: nginx -t
|
ansible.builtin.command: nginx -t
|
||||||
notify:
|
notify:
|
||||||
- real-reload nginx
|
- Real-reload nginx
|
||||||
- docker reload nginx
|
- Docker reload nginx
|
||||||
|
|
||||||
- name: restart nginx
|
- name: Restart nginx
|
||||||
ansible.builtin.command: nginx -t
|
ansible.builtin.command: nginx -t
|
||||||
notify:
|
notify:
|
||||||
- real-restart nginx
|
- Real-restart nginx
|
||||||
- docker restart nginx
|
- Docker restart nginx
|
||||||
|
|
||||||
- name: real-reload nginx
|
- name: Real-reload nginx
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: nginx
|
name: nginx
|
||||||
state: reloaded
|
state: reloaded
|
||||||
when: ansible_virtualization_type != 'docker'
|
when: ansible_virtualization_type != 'docker'
|
||||||
|
|
||||||
- name: real-restart nginx
|
- name: Real-restart nginx
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: nginx
|
name: nginx
|
||||||
state: restarted
|
state: restarted
|
||||||
when: ansible_virtualization_type != 'docker'
|
when: ansible_virtualization_type != 'docker'
|
||||||
|
|
||||||
- name: docker reload nginx
|
- name: Docker reload nginx
|
||||||
ansible.builtin.command: service nginx reload
|
ansible.builtin.command: service nginx reload
|
||||||
args:
|
args:
|
||||||
warn: false
|
warn: false
|
||||||
when: ansible_virtualization_type == 'docker'
|
when: ansible_virtualization_type == 'docker'
|
||||||
|
|
||||||
- name: docker restart nginx
|
- name: Docker restart nginx
|
||||||
ansible.builtin.command: service nginx restart
|
ansible.builtin.command: service nginx restart
|
||||||
args:
|
args:
|
||||||
warn: false
|
warn: false
|
||||||
when: ansible_virtualization_type == 'docker'
|
when: ansible_virtualization_type == 'docker'
|
||||||
|
|
||||||
- name: restart nginx freebsd
|
- name: Restart nginx freebsd
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: nginx
|
name: nginx
|
||||||
state: restarted
|
state: restarted
|
||||||
when: ansible_distribution == "FreeBSD"
|
when: ansible_distribution == "FreeBSD"
|
||||||
|
|
||||||
- name: setup
|
- name: Setup
|
||||||
ansible.builtin.setup:
|
ansible.builtin.setup:
|
||||||
|
|
|
@ -5,9 +5,9 @@ galaxy_info:
|
||||||
namespace: hanxhx
|
namespace: hanxhx
|
||||||
role_name: nginx
|
role_name: nginx
|
||||||
description: Nginx for Debian / FreeBSD
|
description: Nginx for Debian / FreeBSD
|
||||||
company:
|
company: TripleStack
|
||||||
license: GPLv2
|
license: GPLv2
|
||||||
min_ansible_version: 2.11
|
min_ansible_version: '2.11'
|
||||||
platforms:
|
platforms:
|
||||||
- name: Debian
|
- name: Debian
|
||||||
versions:
|
versions:
|
||||||
|
@ -15,9 +15,9 @@ galaxy_info:
|
||||||
- bullseye
|
- bullseye
|
||||||
- name: FreeBSD
|
- name: FreeBSD
|
||||||
versions:
|
versions:
|
||||||
- 11.0
|
- '11.0'
|
||||||
- 11.1
|
- '11.1'
|
||||||
- 12.0
|
- '12.0'
|
||||||
galaxy_tags:
|
galaxy_tags:
|
||||||
- web
|
- web
|
||||||
- debian
|
- debian
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
notify: reload nginx
|
notify: Reload nginx
|
||||||
|
|
||||||
- name: TEMPLATE | Deploy all helpers
|
- name: TEMPLATE | Deploy all helpers
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
with_fileglob: '../templates/etc/nginx/helper/*.j2'
|
with_fileglob: '../templates/etc/nginx/helper/*.j2'
|
||||||
notify: reload nginx
|
notify: Reload nginx
|
||||||
|
|
||||||
- name: TEMPLATE | Deploy custom http configuration
|
- name: TEMPLATE | Deploy custom http configuration
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
notify: reload nginx
|
notify: Reload nginx
|
||||||
|
|
||||||
- name: LINEINFILE | Fix path
|
- name: LINEINFILE | Fix path
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
|
@ -54,4 +54,4 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
notify: reload nginx
|
notify: Reload nginx
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: PKGNG | Install nginx and related tools
|
- name: PKGNG | Install nginx and related tools
|
||||||
pkgng:
|
community.general.pkgng:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
loop:
|
loop:
|
||||||
|
@ -13,7 +13,9 @@
|
||||||
#
|
#
|
||||||
# Bypass https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224166#c1
|
# Bypass https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224166#c1
|
||||||
#
|
#
|
||||||
- block:
|
- name: Bypass https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224166#c1
|
||||||
|
when: true
|
||||||
|
block:
|
||||||
|
|
||||||
- name: COMMAND | Create /usr/local/etc/fdfs/http.conf
|
- name: COMMAND | Create /usr/local/etc/fdfs/http.conf
|
||||||
ansible.builtin.command: touch /usr/local/etc/fdfs/http.conf
|
ansible.builtin.command: touch /usr/local/etc/fdfs/http.conf
|
||||||
|
@ -34,8 +36,6 @@
|
||||||
state: restarted
|
state: restarted
|
||||||
when: fd1.changed or fd2.changed
|
when: fd1.changed or fd2.changed
|
||||||
|
|
||||||
when: true
|
|
||||||
|
|
||||||
- name: FILE | Create configuration dir (like Debian)
|
- name: FILE | Create configuration dir (like Debian)
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ nginx_etc_dir }}/{{ item }}"
|
path: "{{ nginx_etc_dir }}/{{ item }}"
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
path: "{{ nginx_acmesh_dir }}"
|
path: "{{ nginx_acmesh_dir }}"
|
||||||
register: acme
|
register: acme
|
||||||
|
|
||||||
- block:
|
- name: Install acme.sh if needed
|
||||||
|
when: not acme.stat.exists
|
||||||
|
block:
|
||||||
|
|
||||||
- name: APT | Install git
|
- name: APT | Install git
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
|
@ -26,8 +28,7 @@
|
||||||
|
|
||||||
- name: COMMAND | Force acme.sh to use letsencrypt (instead of zerossl)
|
- name: COMMAND | Force acme.sh to use letsencrypt (instead of zerossl)
|
||||||
ansible.builtin.command: '{{ nginx_acmesh_dir }}/acme.sh --set-default-ca --server letsencrypt --home "{{ nginx_acmesh_dir }}"'
|
ansible.builtin.command: '{{ nginx_acmesh_dir }}/acme.sh --set-default-ca --server letsencrypt --home "{{ nginx_acmesh_dir }}"'
|
||||||
|
changed_when: true
|
||||||
when: not acme.stat.exists
|
|
||||||
|
|
||||||
- name: FILE | Remove temp acme.sh dir
|
- name: FILE | Remove temp acme.sh dir
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
notify: ['reload nginx', 'restart nginx freebsd']
|
notify: ['Reload nginx', 'Restart nginx freebsd']
|
||||||
when: (item.state is not defined or item.state != 'absent') and item.custom_template is not defined
|
when: (item.state is not defined or item.state != 'absent') and item.custom_template is not defined
|
||||||
loop: "{{ nginx_sites }}"
|
loop: "{{ nginx_sites }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
notify: ['reload nginx', 'restart nginx freebsd']
|
notify: ['Reload nginx', 'Restart nginx freebsd']
|
||||||
when: (item.state is not defined or item.state != 'absent') and item.custom_template is defined
|
when: (item.state is not defined or item.state != 'absent') and item.custom_template is defined
|
||||||
loop: "{{ nginx_sites }}"
|
loop: "{{ nginx_sites }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
path: "{{ nginx_etc_dir }}/{{ item.1 }}/{{ item.0 | nginx_site_filename }}"
|
path: "{{ nginx_etc_dir }}/{{ item.1 }}/{{ item.0 | nginx_site_filename }}"
|
||||||
state: absent
|
state: absent
|
||||||
loop: "{{ nginx_sites | product(dirs) | list }}"
|
loop: "{{ nginx_sites | product(dirs) | list }}"
|
||||||
notify: ['reload nginx', 'restart nginx freebsd']
|
notify: ['Reload nginx', 'Restart nginx freebsd']
|
||||||
when: item.0.state is defined and item.0.state == 'absent'
|
when: item.0.state is defined and item.0.state == 'absent'
|
||||||
vars:
|
vars:
|
||||||
dirs: ['sites-available', 'sites-enabled']
|
dirs: ['sites-available', 'sites-enabled']
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
dest: "{{ nginx_etc_dir }}/sites-enabled/{{ item | nginx_site_filename }}"
|
dest: "{{ nginx_etc_dir }}/sites-enabled/{{ item | nginx_site_filename }}"
|
||||||
state: link
|
state: link
|
||||||
loop: "{{ nginx_sites }}"
|
loop: "{{ nginx_sites }}"
|
||||||
notify: ['reload nginx', 'restart nginx freebsd']
|
notify: ['Reload nginx', 'Restart nginx freebsd']
|
||||||
when: >
|
when: >
|
||||||
item.state is not defined or item.state == 'present'
|
item.state is not defined or item.state == 'present'
|
||||||
loop_control:
|
loop_control:
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
path: "{{ nginx_etc_dir }}/sites-enabled/{{ item | nginx_site_filename }}"
|
path: "{{ nginx_etc_dir }}/sites-enabled/{{ item | nginx_site_filename }}"
|
||||||
state: absent
|
state: absent
|
||||||
loop: "{{ nginx_sites }}"
|
loop: "{{ nginx_sites }}"
|
||||||
notify: ['reload nginx', 'restart nginx freebsd']
|
notify: ['Reload nginx', 'Restart nginx freebsd']
|
||||||
when: item.state is defined and item.state == 'disabled'
|
when: item.state is defined and item.state == 'disabled'
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item | nginx_site_name }}"
|
label: "{{ item | nginx_site_name }}"
|
||||||
|
@ -106,7 +106,7 @@
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ nginx_etc_dir }}/sites-enabled/default"
|
path: "{{ nginx_etc_dir }}/sites-enabled/default"
|
||||||
state: absent
|
state: absent
|
||||||
notify: ['reload nginx', 'restart nginx freebsd']
|
notify: ['Reload nginx', 'Restart nginx freebsd']
|
||||||
when: nginx_default_site is not none
|
when: nginx_default_site is not none
|
||||||
|
|
||||||
- name: FILE | Auto set default site
|
- name: FILE | Auto set default site
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
src: "{{ nginx_etc_dir }}/sites-available/default"
|
src: "{{ nginx_etc_dir }}/sites-available/default"
|
||||||
dest: "{{ nginx_etc_dir }}/sites-enabled/default"
|
dest: "{{ nginx_etc_dir }}/sites-enabled/default"
|
||||||
state: link
|
state: link
|
||||||
notify: ['reload nginx', 'restart nginx freebsd']
|
notify: ['Reload nginx', 'Restart nginx freebsd']
|
||||||
when: nginx_default_site is none
|
when: nginx_default_site is none
|
||||||
|
|
||||||
- name: TEMPLATE | Deploy facts
|
- name: TEMPLATE | Deploy facts
|
||||||
|
@ -122,4 +122,4 @@
|
||||||
src: etc/ansible/facts.d/nginx.fact.j2
|
src: etc/ansible/facts.d/nginx.fact.j2
|
||||||
dest: /etc/ansible/facts.d/nginx.fact
|
dest: /etc/ansible/facts.d/nginx.fact
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: ['setup']
|
notify: ['Setup']
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
creates: "{{ item | nginx_cert_path(nginx_ssl_dir) }}"
|
creates: "{{ item | nginx_cert_path(nginx_ssl_dir) }}"
|
||||||
loop: "{{ nginx_ssl_pairs }}"
|
loop: "{{ nginx_ssl_pairs }}"
|
||||||
when: item.acme is defined and item.acme
|
when: item.acme is defined and item.acme
|
||||||
notify: restart nginx
|
notify: Restart nginx
|
||||||
|
|
||||||
rescue:
|
rescue:
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
path: "{{ nginx_etc_dir }}/conf.d/FAKESITE_{{ item | nginx_site_name }}.conf"
|
path: "{{ nginx_etc_dir }}/conf.d/FAKESITE_{{ item | nginx_site_name }}.conf"
|
||||||
state: absent
|
state: absent
|
||||||
loop: "{{ acme_create }}"
|
loop: "{{ acme_create }}"
|
||||||
notify: restart nginx
|
notify: Restart nginx
|
||||||
|
|
||||||
- name: META | Flush handlers
|
- name: META | Flush handlers
|
||||||
ansible.builtin.meta: flush_handlers
|
ansible.builtin.meta: flush_handlers
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: IMPORT_TASKS | standard.yml
|
- name: IMPORT_TASKS | standard.yml
|
||||||
import_tasks: standard.yml
|
ansible.builtin.import_tasks: standard.yml
|
||||||
|
|
||||||
- name: IMPORT_TASKS | acme.yml
|
- name: IMPORT_TASKS | acme.yml
|
||||||
import_tasks: acme.yml
|
ansible.builtin.import_tasks: acme.yml
|
||||||
when: nginx_acmesh
|
when: nginx_acmesh
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- block:
|
- name: Generate DH if needed
|
||||||
|
when: nginx_dh is not string
|
||||||
|
block:
|
||||||
|
|
||||||
- name: STAT | Get info about DH file
|
- name: STAT | Get info about DH file
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
|
@ -17,9 +19,7 @@
|
||||||
- name: COMMAND | Generate DH file
|
- name: COMMAND | Generate DH file
|
||||||
ansible.builtin.command: openssl dhparam -out {{ nginx_dh_path }} {{ nginx_dh_length }}
|
ansible.builtin.command: openssl dhparam -out {{ nginx_dh_path }} {{ nginx_dh_length }}
|
||||||
when: not stat_dh_file.stat.exists or (dh_info.stdout | int != nginx_dh_length | int)
|
when: not stat_dh_file.stat.exists or (dh_info.stdout | int != nginx_dh_length | int)
|
||||||
notify: restart nginx
|
notify: Restart nginx
|
||||||
|
|
||||||
when: nginx_dh is not string
|
|
||||||
|
|
||||||
- name: COPY | Deploy DH file from vars
|
- name: COPY | Deploy DH file from vars
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
group: root
|
group: root
|
||||||
mode: 0640
|
mode: 0640
|
||||||
when: nginx_dh is string
|
when: nginx_dh is string
|
||||||
notify: restart nginx
|
notify: Restart nginx
|
||||||
|
|
||||||
- name: FILE | Create SSL directories
|
- name: FILE | Create SSL directories
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
mode: 0640
|
mode: 0640
|
||||||
loop: "{{ nginx_ssl_pairs }}"
|
loop: "{{ nginx_ssl_pairs }}"
|
||||||
when: item.key is defined
|
when: item.key is defined
|
||||||
notify: restart nginx
|
notify: Restart nginx
|
||||||
no_log: "{{ not nginx_debug_role }}"
|
no_log: "{{ not nginx_debug_role }}"
|
||||||
|
|
||||||
- name: COPY | Deploy SSL certs
|
- name: COPY | Deploy SSL certs
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
loop: "{{ nginx_ssl_pairs }}"
|
loop: "{{ nginx_ssl_pairs }}"
|
||||||
when: item.cert is defined
|
when: item.cert is defined
|
||||||
notify: restart nginx
|
notify: Restart nginx
|
||||||
no_log: "{{ not nginx_debug_role }}"
|
no_log: "{{ not nginx_debug_role }}"
|
||||||
|
|
||||||
- name: COMMAND | Create self-signed certificates
|
- name: COMMAND | Create self-signed certificates
|
||||||
|
@ -78,5 +78,5 @@
|
||||||
creates: "{{ '/tmp/dummy' if item.force is defined and item.force else item | nginx_cert_path(nginx_ssl_dir) }}"
|
creates: "{{ '/tmp/dummy' if item.force is defined and item.force else item | nginx_cert_path(nginx_ssl_dir) }}"
|
||||||
loop: "{{ nginx_ssl_pairs }}"
|
loop: "{{ nginx_ssl_pairs }}"
|
||||||
when: item.self_signed is defined
|
when: item.self_signed is defined
|
||||||
notify: restart nginx
|
notify: Restart nginx
|
||||||
no_log: "{{ not nginx_debug_role }}"
|
no_log: "{{ not nginx_debug_role }}"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
notify: reload nginx
|
notify: Reload nginx
|
||||||
|
|
||||||
- name: TEMPLATE | Deploy other upstreams
|
- name: TEMPLATE | Deploy other upstreams
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
group: root
|
group: root
|
||||||
loop: "{{ nginx_upstreams }}"
|
loop: "{{ nginx_upstreams }}"
|
||||||
when: item.state is not defined or item.state == 'present'
|
when: item.state is not defined or item.state == 'present'
|
||||||
notify: reload nginx
|
notify: Reload nginx
|
||||||
|
|
||||||
- name: FILE | Delete other upstreams
|
- name: FILE | Delete other upstreams
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
@ -26,4 +26,4 @@
|
||||||
state: absent
|
state: absent
|
||||||
loop: "{{ nginx_upstreams }}"
|
loop: "{{ nginx_upstreams }}"
|
||||||
when: item.state is defined and item.state == 'absent'
|
when: item.state is defined and item.state == 'absent'
|
||||||
notify: reload nginx
|
notify: Reload nginx
|
||||||
|
|
|
@ -66,9 +66,9 @@
|
||||||
name: foo
|
name: foo
|
||||||
system: true
|
system: true
|
||||||
|
|
||||||
- name: INCLUDE_ROLE | HanXHX.php
|
- name: INCLUDE_ROLE | hanxhx.php
|
||||||
include_role:
|
include_role:
|
||||||
name: "{{ playbook_dir }}/HanXHX.php"
|
name: "{{ playbook_dir }}/hanxhx.php"
|
||||||
vars:
|
vars:
|
||||||
php_version: "{{ cur_php_version.stdout }}"
|
php_version: "{{ cur_php_version.stdout }}"
|
||||||
php_autoremove_default_pool: false
|
php_autoremove_default_pool: false
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- hosts: all
|
- name: Launch tests
|
||||||
|
hosts: all
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: INCLUDE_TASKS | Pre_tasks related to OS version
|
- name: INCLUDE_TASKS | Pre_tasks related to OS version
|
||||||
ansible.builtin.include_tasks: "includes/pre_{{ ansible_distribution }}.yml"
|
ansible.builtin.include_tasks: "includes/pre_{{ ansible_distribution }}.yml"
|
||||||
|
|
Loading…
Reference in New Issue