Skip to content

Commit 28f287c

Browse files
committed
Fix bug default template is deployed twice. This will break smartos and redhat default template (not a big deal)
1 parent a6d39d4 commit 28f287c

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

defaults/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
nginx_etc : "/etc/nginx/"
3+
nginx_default_root : "/usr/share/nginx/html" # Will only work for ubuntu
34
nginx_max_clients : 512
45
nginx_install_repo : "ubuntu" # Options: ["nginx", "ubuntu"]
56
nginx_apt_state : "present" # Options: ["latest", "present"]
@@ -13,19 +14,18 @@ nginx_http_params:
1314
error_log: "/var/log/nginx/error.log"
1415

1516
nginx_site :
16-
- file_name : "default"
17+
- file_name : "test"
1718
blocks :
1819
- type : "server"
19-
root : "/usr/share/nginx/www"
2020
index : "index.html index.htm"
2121
server_name : localhost
2222
listen : 80
2323
## Use josn
24-
location1 : {
25-
name: /,
24+
location1 : {
25+
name: /,
2626
type: location,
2727
try_files: "$uri $uri/ /index.html",
28-
root: /usr/share/nginx/www
28+
root: "{{ nginx_default_root }}"
2929
}
3030
## Use yaml
3131
location2 :
@@ -35,4 +35,4 @@ nginx_site :
3535
autoindex : "on"
3636
allow : "127.0.0.1"
3737
deny : "all"
38-
38+

tasks/common.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
- name: common | Create the directories for site specific configurations
44
file:
55
path="{{nginx_etc}}/{{item}}"
6-
state=directory
7-
owner=root
8-
group=root
6+
state=directory
7+
owner=root
8+
group=root
99
mode=0755
1010
with_items:
1111
- "sites-available"
@@ -14,7 +14,7 @@
1414
- name: common | Copy the nginx default configuration file
1515
template:
1616
src=default.j2
17-
dest="{{nginx_etc}}/sites-available/default.conf"
17+
dest="{{ nginx_etc }}/sites-available/default.conf"
1818

1919
- name: common |Copy the nginx default site configuration file
2020
template:
@@ -24,12 +24,12 @@
2424
- name: common | Create the link for site enabled specific configurations
2525
file:
2626
path="{{nginx_etc}}/sites-enabled/default"
27-
state=link
27+
state=link
2828
src="{{nginx_etc}}/sites-available/default"
2929

3030
- name: common | Create the configuration files for nginx
31-
template:
32-
src=site.j2
31+
template:
32+
src=site.j2
3333
dest="{{nginx_etc}}/sites-available/{{item.file_name}}.conf"
3434
with_items: nginx_site
3535
when: nginx_site |lower != 'none'
@@ -39,9 +39,9 @@
3939
## TODO: Add conidition to disable/enable sites
4040
- name: Create the link for site enabled specific configurations
4141
file:
42-
path="{{nginx_etc}}/sites-enabled/{{item.file_name}}.conf"
43-
state=link
44-
src="{{nginx_etc}}/sites-available/{{item.file_name}}.conf"
42+
path="{{nginx_etc}}/sites-enabled/{{item.file_name}}.conf"
43+
state=link
44+
src="{{nginx_etc}}/sites-available/{{item.file_name}}.conf"
4545
with_items: nginx_site
4646
notify:
4747
- reload nginx
@@ -56,6 +56,6 @@
5656

5757
- name: common | start the nginx service
5858
service:
59-
name=nginx
60-
state=started
59+
name=nginx
60+
state=started
6161
enabled=yes

tasks/nginx_redhat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
- name: nginx_redhat | Copy the epel packages
1414
copy:
15-
src=epel.repo
15+
src=epel.repo
1616
dest=/etc/yum.repos.d/epel_ansible.repo
1717
when: epel_release_existed.rc != 0
1818

tasks/nginx_smartos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
- name: nginx_smartos | Install the nginx packages
88
pkgin:
9-
name="{{item}}"
9+
name="{{item}}"
1010
state=present
1111
with_items: solaris_pkg
1212

0 commit comments

Comments
 (0)