Skip to content

Commit 9a4f2fc

Browse files
author
Lenhard Reuter
committed
Use nginx conf.d
1 parent f82deae commit 9a4f2fc

File tree

3 files changed

+41
-42
lines changed

3 files changed

+41
-42
lines changed

tasks/fabric.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
---
22
- name: Create fabric directory
33
ansible.builtin.file:
4-
path: '{{ fabric_wwwroot }}'
5-
state: directory
6-
mode: '0755'
4+
path: "{{ fabric_wwwroot }}"
5+
state: directory
6+
mode: "0755"
77

88
- name: Copy css and js for fabric html
99
ansible.builtin.copy:
10-
dest: '{{ fabric_wwwroot }}/'
11-
src: 'fabricweb/'
12-
mode: '0644'
10+
dest: "{{ fabric_wwwroot }}/"
11+
src: "fabricweb/"
12+
mode: "0644"
1313
when: fabric_copypaste_bar
1414

1515
- name: Deploy novnc HTML
1616
ansible.builtin.template:
17-
dest: '{{ fabric_wwwroot }}/index.html'
18-
src: '{{ fabric_index_template }}'
19-
mode: '0644'
17+
dest: "{{ fabric_wwwroot }}/index.html"
18+
src: "{{ fabric_index_template }}"
19+
mode: "0644"
2020

2121
- name: Download fabric
2222
ansible.builtin.get_url:
23-
url: '{{ fabric_release_url }}/{{ fabric_version }}/main.js'
24-
dest: '{{ fabric_wwwroot }}/main.js'
25-
mode: '0644'
23+
url: "{{ fabric_release_url }}/{{ fabric_version }}/main.js"
24+
dest: "{{ fabric_wwwroot }}/main.js"
25+
mode: "0644"

tasks/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
- name: Configure and install nginx
33
tags: [nginx]
44
ansible.builtin.include_tasks:
5-
file: nginx.yml
6-
apply:
7-
become: true
5+
file: nginx.yml
6+
apply:
7+
become: true
88

99
- name: Configure and install fabric
1010
tags: [fabric]
1111
ansible.builtin.include_tasks:
12-
file: fabric.yml
13-
apply:
14-
become: true
12+
file: fabric.yml
13+
apply:
14+
become: true

tasks/nginx.yml

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,46 @@
22
- name: Install nginx package
33
tags: [install]
44
ansible.builtin.apt:
5-
name: nginx
6-
state: present
5+
name: nginx
6+
state: present
77

88
- name: Remove default config
99
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
1312
notify: Restart nginx
1413

1514
- name: Add NGINX configuration file
1615
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"
2019
notify: Restart nginx
2120

2221
- name: Ensure the htpasswd utility is installed
2322
ansible.builtin.apt:
24-
name: ['apache2-utils', 'python3-passlib']
25-
state: present
23+
name: ["apache2-utils", "python3-passlib"]
24+
state: present
2625
when: novnc_htpasswd_credentials
2726

2827
- name: Ensure htpasswd credentials are configured
2928
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 }}"
3736
no_log: true
3837

3938
- name: Per User htpasswd
4039
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 }}"
4847
no_log: true

0 commit comments

Comments
 (0)