---
- name: setup firewall
  import_tasks: firewall.yml
- name: Deploy aci
  shell: oc apply -f {{ aci_deployment_yaml_file }}
  delegate_to: "{{ groups.oo_first_master.0 }}"
  run_once: True
- name: Run kube proxy, needed for ACI
  import_role:
    name: kube_proxy_and_dns
  run_once: True
- name: include lib_openshift
  include_role:
    name: lib_openshift
- name: Create namespaces
  oc_project:
    state: present
    name: "{{ item }}"
  with_items: "{{ annotate_namespace_list }}"
  delegate_to: "{{ groups.oo_first_master.0 }}"
- name: Get aci policy tenant name
  shell: grep -m1 'aci-policy-tenant' {{ aci_deployment_yaml_file }} | awk -F '\"' '{print $4}'
  register: tenant
  delegate_to: "{{ groups.oo_first_master.0 }}"
- name: Annotate namespace created
  command: >
    oc annotate namespace {{ item }}
    opflex.cisco.com/endpoint-group='{"policy-space":"{{ tenant.stdout }}", "name": "kubernetes|kube-system"}'
    --overwrite=True
  with_items: "{{ annotate_namespace_list }}"
  delegate_to: "{{ groups.oo_first_master.0 }}"
