# Create a people server
#
#
- import_playbook: "/srv/web/infra/ansible/playbooks/include/virt-create.yml"
  vars:
    myhosts: "people"

- name: make the box be real
  hosts: people
  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"

  - name: mount project volume
    mount: >
        name=/project
        src=/dev/mapper/GuestVolGroup00-project
        fstype=xfs
        opts="noatime,noexec,nosuid,nodev"
        passno=0
        dump=0
        state=mounted
    tags:
    - mount

  - name: mount srv volume
    mount: >
        name=/srv
        src=/dev/mapper/GuestVolGroup00-srv
        fstype=xfs
        opts="usrquota,gqnoenforce,noatime,noexec,nosuid,nodev"
        passno=0
        dump=0
        state=mounted
    tags:
    - mount

  - name: create /srv/home directory
    file: path=/srv/home state=directory owner=root group=root

  - name: bind mount home volume
    mount: >
        name=/home
        src=/srv/home
        fstype=none
        opts=bind
        passno=0
        dump=0
        state=mounted
    tags:
    - mount

  roles:
  - base
  - collectd/base
  - { role: openvpn/client, when: env != "staging" }
  - ipa/client
  - hosts
  - nagios_client
  - rkhunter
  - rsyncd
  - sudo
  - cgit/base
  - cgit/clean_lock_cron
  - cgit/make_pkgs_list
  - clamav
  - planet
  - { role: letsencrypt, site_name: 'fedoraplanet.org' }
  - git/server
  - role: rabbit/user
    username: "planet{{ env_suffix }}"
    sent_topics: ^org\.fedoraproject\.{{ env_short }}\.(planet|logger)\..*

  - role: apache

  - role: httpd/certificate
    certname: wildcard-2023.fedorapeople.org
    SSLCertificateChainFile: wildcard-2023.fedorapeople.org.intermediate.cert

  - people

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

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