# create a new database server system
# NOTE: most of these vars_path come from group_vars/backup_server or from hostvars

# Once the instance exists, configure it.

- name: configure postgresql server system
  hosts: copr-db-stg.aws.fedoraproject.org
  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:
    - include_vars: dir=/srv/web/infra/ansible/vars/all/ ignore_files=README
    - import_tasks: "{{ tasks_path }}/yumrepos.yml"
    - dnf:
        name:
          - langpacks-en
          - glibc-all-langpacks
        state: latest

  roles:
  - base
  - rkhunter
  - {role: ipa/client, when: env == "staging"}
  - nagios_client
  - zabbix/zabbix_agent
  - hosts
  #- postgresql_server
  #- collectd/base
  #- collectd/postgres  # This requires a 'databases' var to be set in host_vars
  - sudo

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

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