refactoring and cleanup

This commit is contained in:
Robert Kaussow 2017-12-23 12:30:23 +01:00
parent d016e27874
commit 7bfd83f83d

View File

@ -1,4 +1,5 @@
--- ---
- block:
- name: - name:
yum_repository: yum_repository:
name: nginx name: nginx
@ -35,14 +36,6 @@
- /etc/nginx/sites-available - /etc/nginx/sites-available
- /etc/nginx/sites-enabled - /etc/nginx/sites-enabled
- name: Add default page
template:
src: 'var/www/vhosts/default/index.html.j2'
dest: '/var/www/vhosts/default/index.html'
owner: nginx
group: nginx
mode: 0750
- name: Update nginx.conf - name: Update nginx.conf
template: template:
src: 'etc/nginx/nginx.conf.j2' src: 'etc/nginx/nginx.conf.j2'
@ -91,6 +84,14 @@
notify: notify:
- nginx_reload - nginx_reload
- name: Open ports in iptables
iptables_raw:
name: allow_nginx_ports
state: present
rules: '-A INPUT -p tcp -m multiport --dports {{ nginx_open_ports|join(",") }} -j ACCEPT'
become: True
become_user: root
- block: - block:
- name: Copy tls certificate - name: Copy tls certificate
copy: copy:
@ -142,11 +143,16 @@
become_user: root become_user: root
when: nginx_pfs_enabled when: nginx_pfs_enabled
- name: Open ports in iptables - block:
iptables_raw: - name: Add default page
name: allow_nginx_ports template:
state: present src: 'var/www/vhosts/default/index.html.j2'
rules: '-A INPUT -p tcp -m multiport --dports {{ nginx_open_ports|join(",") }} -j ACCEPT' dest: '/var/www/vhosts/default/index.html'
owner: nginx
group: nginx
mode: 0750
become: True
become_user: nginx
- name: Enable nginx service - name: Enable nginx service
systemd: systemd: