---

- import_playbook: playbook.constructor.yml

- name: servers host setup
  hosts: servers
  become: true
  roles:
    - system-security
    - journalctl
    - health-disc-space
    - cleanup-disc-space
    - health-btrfs
    - system-btrfs-auto-balancer

- name: "setup corporate identity"
  hosts: corporate_identity
  become: true
  roles:
   -  role: corporate-identity

#########################################################################
### Docker Roles                                                      ###
#########################################################################

- name: "setup matomo"
  hosts: matomo
  become: true
  roles:
   -  role: docker-matomo

- name: setup ldap
  hosts: ldap
  become: true
  roles:
   -  role: docker-ldap

- name: setup keycloak
  hosts: keycloak
  become: true
  roles:
   -  role: docker-keycloak

- name: setup nextcloud hosts
  hosts: nextcloud
  become: true
  roles:
   -  role: docker-nextcloud

- name: setup gitea hosts
  hosts: gitea
  become: true
  roles:
   -  role: docker-gitea
      vars:
        run_mode: prod

- name: setup wordpress hosts
  hosts: wordpress
  become: true
  roles:
  - role: docker-wordpress

- name: setup mediawiki hosts
  hosts: mediawiki
  become: true
  roles:
   -  role: docker-mediawiki

- name: setup mybb hosts
  hosts: mybb
  become: true
  roles:
   -  role: docker-mybb
      vars:
        mybb_domains: "{{domains.mybb}}"

- name: setup yourls hosts
  hosts: yourls
  become: true
  roles:
   -  role: docker-yourls

- name: setup mailu hosts
  hosts: mailu
  become: true
  roles:
   -  role: docker-mailu

- name: setup elk hosts
  hosts: elk
  become: true
  roles:
   -  role: docker-elk

- name: setup mastodon hosts
  hosts: mastodon
  become: true
  roles:
   -  role: docker-mastodon

- name: setup pixelfed hosts
  hosts: pixelfed
  become: true
  roles:
   -  role: docker-pixelfed

- name: setup peertube hosts
  hosts: peertube
  become: true
  roles:
   -  role: docker-peertube

- name: setup bigbluebutton hosts
  hosts: bigbluebutton
  become: true
  roles:
   -  role: docker-bigbluebutton
      vars:
        domain: "{{domains.bigbluebutton}}"

- name: setup funkwhale hosts
  hosts: funkwhale
  become: true
  roles:
   -  role: docker-funkwhale

- name: setup roulette-wheel hosts
  hosts: roulette-wheel
  become: true
  roles:
   -  role: docker-roulette-wheel

- name: setup joomla hosts
  hosts: joomla
  become: true
  roles:
   -  role: docker-joomla

- name: setup attendize
  hosts: attendize
  become: true
  roles:
   -  role: docker-attendize

- name: setup baserow hosts
  hosts: baserow
  become: true
  roles:
   -  role: docker-baserow

- name: setup listmonk
  hosts: listmonk
  become: true
  roles:
   -  role: docker-listmonk

- name: setup discourse
  hosts: discourse
  become: true
  roles:
   -  role: docker-discourse

- name: setup matrix
  hosts: matrix
  become: true
  roles:
   -  role: docker-matrix-ansible
      when: applications.matrix.role == 'ansible'
   -  role: docker-matrix-compose
      when: applications.matrix.role == 'compose'

- name: setup open project instances
  hosts: openproject
  become: true
  roles:
   -  role: docker-openproject

- name: setup gitlab hosts
  hosts: gitlab
  become: true
  roles:
   -  role: docker-gitlab

- name: setup akaunting hosts
  hosts: akaunting
  become: true
  roles:
   -  role: docker-akaunting

- name: setup moodle instance
  hosts: moodle
  become: true
  roles:
   -  role: docker-moodle

- name: setup taiga instance
  hosts: taiga
  become: true
  roles:
   -  role: docker-taiga

- name: setup friendica hosts
  hosts: friendica
  become: true
  roles:
   -  role: docker-friendica

- name: setup portfolio
  hosts: portfolio
  become: true
  roles:
   -  role: docker-portfolio

- name: setup bluesky
  hosts: bluesky
  become: true
  roles:
   -  role: docker-bluesky

- name: setup PHPMyAdmin
  hosts: phpmyadmin
  become: true
  roles:
   -  role: docker-phpmyadmin

- name: setup SNIPE-IT
  hosts: snipe_it
  become: true
  roles:
   -  role: docker-snipe_it

- name: setup sphinx
  hosts: sphinx
  become: true
  roles:
   -  role: docker-sphinx

# Native Webserver Roles
- name: setup nginx-serve-htmls
  hosts: nginx-serve-htmls
  become: true
  roles:
   -  role: nginx-serve-html
      vars:
        domain: "{{primary_domain}}"

- name: setup redirect hosts
  hosts: redirect
  become: true
  roles:
   -  role: nginx-redirect-domain
      vars:
        domain_mappings: "{{redirect_domain_mappings}}"

- name: setup www redirect 
  hosts: www_redirect
  become: true
  roles:
   -  role: nginx-redirect-www

- import_playbook: playbook.destructor.yml