Consolidate tasks using loops.
This commit is contained in:
parent
b473d55d1f
commit
6860ad0b70
|
@ -9,27 +9,27 @@
|
|||
service: name=nginx enabled=yes
|
||||
- name: Stop nginx for now
|
||||
service: name=nginx state=stopped
|
||||
- name: Clean out default vhost file in enabled dir
|
||||
file: path=/etc/nginx/sites-enabled/default state=absent
|
||||
- name: Clean out default vhost file in available dir
|
||||
file: path=/etc/nginx/sites-available/default state=absent
|
||||
- name: Make global nginx conf directory
|
||||
file: path=/etc/nginx/global state=directory
|
||||
- name: Copy our nginx.conf over
|
||||
copy: src=nginx.conf dest=/etc/nginx/nginx.conf backup=yes
|
||||
- name: Copy our default catch-all vhost over
|
||||
copy: src=0-catch-all dest=/etc/nginx/sites-available/0-catch-all
|
||||
- name: Symlink the default catch-all vhost
|
||||
file: src=/etc/nginx/sites-available/0-catch-all dest=/etc/nginx/sites-enabled/0-catch-all state=link
|
||||
- name: Copy over global includes, make catchall dir, and start nginx
|
||||
- name: Make nginx related dirs
|
||||
file: path={{ item }} state=directory
|
||||
with_items:
|
||||
- /etc/nginx/global
|
||||
- /srv/www/catch-all
|
||||
- name: Clean out default vhost file in enabled and available dirs
|
||||
file: path={{ item }} state=absent
|
||||
with_items:
|
||||
- /etc/nginx/sites-enabled/default
|
||||
- /etc/nginx/sites-available/default
|
||||
- name: Copy over all nginx configuration files
|
||||
copy: src={{ item.name }} dest={{ item.dir }}
|
||||
with_items:
|
||||
- { name: 'nginx.conf', dir: '/etc/nginx/nginx.conf' }
|
||||
- { name: '0-catch-all', dir: '/etc/nginx/sites-available/0-catch-all' }
|
||||
- { name: 'cloudflare.conf', dir: '/etc/nginx/global/cloudflare.conf' }
|
||||
- { name: 'php-generic.conf', dir: '/etc/nginx/global/php-generic.conf' }
|
||||
- { name: 'security-generic.conf', dir: '/etc/nginx/global/security-generic.conf' }
|
||||
- { name: 'wordpress-generic.conf', dir: '/etc/nginx/global/wordpress-generic.conf' }
|
||||
- { name: 'wordpress-security.conf', dir: '/etc/nginx/global/wordpress-security.conf' }
|
||||
- name: Make catch-all vhost root dir
|
||||
file: path=/srv/www/catch-all state=directory owner=www-data group=www-data
|
||||
- name: Symlink the default catch-all vhost
|
||||
file: src=/etc/nginx/sites-available/0-catch-all dest=/etc/nginx/sites-enabled/0-catch-all state=link
|
||||
notify:
|
||||
- start nginx
|
||||
|
|
Loading…
Reference in New Issue