add script to easily play site.yml
[ansible.git] / roles / etherpad / tasks / main.yml
1 - name: create nodejs user
2   user:
3     name: nodejs
4     system: yes
5     group: nogroup
6     home: /var/lib/nodejs
7     create_home: no
8     shell: /bin/false
9 - name: create nodejs dir
10   file: path=/var/lib/nodejs state=directory owner=nodejs group=nogroup
11 - name: create etherpad dir
12   file: path=/srv/{{etherpad.domain}} state=directory owner=nodejs group=www-data
13 - name: check out etherpad sources
14   become_user: nodejs
15   register: etherpad_src
16   git:
17     dest: /srv/{{etherpad.domain}}/etherpad-lite
18     repo: 'https://github.com/ether/etherpad-lite.git'
19     version: '1.6.6'
20     force: yes
21 - name: create etherpad service file
22   register: etherpad_service
23   template:
24     dest: /etc/systemd/system/etherpad-lite.service
25     src: templates/etherpad-lite.service
26 - name: configure etherpad
27   register: etherpad_settings
28   template:
29     dest: /srv/{{etherpad.domain}}/etherpad-lite/settings.json
30     src: templates/settings.json
31     mode: u=rw,g=,o=
32     owner: nodejs
33     group: nogroup
34 - name: (re)start and enable etherpad service
35   when: etherpad_src.changed or etherpad_service.changed or etherpad_settings.changed
36   systemd: name=etherpad-lite state=restarted daemon_reload=yes enabled=yes