---
- hosts: all
  roles:
    - role: common
    - role: service_sshd
    - role: ssh_site_login
    - role: thruk_developer
  tasks:
  - shell: "chown demo: /mnt/etc/"
  - shell: sudo su - demo -c "cp -rp .ssh /mnt/etc/"
  - shell: "cp -p /omd/sites/demo/.ssh/config /mnt/etc/.ssh"
  - shell: "chown -R demo: /mnt/etc/"
  - name: "omd config change"
    shell: "omd config demo change"
    args:
      stdin: |
        APACHE_MODE=own
        PNP4NAGIOS=off
        LIVESTATUS_TCP=on
  - name: copy naemon example.cfg
    copy:
      src: /omd/sites/demo/share/doc/naemon/example.cfg
      dest: /omd/sites/demo/etc/naemon/conf.d/example.cfg
      owner: demo
      group: demo
  - name: copy naemon test.cfg
    copy:
      src: /root/test.cfg
      dest: /omd/sites/demo/etc/naemon/conf.d/test.cfg
      owner: demo
      group: demo
  - name: ensure thruk_bp_generated.cfg exists
    copy:
      content: ""
      dest: /mnt/var/thruk_bp_generated.cfg
      force: no
      group: demo
      owner: demo
      mode: 0660
  - name: create symlink for thruk_bp_generated.cfg
    file:
      src: /mnt/var/thruk_bp_generated.cfg
      dest: /omd/sites/demo/etc/naemon/conf.d/thruk_bp_generated.cfg
      owner: demo
      group: demo
      state: link
  - shell: echo "testkey" > /omd/sites/demo/var/thruk/secret.key
  - file:
      path: /omd/sites/demo/var/thruk/secret.key
      mode: 0600
      owner: demo
      group: demo
