---
# This ansible-playbook starts services on
# productive servers after reboot.
#
# What it does:
#   start all services in need of manual action.
#
# It will normally be run with ``ask-pass``
#
# Sample:
#
#   $ ansible-playbook -i host -K -l h5.waeup.org playbook-post-reboot.yml
#

- hosts: h5.waeup.org
  become: true
  become_user: root
  tasks:
  #- name: do something
  #  file: state=touch path=/home/henrik/123
  #  become_user: henrik
  #  become_method: sudo
  #  become: true
  - name: Start odoo
    service: name=odoo-server state=started
  - name: Start scientific african
    command: sudo -u henrik /home/henrik/zope/instances/sciafr/bin/zopectl start
  - name: Start uniben-staff
    command: sudo -u henrik /data/srp/instances/uniben-staff/bin/zopectl start
  - name: Start ngren plone
    command: sudo -u plone /data/plone/ngren/bin/instance start
  - name: Start waeup plone
    command: sudo -u plone /data/plone/waeup/bin/instance start

- hosts: h6.waeup.org
  become: yes
  become_user: root
  tasks:
  - name: Start Ikoba AAUE instance
    command: sudo -u ikoba /ikoba/aaue/bin/ikobactl start
    args:
      chdir: /ikoba/aaue/
  - name: Start Ikoba PCN instance
    command: sudo -u ikoba /ikoba/pcn/bin/ikobactl start
    args:
      chdir: /ikoba/pcn/
  - name: Start Kofa instances
    command: sudo -u kofa /kofa/scripts/kofactl_all.sh start
    args:
      chdir: /kofa/scripts
  - name: Start Ikoba Demo instance
    command: sudo -u ikoba /ikoba/demo/bin/ikobactl start
    args:
      chdir: /ikoba/demo/

- hosts: h7.waeup.org
  become: yes
  become_user: root
  tasks:
  - name: Start kofa instances
    command: sudo -u kofa /kofa/scripts/kofactl_all.sh start
    args:
      chdir: /kofa/scripts
  - name: Start Ikoba Uniben instance
    command: sudo -u ikoba /ikoba/ikobacustom.uniben/bin/ikobactl start
    args:
      chdir: /ikoba/ikobacustom.uniben/
  - name: Start vagrant vhost1
    become_user: vhosts
    command: vagrant up
    args:
      chdir: /home/vhosts/vhost1

- hosts: h8.waeup.org
  become: yes
  become_user: root
  tasks:
  - name: Start vagrant vhost2
    become_user: vhosts
    command: vagrant up
    args:
      chdir: /home/vhosts/vhost2
  - name: Start vagrant vhost3
    become_user: vhosts
    command: vagrant up
    args:
      chdir: /home/vhosts/vhost3
  - name: Start vagrant vhost4
    become_user: vhosts
    command: vagrant up
    args:
      chdir: /home/vhosts/vhost4
  - name: Start vagrant vhost5
    become_user: vhosts
    command: vagrant up
    args:
      chdir: /home/vhosts/vhost5
