|
2 | 2 | - name: Install nginx package |
3 | 3 | tags: [install] |
4 | 4 | ansible.builtin.apt: |
5 | | - name: nginx |
6 | | - state: present |
| 5 | + name: nginx |
| 6 | + state: present |
7 | 7 |
|
8 | 8 | - name: Remove default config |
9 | 9 | ansible.builtin.file: |
10 | | - path: '{{ item }}' |
11 | | - state: absent |
12 | | - with_items: ['/etc/nginx/sites-enabled/default', '/etc/nginx/conf.d'] |
| 10 | + path: "/etc/nginx/sites-enabled/" |
| 11 | + state: absent |
13 | 12 | notify: Restart nginx |
14 | 13 |
|
15 | 14 | - name: Add NGINX configuration file |
16 | 15 | ansible.builtin.template: |
17 | | - dest: /etc/nginx/sites-enabled/novnc.conf |
18 | | - src: nginx_novnc.conf.j2 |
19 | | - mode: '0644' |
| 16 | + dest: /etc/nginx/conf.d/novnc.conf |
| 17 | + src: nginx_novnc.conf.j2 |
| 18 | + mode: "0644" |
20 | 19 | notify: Restart nginx |
21 | 20 |
|
22 | 21 | - name: Ensure the htpasswd utility is installed |
23 | 22 | ansible.builtin.apt: |
24 | | - name: ['apache2-utils', 'python3-passlib'] |
25 | | - state: present |
| 23 | + name: ["apache2-utils", "python3-passlib"] |
| 24 | + state: present |
26 | 25 | when: novnc_htpasswd_credentials |
27 | 26 |
|
28 | 27 | - name: Ensure htpasswd credentials are configured |
29 | 28 | community.general.htpasswd: |
30 | | - path: '/etc/nginx/passwdfile' |
31 | | - name: '{{ item.name }}' |
32 | | - password: '{{ item.password }}' |
33 | | - owner: 'root' |
34 | | - group: 'www-data' |
35 | | - mode: '0640' |
36 | | - with_items: '{{ novnc_htpasswd_credentials }}' |
| 29 | + path: "/etc/nginx/passwdfile" |
| 30 | + name: "{{ item.name }}" |
| 31 | + password: "{{ item.password }}" |
| 32 | + owner: "root" |
| 33 | + group: "www-data" |
| 34 | + mode: "0640" |
| 35 | + with_items: "{{ novnc_htpasswd_credentials }}" |
37 | 36 | no_log: true |
38 | 37 |
|
39 | 38 | - name: Per User htpasswd |
40 | 39 | community.general.htpasswd: |
41 | | - path: '/etc/nginx/passwd-{{ item.name }}' |
42 | | - name: '{{ item.name }}' |
43 | | - password: '{{ item.password }}' |
44 | | - owner: 'root' |
45 | | - group: 'www-data' |
46 | | - mode: '0640' |
47 | | - with_items: '{{ novnc_htpasswd_credentials }}' |
| 40 | + path: "/etc/nginx/passwd-{{ item.name }}" |
| 41 | + name: "{{ item.name }}" |
| 42 | + password: "{{ item.password }}" |
| 43 | + owner: "root" |
| 44 | + group: "www-data" |
| 45 | + mode: "0640" |
| 46 | + with_items: "{{ novnc_htpasswd_credentials }}" |
48 | 47 | no_log: true |
0 commit comments