Download:
child 109:875d9d6e6c05
parent 107:7dee6d151401
108:f24c7fee1b0d
Anton Shestakov <av6@dwimlabs.net>, Thu, 21 Jul 2016 17:15:21 +0800
provision: update to more YAMLy syntax

7 файлов изменено, 60 вставок(+), 20 удалений(-) [+]
provision/playbook.yml file | annotate | diff | comparison | revisions
provision/roles/fruitbar/handlers/main.yml file | annotate | diff | comparison | revisions
provision/roles/fruitbar/tasks/appinstall.yml file | annotate | diff | comparison | revisions
provision/roles/fruitbar/tasks/main.yml file | annotate | diff | comparison | revisions
provision/roles/nginx/handlers/main.yml file | annotate | diff | comparison | revisions
provision/roles/nginx/tasks/main.yml file | annotate | diff | comparison | revisions
provision/roles/supervisor/tasks/main.yml file | annotate | diff | comparison | revisions
--- a/provision/playbook.yml Thu Jul 21 17:12:40 2016 +0800
+++ b/provision/playbook.yml Thu Jul 21 17:15:21 2016 +0800
@@ -4,9 +4,13 @@
vars:
umbrella: localhost
pre_tasks:
- - lineinfile: dest=/etc/hosts line="127.0.0.1 fruitbar.{{ umbrella }}"
+ - lineinfile:
+ dest: /etc/hosts
+ line: '127.0.0.1 fruitbar.{{ umbrella }}'
when: ansible_virtualization_type == "virtualbox"
- - apt: update_cache=yes cache_valid_time=3600
+ - apt:
+ update_cache: yes
+ cache_valid_time: 3600
roles:
- role: fruitbar
...
--- a/provision/roles/fruitbar/handlers/main.yml Thu Jul 21 17:12:40 2016 +0800
+++ b/provision/roles/fruitbar/handlers/main.yml Thu Jul 21 17:15:21 2016 +0800
@@ -1,4 +1,6 @@
---
- name: restart fruitbar
- supervisorctl: name=fruitbar state=restarted
+ supervisorctl:
+ name: fruitbar
+ state: restarted
...
--- a/provision/roles/fruitbar/tasks/appinstall.yml Thu Jul 21 17:12:40 2016 +0800
+++ b/provision/roles/fruitbar/tasks/appinstall.yml Thu Jul 21 17:15:21 2016 +0800
@@ -1,9 +1,14 @@
---
- name: Ensure ~/webapps/ exists with world-readable permissions
- file: path=/home/{{ user }}/webapps/ state=directory mode=0755
+ file:
+ path: /home/{{ user }}/webapps/
+ state: directory
+ mode: 0755
- name: Add .hgrc
- copy: src=.hgrc dest=/home/{{ user }}/.hgrc
+ copy:
+ src: .hgrc
+ dest: /home/{{ user }}/.hgrc
- name: Pull code
hg:
@@ -14,18 +19,25 @@
- restart fruitbar
- name: Set up venv
- pip: requirements=/home/{{ user }}/webapps/fruitbar/REQUIREMENTS virtualenv=/home/{{ user }}/webapps/fruitbar/venv/
+ pip:
+ requirements: /home/{{ user }}/webapps/fruitbar/REQUIREMENTS
+ virtualenv: /home/{{ user }}/webapps/fruitbar/venv/
notify:
- restart fruitbar
- name: Install wsgi stuff
- pip: name={{ item }} state=latest virtualenv=/home/{{ user }}/webapps/fruitbar/venv/
+ pip:
+ name: '{{ item }}'
+ state: latest
+ virtualenv: /home/{{ user }}/webapps/fruitbar/venv/
with_items:
- eventlet
- gunicorn
- name: Add gunicorn config
- template: src=gunicorn.conf dest=/home/{{ user }}/webapps/fruitbar/gunicorn.conf
+ template:
+ src: gunicorn.conf
+ dest: /home/{{ user }}/webapps/fruitbar/gunicorn.conf
notify:
- restart fruitbar
...
--- a/provision/roles/fruitbar/tasks/main.yml Thu Jul 21 17:12:40 2016 +0800
+++ b/provision/roles/fruitbar/tasks/main.yml Thu Jul 21 17:15:21 2016 +0800
@@ -1,9 +1,12 @@
---
- name: Create user
- user: name={{ user }}
+ user:
+ name: '{{ user }}'
- name: Install packages
- apt: pkg={{ item }} state=present
+ apt:
+ pkg: '{{ item }}'
+ state: present
with_items:
- build-essential
- mercurial
@@ -11,7 +14,9 @@
- python-virtualenv
- name: Install virtualenv
- apt: pkg=virtualenv state=present
+ apt:
+ pkg: virtualenv
+ state: present
when: ansible_distribution_release == 'jessie'
- include: appinstall.yml
@@ -19,14 +24,18 @@
become_user: '{{ user }}'
- name: Add supervisor app
- template: src=etc/supervisor/conf.d/fruitbar.conf dest=/etc/supervisor/conf.d/fruitbar.conf
+ template:
+ src: etc/supervisor/conf.d/fruitbar.conf
+ dest: /etc/supervisor/conf.d/fruitbar.conf
notify:
- reload supervisor
-- stat: path='{{ ssl_cert }}'
+- stat:
+ path: '{{ ssl_cert }}'
register: certfile
-- stat: path='{{ ssl_key }}'
+- stat:
+ path: '{{ ssl_key }}'
register: keyfile
- name: Extract information for HPKP header
@@ -45,12 +54,17 @@
failed_when: "'unable' in hpkpinfo.stderr"
- name: Add Nginx site
- template: src=etc/nginx/sites-available/fruitbar dest=/etc/nginx/sites-available/fruitbar.{{ umbrella }}
+ template:
+ src: etc/nginx/sites-available/fruitbar
+ dest: /etc/nginx/sites-available/fruitbar.{{ umbrella }}
notify:
- restart nginx
- name: Enable Nginx site
- file: src=/etc/nginx/sites-available/fruitbar.{{ umbrella }} dest=/etc/nginx/sites-enabled/{{ site_order }}fruitbar.{{ umbrella }} state=link
+ file:
+ src: /etc/nginx/sites-available/fruitbar.{{ umbrella }}
+ dest: /etc/nginx/sites-enabled/{{ site_order }}fruitbar.{{ umbrella }}
+ state: link
notify:
- restart nginx
...
--- a/provision/roles/nginx/handlers/main.yml Thu Jul 21 17:12:40 2016 +0800
+++ b/provision/roles/nginx/handlers/main.yml Thu Jul 21 17:15:21 2016 +0800
@@ -1,4 +1,6 @@
---
- name: restart nginx
- service: name=nginx state=restarted
+ service:
+ name: nginx
+ state: restarted
...
--- a/provision/roles/nginx/tasks/main.yml Thu Jul 21 17:12:40 2016 +0800
+++ b/provision/roles/nginx/tasks/main.yml Thu Jul 21 17:15:21 2016 +0800
@@ -1,6 +1,8 @@
---
- name: Install package
- apt: pkg=nginx state=present
+ apt:
+ pkg: nginx
+ state: present
- name: Create a Diffie-Hellman key exchange parameters file
command: >
@@ -14,7 +16,9 @@
- restart nginx
- name: Allow HTTP and HTTPS
- ufw: rule=allow name='{{ item }}'
+ ufw:
+ rule: allow
+ name: '{{ item }}'
with_items:
- Nginx HTTP
- Nginx HTTPS
--- a/provision/roles/supervisor/tasks/main.yml Thu Jul 21 17:12:40 2016 +0800
+++ b/provision/roles/supervisor/tasks/main.yml Thu Jul 21 17:15:21 2016 +0800
@@ -1,4 +1,6 @@
---
- name: Install package
- apt: pkg=supervisor state=present
+ apt:
+ pkg: supervisor
+ state: present
...