Skip to content

Commit

Permalink
Ansible Nginx
Browse files Browse the repository at this point in the history
  * Adding ssl cert path to variables and removing old ssl looping
  * Updating ssl task to use variable
  • Loading branch information
Pablo Castillo committed May 2, 2015
1 parent 40ab5b4 commit 467cdcb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
8 changes: 6 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ custom: 'true'
nginx:
version: 1.6.2
upstream_port: 5000
user: ubuntu
group: ubuntu
ssl_cert:
crt: ""
key: ""
passenger:
version: 5.0.6
prestart: http://test.com
app:
user: ubuntu
group: ubuntu
domains: test.com
server_env: production
6 changes: 3 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ignore_errors: yes

- name: Take Ownership of /opt
file: path=/opt/ owner={{ nginx.user }} group={{ nginx.group }} recurse=yes state=directory
file: path=/opt/ owner={{ app.user }} group={{ app.group }} recurse=yes state=directory
sudo: yes
when: result|failed

Expand All @@ -29,15 +29,15 @@
when: result|failed

- name: Unzip Nginx Tar
unarchive: src=/opt/nginx-{{ nginx.version }}.tar.gz dest=/opt copy=no group={{ nginx.group }} owner={{ nginx.user }}
unarchive: src=/opt/nginx-{{ nginx.version }}.tar.gz dest=/opt copy=no group={{ app.group }} owner={{ app.user }}
when: result|failed

- name: Download Third Party modules
get_url: url=http://www.dropbox.com/s/e3n2lin6dvqlaos/modules.tar.gz?dl=1 dest=/opt/nginx-{{ nginx.version }}
when: result|failed

- name: Unzip Modules
unarchive: src=/opt/nginx-{{ nginx.version }}/modules.tar.gz dest=/opt/nginx-{{ nginx.version }} copy=no group={{ nginx.group }} owner={{ nginx.user }}
unarchive: src=/opt/nginx-{{ nginx.version }}/modules.tar.gz dest=/opt/nginx-{{ nginx.version }} copy=no group={{ app.group }} owner={{ app.user }}
when: result|failed

- include: passenger.yml
Expand Down
16 changes: 2 additions & 14 deletions tasks/ssl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,9 @@
when: passenger == "true"

- name: Copy SSL Certs to server
copy: src={{ item }} dest=/etc/nginx/ssl/ owner=root group=root force=yes
copy: src={{ nginx.ssl_cert.crt }} dest=/etc/nginx/ssl/ owner=root group=root force=yes
sudo: yes
with_first_found:
- files:
- "server.crt"
paths:
- ../../../projects/{{ app_name }}/files/ssl
- ../files/ssl

- name: Copy SSL Certs to server
copy: src={{ item }} dest=/etc/nginx/ssl/ owner=root group=root force=yes
copy: src={{ nginx.ssl_cert.key }} dest=/etc/nginx/ssl/ owner=root group=root force=yes
sudo: yes
with_first_found:
- files:
- "server.key"
paths:
- ../../../projects/{{ app_name }}/files/ssl
- ../files/ssl

0 comments on commit 467cdcb

Please sign in to comment.