mirror of
https://github.com/HanXHX/ansible-nginx.git
synced 2026-04-15 13:12:10 +07:00
Fix linter
This commit is contained in:
@@ -7,17 +7,17 @@
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
notify: reload nginx
|
||||
notify: Reload nginx
|
||||
|
||||
- name: TEMPLATE | Deploy all helpers
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ nginx_helper_dir }}/{{ item | basename | regex_replace('.j2$','') }}"
|
||||
dest: "{{ nginx_helper_dir }}/{{ item | basename | regex_replace('.j2$', '') }}"
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
with_fileglob: '../templates/etc/nginx/helper/*.j2'
|
||||
notify: reload nginx
|
||||
notify: Reload nginx
|
||||
|
||||
- name: TEMPLATE | Deploy custom http configuration
|
||||
ansible.builtin.template:
|
||||
@@ -26,7 +26,7 @@
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
notify: reload nginx
|
||||
notify: Reload nginx
|
||||
|
||||
- name: LINEINFILE | Fix path
|
||||
ansible.builtin.lineinfile:
|
||||
@@ -54,4 +54,4 @@
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
notify: reload nginx
|
||||
notify: Reload nginx
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: PKGNG | Install nginx and related tools
|
||||
pkgng:
|
||||
community.general.pkgng:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop:
|
||||
@@ -13,7 +13,9 @@
|
||||
#
|
||||
# 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
|
||||
ansible.builtin.command: touch /usr/local/etc/fdfs/http.conf
|
||||
@@ -34,8 +36,6 @@
|
||||
state: restarted
|
||||
when: fd1.changed or fd2.changed
|
||||
|
||||
when: true
|
||||
|
||||
- name: FILE | Create configuration dir (like Debian)
|
||||
ansible.builtin.file:
|
||||
path: "{{ nginx_etc_dir }}/{{ item }}"
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
path: "{{ nginx_acmesh_dir }}"
|
||||
register: acme
|
||||
|
||||
- block:
|
||||
- name: Install acme.sh if needed
|
||||
when: not acme.stat.exists
|
||||
block:
|
||||
|
||||
- name: APT | Install git
|
||||
ansible.builtin.apt:
|
||||
@@ -26,8 +28,7 @@
|
||||
|
||||
- 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 }}"'
|
||||
|
||||
when: not acme.stat.exists
|
||||
changed_when: true
|
||||
|
||||
- name: FILE | Remove temp acme.sh dir
|
||||
ansible.builtin.file:
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
mode: 0644
|
||||
owner: 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
|
||||
loop: "{{ nginx_sites }}"
|
||||
loop_control:
|
||||
@@ -62,7 +62,7 @@
|
||||
mode: 0644
|
||||
owner: 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
|
||||
loop: "{{ nginx_sites }}"
|
||||
loop_control:
|
||||
@@ -73,7 +73,7 @@
|
||||
path: "{{ nginx_etc_dir }}/{{ item.1 }}/{{ item.0 | nginx_site_filename }}"
|
||||
state: absent
|
||||
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'
|
||||
vars:
|
||||
dirs: ['sites-available', 'sites-enabled']
|
||||
@@ -86,7 +86,7 @@
|
||||
dest: "{{ nginx_etc_dir }}/sites-enabled/{{ item | nginx_site_filename }}"
|
||||
state: link
|
||||
loop: "{{ nginx_sites }}"
|
||||
notify: ['reload nginx', 'restart nginx freebsd']
|
||||
notify: ['Reload nginx', 'Restart nginx freebsd']
|
||||
when: >
|
||||
item.state is not defined or item.state == 'present'
|
||||
loop_control:
|
||||
@@ -97,7 +97,7 @@
|
||||
path: "{{ nginx_etc_dir }}/sites-enabled/{{ item | nginx_site_filename }}"
|
||||
state: absent
|
||||
loop: "{{ nginx_sites }}"
|
||||
notify: ['reload nginx', 'restart nginx freebsd']
|
||||
notify: ['Reload nginx', 'Restart nginx freebsd']
|
||||
when: item.state is defined and item.state == 'disabled'
|
||||
loop_control:
|
||||
label: "{{ item | nginx_site_name }}"
|
||||
@@ -106,7 +106,7 @@
|
||||
ansible.builtin.file:
|
||||
path: "{{ nginx_etc_dir }}/sites-enabled/default"
|
||||
state: absent
|
||||
notify: ['reload nginx', 'restart nginx freebsd']
|
||||
notify: ['Reload nginx', 'Restart nginx freebsd']
|
||||
when: nginx_default_site is not none
|
||||
|
||||
- name: FILE | Auto set default site
|
||||
@@ -114,7 +114,7 @@
|
||||
src: "{{ nginx_etc_dir }}/sites-available/default"
|
||||
dest: "{{ nginx_etc_dir }}/sites-enabled/default"
|
||||
state: link
|
||||
notify: ['reload nginx', 'restart nginx freebsd']
|
||||
notify: ['Reload nginx', 'Restart nginx freebsd']
|
||||
when: nginx_default_site is none
|
||||
|
||||
- name: TEMPLATE | Deploy facts
|
||||
@@ -122,4 +122,4 @@
|
||||
src: etc/ansible/facts.d/nginx.fact.j2
|
||||
dest: /etc/ansible/facts.d/nginx.fact
|
||||
mode: 0644
|
||||
notify: ['setup']
|
||||
notify: ['Setup']
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
- name: SET_FACT | Assign var with certificates to create
|
||||
ansible.builtin.set_fact:
|
||||
acme_create: "{{ acme_create | default([]) + [ (item.item) ] }}"
|
||||
acme_create: "{{ acme_create | default([]) + [(item.item)] }}"
|
||||
loop: "{{ acme_installed_certs.results }}"
|
||||
when: item.skipped is not defined and (not item.stat.exists or item.stat.size == 0)
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
creates: "{{ item | nginx_cert_path(nginx_ssl_dir) }}"
|
||||
loop: "{{ nginx_ssl_pairs }}"
|
||||
when: item.acme is defined and item.acme
|
||||
notify: restart nginx
|
||||
notify: Restart nginx
|
||||
|
||||
rescue:
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
path: "{{ nginx_etc_dir }}/conf.d/FAKESITE_{{ item | nginx_site_name }}.conf"
|
||||
state: absent
|
||||
loop: "{{ acme_create }}"
|
||||
notify: restart nginx
|
||||
notify: Restart nginx
|
||||
|
||||
- name: META | Flush handlers
|
||||
ansible.builtin.meta: flush_handlers
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
|
||||
- name: IMPORT_TASKS | standard.yml
|
||||
import_tasks: standard.yml
|
||||
ansible.builtin.import_tasks: standard.yml
|
||||
|
||||
- name: IMPORT_TASKS | acme.yml
|
||||
import_tasks: acme.yml
|
||||
ansible.builtin.import_tasks: acme.yml
|
||||
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
|
||||
ansible.builtin.stat:
|
||||
@@ -17,9 +19,7 @@
|
||||
- name: COMMAND | Generate DH file
|
||||
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)
|
||||
notify: restart nginx
|
||||
|
||||
when: nginx_dh is not string
|
||||
notify: Restart nginx
|
||||
|
||||
- name: COPY | Deploy DH file from vars
|
||||
ansible.builtin.copy:
|
||||
@@ -29,7 +29,7 @@
|
||||
group: root
|
||||
mode: 0640
|
||||
when: nginx_dh is string
|
||||
notify: restart nginx
|
||||
notify: Restart nginx
|
||||
|
||||
- name: FILE | Create SSL directories
|
||||
ansible.builtin.file:
|
||||
@@ -51,7 +51,7 @@
|
||||
mode: 0640
|
||||
loop: "{{ nginx_ssl_pairs }}"
|
||||
when: item.key is defined
|
||||
notify: restart nginx
|
||||
notify: Restart nginx
|
||||
no_log: "{{ not nginx_debug_role }}"
|
||||
|
||||
- name: COPY | Deploy SSL certs
|
||||
@@ -63,7 +63,7 @@
|
||||
mode: 0644
|
||||
loop: "{{ nginx_ssl_pairs }}"
|
||||
when: item.cert is defined
|
||||
notify: restart nginx
|
||||
notify: Restart nginx
|
||||
no_log: "{{ not nginx_debug_role }}"
|
||||
|
||||
- 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) }}"
|
||||
loop: "{{ nginx_ssl_pairs }}"
|
||||
when: item.self_signed is defined
|
||||
notify: restart nginx
|
||||
notify: Restart nginx
|
||||
no_log: "{{ not nginx_debug_role }}"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
notify: reload nginx
|
||||
notify: Reload nginx
|
||||
|
||||
- name: TEMPLATE | Deploy other upstreams
|
||||
ansible.builtin.template:
|
||||
@@ -18,7 +18,7 @@
|
||||
group: root
|
||||
loop: "{{ nginx_upstreams }}"
|
||||
when: item.state is not defined or item.state == 'present'
|
||||
notify: reload nginx
|
||||
notify: Reload nginx
|
||||
|
||||
- name: FILE | Delete other upstreams
|
||||
ansible.builtin.file:
|
||||
@@ -26,4 +26,4 @@
|
||||
state: absent
|
||||
loop: "{{ nginx_upstreams }}"
|
||||
when: item.state is defined and item.state == 'absent'
|
||||
notify: reload nginx
|
||||
notify: Reload nginx
|
||||
|
||||
Reference in New Issue
Block a user