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