Download:
child 212:05fdc9e2fb0f
parent 210:754734f58eaf
211:4b03f725cb69
Anton Shestakov <av6@dwimlabs.net>, Thu, 07 Jul 2016 00:12:35 +0800
provision: update tasks to use more YAMLy syntax

12 файлов изменено, 141 вставок(+), 43 удалений(-) [+]
contrib/provision/playbook.yml file | annotate | diff | comparison | revisions
contrib/provision/roles/certs/tasks/main.yml file | annotate | diff | comparison | revisions
contrib/provision/roles/common/tasks/main.yml file | annotate | diff | comparison | revisions
contrib/provision/roles/nginx/handlers/main.yml file | annotate | diff | comparison | revisions
contrib/provision/roles/nginx/tasks/main.yml file | annotate | diff | comparison | revisions
contrib/provision/roles/prosody/handlers/main.yml file | annotate | diff | comparison | revisions
contrib/provision/roles/prosody/tasks/extra-modules.yml file | annotate | diff | comparison | revisions
contrib/provision/roles/prosody/tasks/main.yml file | annotate | diff | comparison | revisions
contrib/provision/roles/tram-im/tasks/appinstall.yml file | annotate | diff | comparison | revisions
contrib/provision/roles/tram-im/tasks/main.yml file | annotate | diff | comparison | revisions
contrib/provision/roles/turnserver/handlers/main.yml file | annotate | diff | comparison | revisions
contrib/provision/roles/turnserver/tasks/main.yml file | annotate | diff | comparison | revisions
--- a/contrib/provision/playbook.yml Wed Jun 01 22:46:32 2016 +0800
+++ b/contrib/provision/playbook.yml Thu Jul 07 00:12:35 2016 +0800
@@ -5,7 +5,10 @@
domain: tram-im
pre_tasks:
- name: Purge unused packages that come preinstalled on Vagrant templates
- apt: pkg={{ item }} state=absent purge=yes
+ apt:
+ pkg: '{{ item }}'
+ state: absent
+ purge: yes
with_items:
- chef
- chef-zero
@@ -40,7 +43,10 @@
tags: [tram-im]
post_tasks:
- name: Enable service
- service: name={{ item }} state=started enabled=yes
+ service:
+ name: '{{ item }}'
+ state: started
+ enabled: yes
with_items:
- nginx
- prosody
--- a/contrib/provision/roles/certs/tasks/main.yml Wed Jun 01 22:46:32 2016 +0800
+++ b/contrib/provision/roles/certs/tasks/main.yml Thu Jul 07 00:12:35 2016 +0800
@@ -1,15 +1,27 @@
---
- name: Install packages
- apt: pkg={{ item }} state=present
+ apt:
+ pkg: '{{ item }}'
+ state: present
with_items:
- openssl
- ssl-cert
- name: Make sure {{ path }} exists
- file: path='{{ path }}' state=directory owner=root group=ssl-cert mode=0710
+ file:
+ path: '{{ path }}'
+ state: directory
+ owner: root
+ group: ssl-cert
+ mode: 0710
- name: Make sure domain directories exist
- file: path='{{ path }}/{{ item }}' state=directory owner=root group=ssl-cert mode=0710
+ file:
+ path: '{{ path }}/{{ item }}'
+ state: directory
+ owner: root
+ group: ssl-cert
+ mode: 0710
with_items: '{{ selfsigned }}'
- name: Generate private keys
@@ -22,7 +34,12 @@
with_items: '{{ selfsigned }}'
- name: Set permissions for private keys
- file: path='{{ path }}/{{ item }}/clean.key' state=file owner=root group=ssl-cert mode=0640
+ file:
+ path: '{{ path }}/{{ item }}/clean.key'
+ state: file
+ owner: root
+ group: ssl-cert
+ mode: 0640
with_items: '{{ selfsigned }}'
- name: Generate self-signed certificates
@@ -40,6 +57,11 @@
with_items: '{{ selfsigned }}'
- name: Set permissions for self-signed certificates
- file: path='{{ path }}/{{ item }}/selfsigned.pem' state=file owner=root group=ssl-cert mode=0640
+ file:
+ path: '{{ path }}/{{ item }}/selfsigned.pem'
+ state: file
+ owner: root
+ group: ssl-cert
+ mode: 0640
with_items: '{{ selfsigned }}'
...
--- a/contrib/provision/roles/common/tasks/main.yml Wed Jun 01 22:46:32 2016 +0800
+++ b/contrib/provision/roles/common/tasks/main.yml Thu Jul 07 00:12:35 2016 +0800
@@ -1,17 +1,24 @@
---
- name: Set timezone {{ timezone }}
- template: src=etc/timezone dest=/etc/timezone
+ template:
+ src: etc/timezone
+ dest: /etc/timezone
notify:
- update timezone
- name: Generate locale
- locale_gen: name={{ locale }}
+ locale_gen:
+ name: '{{ locale }}'
- name: Set system locale
command: update-locale LANG={{ locale }}
- name: Install base packages
- apt: pkg={{ item }} state=present update_cache=yes cache_valid_time=3600
+ apt:
+ update_cache: yes
+ cache_valid_time: 3600
+ pkg: '{{ item }}'
+ state: present
with_items:
- ca-certificates
- openntpd
@@ -19,13 +26,18 @@
tags: [packages]
- name: Stop installing recommends
- copy: src=etc/apt/apt.conf.d/99recommends dest=/etc/apt/apt.conf.d/99recommends
+ copy:
+ src: etc/apt/apt.conf.d/99recommends
+ dest: /etc/apt/apt.conf.d/99recommends
- name: Allow ssh access
- ufw: rule=allow name=OpenSSH
+ ufw:
+ rule: allow
+ name: OpenSSH
tags: [ufw]
- name: Enable ufw
- ufw: state=enabled
+ ufw:
+ state: enabled
tags: [ufw]
...
--- a/contrib/provision/roles/nginx/handlers/main.yml Wed Jun 01 22:46:32 2016 +0800
+++ b/contrib/provision/roles/nginx/handlers/main.yml Thu Jul 07 00:12:35 2016 +0800
@@ -1,4 +1,6 @@
---
- name: restart nginx
- service: name=nginx state=restarted
+ service:
+ name: nginx
+ state: restarted
...
--- a/contrib/provision/roles/nginx/tasks/main.yml Wed Jun 01 22:46:32 2016 +0800
+++ b/contrib/provision/roles/nginx/tasks/main.yml Thu Jul 07 00:12:35 2016 +0800
@@ -1,12 +1,16 @@
---
- name: Install packages
- apt: pkg={{ item }} state=present
+ apt:
+ pkg: '{{ item }}'
+ state: present
with_items:
- nginx
tags: [packages]
- 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
@@ -22,7 +26,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/contrib/provision/roles/prosody/handlers/main.yml Wed Jun 01 22:46:32 2016 +0800
+++ b/contrib/provision/roles/prosody/handlers/main.yml Thu Jul 07 00:12:35 2016 +0800
@@ -1,4 +1,6 @@
---
- name: restart prosody
- service: name=prosody state=restarted
+ service:
+ name: prosody
+ state: restarted
...
--- a/contrib/provision/roles/prosody/tasks/extra-modules.yml Wed Jun 01 22:46:32 2016 +0800
+++ b/contrib/provision/roles/prosody/tasks/extra-modules.yml Thu Jul 07 00:12:35 2016 +0800
@@ -1,6 +1,8 @@
---
- name: Fetch extra Prosody modules
- hg: repo=https://hg.prosody.im/prosody-modules/ dest=/var/lib/prosody/extra-modules
+ hg:
+ repo: https://hg.prosody.im/prosody-modules/
+ dest: /var/lib/prosody/extra-modules
notify:
- restart prosody
...
--- a/contrib/provision/roles/prosody/tasks/main.yml Wed Jun 01 22:46:32 2016 +0800
+++ b/contrib/provision/roles/prosody/tasks/main.yml Thu Jul 07 00:12:35 2016 +0800
@@ -1,8 +1,10 @@
---
- name: Install server packages
- apt: pkg={{ item }} state=present
+ apt:
+ pkg: '{{ item }}'
+ state: present
with_items:
- - mercurial # for extra modules
+ - mercurial # for extra modules
- prosody
- lua-event
- lua-sec
@@ -24,17 +26,25 @@
- restart prosody
- name: Work around default config bug
- file: src=../../ssl/certs/ssl-cert-snakeoil.pem dest=/etc/prosody/certs/localhost.crt state=link
+ file:
+ src: ../../ssl/certs/ssl-cert-snakeoil.pem
+ dest: /etc/prosody/certs/localhost.crt
+ state: link
notify:
- restart prosody
- name: Disable localhost VirtualHost
- file: path=/etc/prosody/conf.d/localhost.cfg.lua state=absent
+ file:
+ path: /etc/prosody/conf.d/localhost.cfg.lua
+ state: absent
notify:
- restart prosody
- name: Open ports
- ufw: rule=allow port=xmpp-client proto=tcp
+ ufw:
+ rule: allow
+ port: xmpp-client
+ proto: tcp
when: ansible_virtualization_type == "virtualbox"
tags: [ufw]
...
--- a/contrib/provision/roles/tram-im/tasks/appinstall.yml Wed Jun 01 22:46:32 2016 +0800
+++ b/contrib/provision/roles/tram-im/tasks/appinstall.yml Thu Jul 07 00:12:35 2016 +0800
@@ -1,20 +1,33 @@
---
- name: Make sure project directory exists
- file: path={{ dir }} state=directory
+ file:
+ path: '{{ dir }}'
+ state: directory
- name: Pull Tram-IM {{ revision }}
- hg: repo={{ repo }} dest={{ dir }} revision={{ revision }}
+ hg:
+ repo: '{{ repo }}'
+ dest: '{{ dir }}'
+ revision: '{{ revision }}'
when: ansible_virtualization_type != "virtualbox"
- name: Make sure vendor directory exists
- file: path={{ dir }}/vendor state=directory
+ file:
+ path: '{{ dir }}/vendor'
+ state: directory
- name: Clone Strophe.js
- git: repo=https://github.com/strophe/strophejs.git dest={{ dir }}/vendor/strophejs
+ git:
+ repo: https://github.com/strophe/strophejs.git
+ dest: '{{ dir }}/vendor/strophejs'
- name: Clone Strophe.js plugins
- git: repo=https://github.com/strophe/strophejs-plugins.git dest={{ dir }}/vendor/strophejs-plugins
+ git:
+ repo: https://github.com/strophe/strophejs-plugins.git
+ dest: '{{ dir }}/vendor/strophejs-plugins'
- name: Download WebRTC adapter
- get_url: url=https://webrtc.github.io/adapter/adapter-1.0.4.js dest={{ dir }}/vendor/webrtc-adapter-1.0.4.js
+ get_url:
+ url: https://webrtc.github.io/adapter/adapter-1.0.4.js
+ dest: '{{ dir }}/vendor/webrtc-adapter-1.0.4.js'
...
--- a/contrib/provision/roles/tram-im/tasks/main.yml Wed Jun 01 22:46:32 2016 +0800
+++ b/contrib/provision/roles/tram-im/tasks/main.yml Thu Jul 07 00:12:35 2016 +0800
@@ -1,18 +1,24 @@
---
- name: Set hostnames
- lineinfile: dest=/etc/hosts line='{{ ansible_all_ipv4_addresses[0] }} {{ domain }} muc.{{ domain }}'
+ lineinfile:
+ dest: /etc/hosts
+ line: '{{ ansible_all_ipv4_addresses[0] }} {{ domain }} muc.{{ domain }}'
when: ansible_virtualization_type == "virtualbox"
- name: Install packages
- apt: pkg={{ item }} state=present
+ apt:
+ pkg: '{{ item }}'
+ state: present
with_items:
- - git # for 3rd-party libraries
+ - git # for 3rd-party libraries
tags: [packages]
-- stat: path='{{ ssl_cert }}'
+- stat:
+ path: '{{ ssl_cert }}'
register: certfile
-- stat: path='{{ ssl_key }}'
+- stat:
+ path: '{{ ssl_key }}'
register: keyfile
- name: Ensure certificate exists
@@ -22,29 +28,40 @@
- '{{ keyfile.stat.exists }}'
- name: Create user
- user: name={{ user }}
+ user:
+ name: '{{ user }}'
- include: appinstall.yml
sudo: yes
sudo_user: '{{ user }}'
- name: Add Prosody VirtualHost
- template: src=etc/prosody/conf.avail/tram-im.cfg.lua dest=/etc/prosody/conf.avail/{{ domain }}.cfg.lua
+ template:
+ src: etc/prosody/conf.avail/tram-im.cfg.lua
+ dest: /etc/prosody/conf.avail/{{ domain }}.cfg.lua
notify:
- restart prosody
- name: Enable Prosody VirtualHost
- file: src=/etc/prosody/conf.avail/{{ domain }}.cfg.lua dest=/etc/prosody/conf.d/{{ domain }}.cfg.lua state=link
+ file:
+ src: /etc/prosody/conf.avail/{{ domain }}.cfg.lua
+ dest: /etc/prosody/conf.d/{{ domain }}.cfg.lua
+ state: link
notify:
- restart prosody
- name: Add BOSH proxy Nginx site
- template: src=etc/nginx/sites-available/tram-im dest=/etc/nginx/sites-available/{{ domain }}
+ template:
+ src: etc/nginx/sites-available/tram-im
+ dest: /etc/nginx/sites-available/{{ domain }}
notify:
- restart nginx
- name: Enable BOSH proxy Nginx site
- file: src=/etc/nginx/sites-available/{{ domain }} dest=/etc/nginx/sites-enabled/50{{ domain }} state=link
+ file:
+ src: /etc/nginx/sites-available/{{ domain }}
+ dest: /etc/nginx/sites-enabled/50{{ domain }}
+ state: link
notify:
- restart nginx
...
--- a/contrib/provision/roles/turnserver/handlers/main.yml Wed Jun 01 22:46:32 2016 +0800
+++ b/contrib/provision/roles/turnserver/handlers/main.yml Thu Jul 07 00:12:35 2016 +0800
@@ -1,4 +1,6 @@
---
- name: restart resiprocate-turn-server
- service: name=resiprocate-turn-server state=restarted
+ service:
+ name: resiprocate-turn-server
+ state: restarted
...
--- a/contrib/provision/roles/turnserver/tasks/main.yml Wed Jun 01 22:46:32 2016 +0800
+++ b/contrib/provision/roles/turnserver/tasks/main.yml Thu Jul 07 00:12:35 2016 +0800
@@ -1,11 +1,15 @@
---
- name: Install packages
- apt: pkg={{ item }} state=present
+ apt:
+ pkg: '{{ item }}'
+ state: present
with_items:
- resiprocate-turn-server
tags: [packages]
- name: Allow STUN
- ufw: rule=allow port=3478
+ ufw:
+ rule: allow
+ port: 3478
tags: [ufw]
...