---

# If using a MAAS based POD deployment then copy over an apache configuration
# that forwards to the various UIs
- name: Ensure CORD Apache Configuration
  become: yes
  copy:
    src: files/cord-http.conf
    dest: /etc/apache2/conf-available/cord-http.conf
    owner: root
    group: root
    mode: 0644
  notify: reload apache2
  when: on_maas

- name: Ensure Modules
  become: yes
  command: a2enmod {{ item }}
  register: mod_proxy
  changed_when: mod_proxy.stdout.find('already enabled') == -1
  notify: reload apache2
  when: on_maas
  with_items:
    - proxy
    - proxy_http
    - proxy_wstunnel
    - rewrite
    - headers

- name: Enable CORD Apache Configuration
  become: yes
  command: a2enconf cord-http
  register: en_cord_http
  changed_when: en_cord_http.stdout.find('already enabled') == -1
  notify: reload apache2
  when: on_maas
