---
# This ansible-playbook prepares productive
# servers for reboot.
#
# What it does:
#   stop all services in need of manual stop
#
# It will normally be run with ``ask-pass``
#
# Sample:
#
#   $ ansible-playbook -i host -K -l h5.waeup.org playbook-prep-reboot.yml
#

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


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


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

- hosts: h8.waeup.org
  become: yes
  become_user: root
  tasks:
  - name: Stop vagrant vhost2
    become_user: vhosts
    command: vagrant halt
    args:
      chdir: /home/vhosts/vhost2/

