--- a/roles/nginx/tasks/easy-rsa.yml Sat Jun 25 12:29:01 2016 +0800
+++ b/roles/nginx/tasks/easy-rsa.yml Mon Jun 27 17:38:13 2016 +0800
creates: /etc/nginx/easy-rsa/
- name: Editing vars in-place
- lineinfile: dest=/etc/nginx/easy-rsa/vars
+ dest: /etc/nginx/easy-rsa/vars
regexp: '^export KEY_{{ item.key }}="'
line: 'export KEY_{{ item.key }}="{{ item.value }}"'
with_items: '{{ munin_ca_vars }}'
with_items: '{{ munin_clients }}'
- name: Fetch the resulting PKCS#12 file
- fetch: src=/etc/nginx/easy-rsa/keys/munin.{{ hostname }}.{{ item }}.p12 dest=./pkcs12/ flat=yes fail_on_missing=yes
+ src: /etc/nginx/easy-rsa/keys/munin.{{ hostname }}.{{ item }}.p12
with_items: '{{ munin_clients }}'
--- a/roles/nginx/tasks/main.yml Sat Jun 25 12:29:01 2016 +0800
+++ b/roles/nginx/tasks/main.yml Mon Jun 27 17:38:13 2016 +0800
- apt: pkg={{ item }} state=present
- easy-rsa # for munin certificate auth
- name: Disable default site
- file: path=/etc/nginx/sites-enabled/default state=absent
+ path: /etc/nginx/sites-enabled/default
- name: Add nginx status server
- copy: src=etc/nginx/sites-available/nginx_status dest=/etc/nginx/sites-available/nginx_status
+ src: etc/nginx/sites-available/nginx_status
+ dest: /etc/nginx/sites-available/nginx_status
- file: src=/etc/nginx/sites-available/nginx_status dest=/etc/nginx/sites-enabled/nginx_status state=link
- name: Enable Nginx status server
+ src: /etc/nginx/sites-available/nginx_status
+ dest: /etc/nginx/sites-enabled/nginx_status
- name: Add munin.{{ hostname }}
- template: src=etc/nginx/sites-available/munin dest=/etc/nginx/sites-available/munin.{{ hostname }}
+ src: etc/nginx/sites-available/munin
+ dest: /etc/nginx/sites-available/munin.{{ hostname }}
- name: Enable munin.{{ hostname }}
- file: src=/etc/nginx/sites-available/munin.{{ hostname }} dest=/etc/nginx/sites-enabled/99munin.{{ hostname }} state=link
+ src: /etc/nginx/sites-available/munin.{{ hostname }}
+ dest: /etc/nginx/sites-enabled/99munin.{{ hostname }}
- name: Enable extra Munin plugins
- file: src=/usr/share/munin/plugins/{{ item }} dest=/etc/munin/plugins/{{ item }} state=link
+ src: /usr/share/munin/plugins/{{ item }}
+ dest: /etc/munin/plugins/{{ item }}
- name: Copy custom Nginx-related Munin plugins
- copy: src=etc/munin/plugins/{{ item }} dest=/etc/munin/plugins/{{ item }} mode=0755
+ src: etc/munin/plugins/{{ item }}
+ dest: /etc/munin/plugins/{{ item }}
- nginx_requests_by_vhost
- name: Configure custom Munin plugins
- template: src=etc/munin/plugin-conf.d/{{ item }} dest=/etc/munin/plugin-conf.d/{{ item }}
+ src: etc/munin/plugin-conf.d/{{ item }}
+ dest: /etc/munin/plugin-conf.d/{{ item }}
- nginx_requests_by_vhost
- name: Monitor Nginx with Monit
- file: src=/etc/monit/monitrc.d/nginx dest=/etc/monit/conf.d/nginx state=link
+ src: /etc/monit/monitrc.d/nginx
+ dest: /etc/monit/conf.d/nginx
- name: Allow HTTP and HTTPS
- ufw: rule=allow name='{{ item }}'