- name: Install distribution specific package needs
  include: "{{ item }}"
  static: no
  with_first_found:
    - "setup/{{ ansible_distribution }}.yaml"
    - "setup/{{ ansible_os_family }}.yaml"
    - "setup/default.yaml"

- name: Allow k8s cluster range to talk to k8s api
  iptables:
    state: present
    action: insert
    chain: INPUT
    ip_version: ipv4
    protocol: tcp
    source: "10.244.0.0/16"
    destination_port: 6443
    jump: ACCEPT
  become: yes

- name: Run kata setup.sh
  args:
    executable: /bin/bash
    chdir: "{{ zuul.project.src_dir }}"
  shell: |
    set -x
    if [ -d '/usr/lib/go-1.10/bin' ] ; then
        export PATH=$PATH:/usr/lib/go-1.10/bin
    fi
    export CI=true
    export GOPATH=$HOME
    export PATH=${GOPATH}/bin:$PATH
    .ci/setup.sh

- name: Install distribution specific package needs
  include: "{{ item }}"
  static: no
  with_first_found:
    - "setup/{{ ansible_distribution }}.yaml"
    - "setup/{{ ansible_os_family }}.yaml"
    - "setup/default.yaml"

- name: Allow k8s cluster range to talk to k8s api
  iptables:
    state: present
    action: insert
    chain: INPUT
    ip_version: ipv4
    protocol: tcp
    source: "10.244.0.0/16"
    destination_port: 6443
    jump: ACCEPT
  become: yes

- name: Configure git user for kata patch application
  shell: |
    git config --global user.email "zuul@test.machine"
    git config --global user.name "Zuul CI"
  tags:
    - skip_ansible_lint

- name: Run kata setup.sh
  args:
    executable: /bin/bash
    chdir: "{{ zuul.project.src_dir }}"
  shell: |
    set -x
    if [ -d '/usr/lib/go-1.10/bin' ] ; then
        export PATH=$PATH:/usr/lib/go-1.10/bin
    fi
    export CI=true
    export GOPATH=$HOME
    export PATH=${GOPATH}/bin:$PATH
    .ci/setup.sh

Configure git user details for kata
Configure git user details for kata

The kata test jobs apply patches to git repos with git. This creates
commits which requires you have a user configured in git. Set up a
global git config with generic Zuul identify info in it to address this.

More details at https://github.com/kata-containers/ci/issues/65

Change-Id: I08a6a13501fad92cd290f0a9e5559f61b11d7fab
