Download:
child 10:dcbe70128e6a
parent 8:a4ee025a8854
9:72c6ce33de6f
Anton Shestakov <av6@dwimlabs.net>, Mon, 27 Jun 2016 17:38:13 +0800
use a more YAMLy syntax everywhere

3 файлов изменено, 48 вставок(+), 15 удалений(-) [+]
roles/nginx/handlers/main.yml file | annotate | diff | comparison | revisions
roles/nginx/tasks/easy-rsa.yml file | annotate | diff | comparison | revisions
roles/nginx/tasks/main.yml file | annotate | diff | comparison | revisions
--- a/roles/nginx/handlers/main.yml Sat Jun 25 12:29:01 2016 +0800
+++ b/roles/nginx/handlers/main.yml Mon Jun 27 17:38:13 2016 +0800
@@ -1,4 +1,6 @@
---
- name: restart nginx
- service: name=nginx state=restarted
+ service:
+ name: nginx
+ state: restarted
...
--- 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
@@ -5,8 +5,8 @@
creates: /etc/nginx/easy-rsa/
- name: Editing vars in-place
- lineinfile: dest=/etc/nginx/easy-rsa/vars
- args:
+ lineinfile:
+ dest: /etc/nginx/easy-rsa/vars
regexp: '^export KEY_{{ item.key }}="'
line: 'export KEY_{{ item.key }}="{{ item.value }}"'
with_items: '{{ munin_ca_vars }}'
@@ -54,6 +54,10 @@
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
+ fetch:
+ src: /etc/nginx/easy-rsa/keys/munin.{{ hostname }}.{{ item }}.p12
+ dest: ./pkcs12/
+ flat: yes
+ fail_on_missing: yes
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
@@ -1,6 +1,8 @@
---
- name: Install packages
- apt: pkg={{ item }} state=present
+ apt:
+ pkg: '{{ item }}'
+ state: present
with_items:
- easy-rsa # for munin certificate auth
- nginx-full
@@ -8,17 +10,24 @@
tags: [packages, inert]
- name: Disable default site
- file: path=/etc/nginx/sites-enabled/default state=absent
+ file:
+ path: /etc/nginx/sites-enabled/default
+ state: absent
notify:
- restart nginx
- name: Add nginx status server
- copy: src=etc/nginx/sites-available/nginx_status dest=/etc/nginx/sites-available/nginx_status
+ copy:
+ src: etc/nginx/sites-available/nginx_status
+ dest: /etc/nginx/sites-available/nginx_status
notify:
- restart nginx
- file: src=/etc/nginx/sites-available/nginx_status dest=/etc/nginx/sites-enabled/nginx_status state=link
- name: Enable Nginx status server
+ file:
+ src: /etc/nginx/sites-available/nginx_status
+ dest: /etc/nginx/sites-enabled/nginx_status
+ state: link
notify:
- restart nginx
@@ -50,19 +59,27 @@
tags: [munin]
- name: Add munin.{{ hostname }}
- template: src=etc/nginx/sites-available/munin dest=/etc/nginx/sites-available/munin.{{ hostname }}
+ template:
+ src: etc/nginx/sites-available/munin
+ dest: /etc/nginx/sites-available/munin.{{ hostname }}
notify:
- restart nginx
tags: [munin]
- name: Enable munin.{{ hostname }}
- file: src=/etc/nginx/sites-available/munin.{{ hostname }} dest=/etc/nginx/sites-enabled/99munin.{{ hostname }} state=link
+ file:
+ src: /etc/nginx/sites-available/munin.{{ hostname }}
+ dest: /etc/nginx/sites-enabled/99munin.{{ hostname }}
+ state: link
notify:
- restart nginx
tags: [munin]
- name: Enable extra Munin plugins
- file: src=/usr/share/munin/plugins/{{ item }} dest=/etc/munin/plugins/{{ item }} state=link
+ file:
+ src: /usr/share/munin/plugins/{{ item }}
+ dest: /etc/munin/plugins/{{ item }}
+ state: link
with_items:
- nginx_request
- nginx_status
@@ -71,7 +88,10 @@
tags: [munin]
- name: Copy custom Nginx-related Munin plugins
- copy: src=etc/munin/plugins/{{ item }} dest=/etc/munin/plugins/{{ item }} mode=0755
+ copy:
+ src: etc/munin/plugins/{{ item }}
+ dest: /etc/munin/plugins/{{ item }}
+ mode: 0755
with_items:
- nginx_requests_by_vhost
notify:
@@ -79,7 +99,9 @@
tags: [munin]
- name: Configure custom Munin plugins
- template: src=etc/munin/plugin-conf.d/{{ item }} dest=/etc/munin/plugin-conf.d/{{ item }}
+ template:
+ src: etc/munin/plugin-conf.d/{{ item }}
+ dest: /etc/munin/plugin-conf.d/{{ item }}
with_items:
- nginx_requests_by_vhost
notify:
@@ -87,13 +109,18 @@
tags: [munin]
- name: Monitor Nginx with Monit
- file: src=/etc/monit/monitrc.d/nginx dest=/etc/monit/conf.d/nginx state=link
+ file:
+ src: /etc/monit/monitrc.d/nginx
+ dest: /etc/monit/conf.d/nginx
+ state: link
notify:
- reload monit
tags: [monit]
- name: Allow HTTP and HTTPS
- ufw: rule=allow name='{{ item }}'
+ ufw:
+ name: '{{ item }}'
+ rule: allow
with_items:
- Nginx HTTP
- Nginx HTTPS