Skip to content

Commit

Permalink
making idempotent
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonu Meena committed Jan 23, 2015
1 parent 1a0b3a4 commit a2273a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
5 changes: 5 additions & 0 deletions roles/helloWorld/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
#file handlers/main.yml

- name: reload nginx
service: name=nginx state=reloaded
14 changes: 2 additions & 12 deletions roles/helloWorld/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
---
#file tasks/main.yml

- name: Prepare directory layout
file: path={{item}} state=directory
with_items:
- "/opt/helloWorld"
- "/opt/helloWorld/logs"
- "/opt/helloWorld/conf"

- name: Prepare the nginx.conf config file
template: src=nginx.conf.j2 dest=/opt/helloWorld/conf/nginx.conf mode=0644

- name: Start the Nginx server
shell: cd /opt/helloWorld; /usr/local/openresty/nginx/sbin/nginx -p `pwd`/ -c /opt/helloWorld/conf/nginx.conf
sudo: yes
template: src=nginx.conf.j2 dest=/usr/local/openresty/nginx/conf/nginx.conf mode=0644
notify: reload nginx
3 changes: 2 additions & 1 deletion roles/openResty/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
PATH: /usr/local/openresty/nginx/sbin:{{ ansible_env.PATH }}

- name: copy init script
template: src=nginx.j2 dest=/etc/init.d/nginx.conf mode=0755
template: src=nginx.j2 dest=/etc/init.d/nginx mode=0755
register: conf_changed
sudo: yes

- name: udpate init
shell: update-rc.d -f nginx defaults
Expand Down

0 comments on commit a2273a6

Please sign in to comment.