- import_playbook: "/srv/web/infra/ansible/playbooks/include/virt-create.yml"
  vars:
    myhosts: "debuginfod:debuginfod_stg"

- name: make the box be real
  hosts: debuginfod:debuginfod_stg
  user: root
  gather_facts: true

  vars_files:
  - /srv/web/infra/ansible/vars/global.yml
  - "/srv/private/ansible/vars.yml"
  - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  pre_tasks:
  - import_tasks: "{{ tasks_path }}/yumrepos.yml"

  roles:
  - base
  - rkhunter
  - nagios_client
  - zabbix/zabbix_agent
  - hosts
  - ipa/client
  - collectd/base

  - role: nfs/client
    mount_stg: true
    mnt_dir: '/mnt/fedora_koji_prod'
    nfs_src_dir: "fedora_koji"

  tasks:
  - import_tasks: "{{ tasks_path }}/motd.yml"

  - name: install debuginfod
    package: name=elfutils-debuginfod state=present
    tags: debuginfod

  - name: install sqlite for diagnostics
    package: name=sqlite state=present
    tags: debuginfod

  - name: install sqlite-analyzer for diagnostics
    package: name=sqlite-analyzer state=present
    tags: debuginfod

  - name: install sqlite for diagnostics
    package: name=sqlite state=present
    tags: debuginfod

  - name: install rsync for data backups
    package: name=rsync state=present
    tags: debuginfod

  - name: install debuginfod configuration
    copy: src="{{ files }}/debuginfod/sysconfig.debuginfod" dest=/etc/sysconfig/debuginfod owner=root group=root mode=644
    tags: debuginfod
    notify:
      - restart debuginfod

  - name: ensure systemd drop-in directory exists
    file: >
      dest=/etc/systemd/system/debuginfod.service.d
      state=directory
    tags: debuginfod

  - name: install debuginfod systemd drop-in
    tags: debuginfod
    copy: src="{{ files }}/debuginfod/debuginfod.service.d" dest=/etc/systemd/system/debuginfod.service.d/override.conf owner=root group=root mode=644
    notify:
      - restart debuginfod

  - name: ensure debuginfod is enabled and started
    service:
      name: debuginfod
      state: started
      enabled: yes
    tags: debuginfod

  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"
