# This is a basic playbook

- name: dole out the basic configuration
  hosts: nfs_servers
  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
  - hosts
  - ipa/client
  - nagios_client
  - collectd/base
  - sudo
  - openvpn/client

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

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

## This should be in a different playbook.
- name: Deal with drive items on storinator01
  hosts: storinator01.rdu-cc.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
  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"

  tasks:
    - name: Create top level directory
      file: path=/srv/nfs state=directory owner=root group=root
      tags:
        - drives
        - copr

    - name: create copr-be storage
      lvol: vg=VG_nfs lv=copr-be size=30t shrink=no
      tags:
        - drives
        - copr

    - name: Create FS for copr-be
      filesystem: fstype=xfs dev=/dev/VG_nfs/copr-be
      tags:
        - drives
        - copr

    - name: Create copr-be tree directory
      file: path=/srv/nfs/copr-be state=directory owner=root group=root
      tags:
        - drives
        - copr

    - name: Mount copr-be tree directory
      mount: name=/srv/nfs/copr-be src=/dev/mapper/VG_nfs-copr--be fstype=xfs state=mounted
      tags:
        - drives
        - copr

- name: Deal with NFS
  hosts: storinator01.rdu-cc.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
  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"
  roles:
  - nfs/server
