---
- hosts: all
  roles:
    - role: common
    - role: node_control_client
    - role: omd_clone_fake_version
  tasks:
  - name: "omd config change"
    shell: "omd config demo change"
    args:
      stdin: |
        PNP4NAGIOS=off
        GRAFANA=on
        NAGFLUX=on
        INFLUXDB=on
  - copy:
      src: "/root/thruk_local.conf"
      dest: "/omd/sites/demo/etc/thruk/thruk_local.conf"
      owner: "demo"
      group: "demo"
  - copy:
      src: "/scenario/objects.cfg"
      dest: "/omd/sites/demo/etc/naemon/conf.d/objects.cfg"
      owner: "demo"
      group: "demo"
  - shell: sed -e "s/###SITE###/{{ lookup('env','PREFIX') }}/g" -i /omd/sites/demo/etc/naemon/conf.d/objects.cfg -i /omd/sites/demo/etc/thruk/thruk_local.conf
  - shell: sed -e "s/-pnp/-perf/g" -i /omd/sites/demo/etc/naemon/conf.d/objects.cfg
  - shell: echo "key_tier2c" > /omd/sites/demo/var/thruk/secret.key
  - file:
      path: /omd/sites/demo/var/thruk/secret.key
      mode: 0600
      owner: demo
      group: demo
  - name: "disable shutdown warnings"
    lineinfile:
      dest: /opt/omd/sites/{{ site }}/.thruk
      create: true
      line: "export THRUK_NO_SHUTDOWN_WARNINGS=1"
      regexp: 'export THRUK_NO_SHUTDOWN_WARNINGS'
  - shell: sudo su - demo -c "git add . && git commit -m 'setup complete'"
