---
- name: CNI config directory
  file: path="/etc/cni/net.d" state="directory"

- name: CNI config file
  template: src="cni/romana-k8s-network" dest="/etc/cni/net.d/10-romana.conf"

- name: CNI plugin directory
  file: path="/opt/cni/bin" state="directory"

- name: CNI plugin executable
  command: install -o root -g root -m 0755 {{ kubernetes_x_dir }}/kube/CNI/romana /opt/cni/bin/romana

- name: CNI agent executable
  command: install -o root -g root -m 0755 {{ kubernetes_x_dir }}/kube/NetworkPolicy/k8s-listener.py /usr/local/lib/romana-kube-agent
  args:
    creates: /usr/local/lib/romana-kube-agent
  
- name: Configure IP address for agent
  replace: dest="/usr/local/lib/romana-kube-agent" regexp="192\.168\.0\.10" replace="{{ stack_nodes.Controller.mgmt_ip }}"

- name: Tweak rule names
  replace: dest="/usr/local/lib/romana-kube-agent" regexp="pani" replace="ROMANA"

- name: Install nsenter
  get_url: url="https://s3-us-west-1.amazonaws.com/romana-binaries/external/nsenter" dest="/usr/local/bin/" mode=0755

- name: Install jq
  apt: pkg="jq"



---
- name: CNI config directory
  file: path="/etc/cni/net.d" state="directory"

- name: CNI config file
  template: src="cni/romana-k8s-network" dest="/etc/cni/net.d/10-romana.conf"

- name: CNI plugin directory
  file: path="/opt/cni/bin" state="directory"

- name: CNI plugin executable
  command: install -o root -g root -m 0755 {{ kubernetes_x_dir }}/kube/CNI/romana /opt/cni/bin/romana

- name: CNI agent executable
  command: install -o root -g root -m 0755 {{ kubernetes_x_dir }}/kube/NetworkPolicy/k8s-listener.py /usr/local/lib/romana-kube-agent
  args:
    creates: /usr/local/lib/romana-kube-agent
  
- name: Configure IP address for agent
  replace: dest="/usr/local/lib/romana-kube-agent" regexp="192\.168\.0\.10" replace="{{ stack_nodes.Controller.mgmt_ip }}"

- name: Install nsenter
  get_url: url="https://s3-us-west-1.amazonaws.com/romana-binaries/external/nsenter" dest="/usr/local/bin/" mode=0755

- name: Install jq
  apt: pkg="jq"



Tweak not required with newer kube version
Tweak not required with newer kube version
