---
- name: Master Additional Install Checkpoint Start
  hosts: all
  gather_facts: false
  tasks:
  - name: Set Master Additional install 'In Progress'
    run_once: true
    set_stats:
      data:
        installer_phase_master_additional:
          title: "Master Additional Install"
          playbook: "playbooks/openshift-master/additional_config.yml"
          status: "In Progress"
          start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"

- name: Additional master configuration
  hosts: oo_first_master
  vars:
    cockpit_plugins: "{{ osm_cockpit_plugins | default(['cockpit-kubernetes']) }}"
    etcd_urls: "{{ openshift_master_etcd_urls }}"
    omc_cluster_hosts: "{{ groups.oo_masters | join(' ')}}"
  roles:
  # TODO: this is currently required in order to schedule pods onto the masters, but
  #   should be moved into components once nodes are using dynamic config
  - role: openshift_sdn
    when: openshift_use_openshift_sdn | default(True) | bool
  - role: openshift_project_request_template
    when: openshift_project_request_template_manage
  - role: openshift_examples
    when: openshift_install_examples | default(true) | bool
  - role: openshift_cluster_autoscaler
    when: openshift_cluster_autoscaler_deploy | default(false) | bool
  - role: openshift_hosted_templates
  - role: openshift_manageiq
    when: openshift_use_manageiq | default(true) | bool
  - role: cockpit
    when:
    - not openshift_is_atomic | bool
    - openshift_deployment_type == 'openshift-enterprise'
    - osm_use_cockpit is undefined or osm_use_cockpit | bool
    - (openshift_deployment_subtype | default('')) != 'registry'
  - role: flannel_register
    when: openshift_use_flannel | default(false) | bool

- name: configure vsphere svc account
  hosts: oo_first_master
  tasks:
  - import_role:
      name: openshift_cloud_provider
      tasks_from: vsphere-svc.yml
    when:
    - openshift_cloudprovider_kind is defined
    - openshift_cloudprovider_kind == 'vsphere'
    - openshift_version is version_compare('3.9', '>=')

- name: update vsphere provider master config
  hosts: oo_masters_to_config
  tasks:
  - import_role:
      name: openshift_cloud_provider
      tasks_from: update-vsphere.yml
    when:
    - openshift_cloudprovider_kind is defined
    - openshift_cloudprovider_kind == 'vsphere'

- name: Master Additional Install Checkpoint End
  hosts: all
  gather_facts: false
  tasks:
  - name: Set Master Additional install 'Complete'
    run_once: true
    set_stats:
      data:
        installer_phase_master_additional:
          status: "Complete"
          end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
