---
- name: 1. Create a cmoa namespace
  kubernetes.core.k8s:
    name: "{{ cmoa_namespace }}"
    api_version: v1
    kind: Namespace
    state: present

- name: 2. Create secret
  kubernetes.core.k8s:
    state: present
    namespace: "{{ item }}"     
    src: "{{ role_path }}/files/00-default/secret_{{ REPO }}.yaml"
    apply: yes
  with_items:
    - "{{ cmoa_namespace }}"
    - default

- name: 3. kubeconfig check
  shell: "echo $KUBECONFIG"
  register: kubeconfig

- name: 4. Patch default sa
  shell: "{{ role_path }}/files/00-default/sa_patch.sh {{ kubeconfig.stdout }}"

- name: 5. Master IP Setting
  command: "{{ role_path }}/files/ip_change {{ before_ip }} {{ ansible_default_ipv4.address }} {{ role_path }}/files"

- name: 6. CloudMOA Version Change
  command: "{{ role_path }}/files/rel_change {{ before_version }} {{ cmoa_version }} {{ role_path }}/files"
