INTTEST-61 lispflowmapping failing
[integration/test.git] / csit / variables / coe / coe_play.yaml
1 ---
2
3 - hosts: coe-hosts
4   vars:
5     gopath: "{{ ansible_env.HOME }}/go"
6     coe_path: "{{ gopath }}/src/git.opendaylight.org/gerrit/p/coe.git"
7   environment:
8     PATH: "{{ ansible_env.HOME }}:/usr/local/go/bin:{{ ansible_env.HOME }}/go/bin:/usr/local/go/bin:/usr/bin:/bin"
9     GOPATH: "{{ gopath }}"
10     GOROOT: /usr/local/go
11   tasks:
12     - name: Make CNI config directory
13       file:
14         path: /etc/cni/net.d
15         state: directory
16       become: true
17     - name: Generate cni config
18       template:
19         src: "{{ conf_path }}"
20         dest: /etc/cni/net.d/odlovs-cni.conf
21       become: true
22     - name: Create $HOME/go/bin
23       file:
24         path: "{{ ansible_env.HOME }}/go/bin"
25         state: directory
26     - name: Show gerrit details
27       run_once: true
28       debug:
29         msg:
30           - "Fetch COE git repository https://git.opendaylight.org/gerrit/p/coe.git"
31           - "gerrit_branch {{ gerrit_branch }}"
32           - "gerrit_refspec {{ gerrit_refspec }}"
33     - name: Fetch COE git repository
34       git:
35         repo: "https://git.opendaylight.org/gerrit/p/coe.git"
36         version: "{{ gerrit_branch }}"
37         refspec: "{{ gerrit_refspec }}"
38         dest: "{{ coe_path }}"
39     - name: List COE git repository recent patches
40       run_once: true
41       shell: "git --no-pager log --pretty=format:'%h %<(30)%ad %<(30)%cd %<(20,trunc)%an%d %s' -n10"
42       args:
43         chdir: "{{ coe_path }}"
44       register: git_log_output
45     - name: git log header
46       run_once: true
47       debug:
48         msg="Hash    Author Date                    Commit Date                    Author               Subject"
49     - name: git log output
50       run_once: true
51       debug:
52         var=git_log_output.stdout_lines
53     - name: Build odlovs-cni
54       shell: GO111MODULE=on go build
55       args:
56         chdir: "{{ coe_path }}/odlCNIPlugin/odlovs-cni"
57         creates: "{{ coe_path }}/odlCNIPlugin/odlovs-cni/odlovs-cni"
58     - name: Install odlovs-cni
59       copy:
60         src: "{{ coe_path }}/odlCNIPlugin/odlovs-cni/odlovs-cni"
61         dest: "/opt/cni/bin/odlovs-cni"
62         remote_src: true
63         mode: 0755
64       become: true
65
66 - hosts: coe-master
67   vars:
68     gopath: "{{ ansible_env.HOME}}/go"
69     coe_path: "{{ gopath }}/src/git.opendaylight.org/gerrit/p/coe.git"
70   environment:
71     PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin:{{ ansible_env.HOME }}/go/bin:/usr/local/go/bin:{{ gopath }}/bin:/usr/bin:/bin"
72     GOPATH: "{{ gopath }}"
73     GOROOT: /usr/local/go
74   tasks:
75     - name: Build watcher
76       shell: GO111MODULE=on go build
77       args:
78         chdir: "{{ coe_path }}/watcher"
79         creates: "{{ coe_path }}/watcher/watcher"
80     - name: Copy watcher to /usr/local/bin
81       copy:
82         src: "{{ coe_path }}/watcher/watcher"
83         dest: /usr/local/bin/watcher
84         mode: 0755
85         remote_src: true
86       become: true
87     - name: Copy coe.yaml to /etc
88       copy:
89         src: "{{ watcher_path }}"
90         dest: /etc
91         mode: 0755
92         remote_src: true
93       become: true
94
95 - hosts: coe-hosts
96   tasks:
97     - name: Set OVS Manager
98       shell: ovs-vsctl set-manager tcp:{{ manager_ip }}:{{ manager_port }} && touch /tmp/ovs-set-manager
99       args:
100         creates: /tmp/ovs-set-manager
101       become: true
102     - name: Enable auto-tunnelling
103       shell: ovs-vsctl set O . other_config:local_ip={{ overlay_ip }} && touch /tmp/enable-auto-tunnel
104       args:
105         creates: /tmp/enable-auto-tunnel
106       become: true
107     - name: Enable docker in systemd
108       systemd:
109         name: docker
110         daemon_reload: true
111         enabled: true
112         state: started
113       become: true
114
115
116 - hosts: coe-master
117   tasks:
118     - name: Disable swapfile
119       shell: swapoff -a
120       become: true
121     - name: Run kubeadm init
122       shell: kubeadm init --apiserver-advertise-address={{ k8s_advertise_address }} > /tmp/k8s-output
123       args:
124         creates: /tmp/k8s-output
125       become: true
126     - name: Create join script
127       shell: echo "#!/bin/sh" > /tmp/join-k8s.sh && cat /tmp/k8s-output | grep "kubeadm join" | sed -e 's/^[[:space:]]*//g' >> /tmp/join-k8s.sh
128       args:
129         creates: /tmp/join-k8s.sh
130     - name: Fetch join script
131       fetch:
132         src: /tmp/join-k8s.sh
133         dest: /tmp/join-k8s.sh
134         flat: true
135     - name: Make kube directory
136       file:
137         path: "{{ ansible_env.HOME }}/.kube"
138         state: directory
139     - name: Copy kubeconfig
140       copy:
141         src: /etc/kubernetes/admin.conf
142         dest: "{{ ansible_env.HOME }}/.kube/config"
143         remote_src: true
144       become: true
145
146 - hosts: coe-master
147   tasks:
148     - name: Run watcher
149       shell: nohup watcher odl </dev/null >/tmp/watcher.out 2>&1 &
150       args:
151         creates: /tmp/watcher.out
152
153 - hosts: coe-minions
154   tasks:
155     - name: Disable swapfile
156       shell: swapoff -a
157       become: true
158     - name: Copy join file
159       copy:
160         src: /tmp/join-k8s.sh
161         dest: /tmp/join-k8s.sh
162         mode: 0700
163       become: true
164     - name: Join cluster
165       shell: /tmp/join-k8s.sh
166       become: true