Update proxy role to comply with linting

This commit is contained in:
Kris Lamoureux 2023-11-03 00:47:06 -04:00
parent ef812c1877
commit 598359854f
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
2 changed files with 15 additions and 15 deletions

View File

@ -1,3 +1,13 @@
- name: Enable nginx sites configuration
ansible.builtin.file:
src: "/etc/nginx/sites-available/{{ item.item.domain }}.conf"
dest: "/etc/nginx/sites-enabled/{{ item.item.domain }}.conf"
state: link
mode: "400"
loop: "{{ nginx_sites.results }}"
when: item.changed
listen: reload_nginx
- name: Reload nginx - name: Reload nginx
ansible.builtin.service: ansible.builtin.service:
name: nginx name: nginx

View File

@ -19,28 +19,18 @@
ansible.builtin.template: ansible.builtin.template:
src: nginx.conf.j2 src: nginx.conf.j2
dest: /etc/nginx/nginx.conf dest: /etc/nginx/nginx.conf
mode: 0644 mode: "644"
notify: reload_nginx notify: reload_nginx
- name: Install nginx sites configuration - name: Install nginx sites configuration
ansible.builtin.template: ansible.builtin.template:
src: server-nginx.conf.j2 src: server-nginx.conf.j2
dest: "/etc/nginx/sites-available/{{ item.domain }}.conf" dest: "/etc/nginx/sites-available/{{ item.domain }}.conf"
mode: 0400 mode: "400"
loop: "{{ proxy.servers }}" loop: "{{ proxy.servers }}"
notify: reload_nginx notify: reload_nginx
register: nginx_sites register: nginx_sites
- name: Enable nginx sites configuration
ansible.builtin.file:
src: "/etc/nginx/sites-available/{{ item.item.domain }}.conf"
dest: "/etc/nginx/sites-enabled/{{ item.item.domain }}.conf"
state: link
mode: 0400
loop: "{{ nginx_sites.results }}"
when: item.changed
notify: reload_nginx
- name: Generate self-signed certificate - name: Generate self-signed certificate
ansible.builtin.command: 'openssl req -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes \ ansible.builtin.command: 'openssl req -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes \
-subj "/C=US/ST=Local/L=Local/O=Org/OU=IT/CN=example.com" \ -subj "/C=US/ST=Local/L=Local/O=Org/OU=IT/CN=example.com" \
@ -61,14 +51,14 @@
ansible.builtin.template: ansible.builtin.template:
src: cloudflare.ini.j2 src: cloudflare.ini.j2
dest: /root/.cloudflare.ini dest: /root/.cloudflare.ini
mode: 0400 mode: "400"
when: proxy.production is defined and proxy.production and proxy.dns_cloudflare is defined when: proxy.production is defined and proxy.production and proxy.dns_cloudflare is defined
- name: Create nginx post renewal hook directory - name: Create nginx post renewal hook directory
ansible.builtin.file: ansible.builtin.file:
path: /etc/letsencrypt/renewal-hooks/post path: /etc/letsencrypt/renewal-hooks/post
state: directory state: directory
mode: 0500 mode: "500"
when: proxy.production is defined and proxy.production when: proxy.production is defined and proxy.production
- name: Install nginx post renewal hook - name: Install nginx post renewal hook