---

# configuring awx cluster

- name: 'apply awx config update to {{ host | default("all") }}'
  hosts: '{{ host | default("kube_control_plane") }}'
  serial: "{{ serial_number | default(10) }}"
  vars:
    ansible_ssh_host: "{{ stage_server_domain }}"

  pre_tasks:
    - name: "Check if ansible version is at least {{ ansible_minimal_version }}"
      assert:
        that:
          - ansible_version.string is version(ansible_minimal_version, ">=")
        msg: "The ansible version has to be at least {{ ansible_minimal_version }}"
      tags:
        - always

    - name: "Import autodiscover pre-tasks"
      import_tasks: tasks/autodiscover_pre_tasks.yml
      tags:
        - always

  roles:
    - role: kubernetes/awx
      when: kubernetes_with_awx | default(false)
      tags:
        - never # shouldn't be done automatically due to removal logic
        - update_awx_config
