--- - hosts: coe-hosts vars: gopath: "{{ ansible_env.HOME }}/go" coe_path: "{{ gopath }}/src/git.opendaylight.org/gerrit/p/coe.git" environment: PATH: "{{ ansible_env.HOME }}:/usr/local/go/bin:{{ ansible_env.HOME }}/go/bin:/usr/local/go/bin:/usr/bin:/bin" GOPATH: "{{ gopath }}" GOROOT: /usr/local/go tasks: - name: Make CNI config directory file: path: /etc/cni/net.d state: directory become: true - name: Generate cni config template: src: "{{ conf_path }}" dest: /etc/cni/net.d/odlovs-cni.conf become: true - name: Create $HOME/go/bin file: path: "{{ ansible_env.HOME }}/go/bin" state: directory - name: Show gerrit details run_once: true debug: msg: - "Fetch COE git repository https://git.opendaylight.org/gerrit/p/coe.git" - "gerrit_branch {{ gerrit_branch }}" - "gerrit_refspec {{ gerrit_refspec }}" - name: Fetch COE git repository git: repo: "https://git.opendaylight.org/gerrit/p/coe.git" version: "{{ gerrit_branch }}" refspec: "{{ gerrit_refspec }}" dest: "{{ coe_path }}" - name: List COE git repository recent patches run_once: true shell: "git --no-pager log --pretty=format:'%h %<(30)%ad %<(30)%cd %<(20,trunc)%an%d %s' -n10" args: chdir: "{{ coe_path }}" register: git_log_output - name: git log header run_once: true debug: msg="Hash Author Date Commit Date Author Subject" - name: git log output run_once: true debug: var=git_log_output.stdout_lines - name: Build odlovs-cni shell: GO111MODULE=on go build args: chdir: "{{ coe_path }}/odlCNIPlugin/odlovs-cni" creates: "{{ coe_path }}/odlCNIPlugin/odlovs-cni/odlovs-cni" - name: Install odlovs-cni copy: src: "{{ coe_path }}/odlCNIPlugin/odlovs-cni/odlovs-cni" dest: "/opt/cni/bin/odlovs-cni" remote_src: true mode: 0755 become: true - hosts: coe-master vars: gopath: "{{ ansible_env.HOME}}/go" coe_path: "{{ gopath }}/src/git.opendaylight.org/gerrit/p/coe.git" environment: PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin:{{ ansible_env.HOME }}/go/bin:/usr/local/go/bin:{{ gopath }}/bin:/usr/bin:/bin" GOPATH: "{{ gopath }}" GOROOT: /usr/local/go tasks: - name: Build watcher shell: GO111MODULE=on go build args: chdir: "{{ coe_path }}/watcher" creates: "{{ coe_path }}/watcher/watcher" - name: Copy watcher to /usr/local/bin copy: src: "{{ coe_path }}/watcher/watcher" dest: /usr/local/bin/watcher mode: 0755 remote_src: true become: true - name: Copy coe.yaml to /etc copy: src: "{{ watcher_path }}" dest: /etc mode: 0755 remote_src: true become: true - hosts: coe-hosts tasks: - name: Set OVS Manager shell: ovs-vsctl set-manager tcp:{{ manager_ip }}:{{ manager_port }} && touch /tmp/ovs-set-manager args: creates: /tmp/ovs-set-manager become: true - name: Enable auto-tunnelling shell: ovs-vsctl set O . other_config:local_ip={{ overlay_ip }} && touch /tmp/enable-auto-tunnel args: creates: /tmp/enable-auto-tunnel become: true - name: Enable docker in systemd systemd: name: docker daemon_reload: true enabled: true state: started become: true - hosts: coe-master tasks: - name: Disable swapfile shell: swapoff -a become: true - name: Run kubeadm init shell: kubeadm init --apiserver-advertise-address={{ k8s_advertise_address }} > /tmp/k8s-output args: creates: /tmp/k8s-output become: true - name: Create join script shell: echo "#!/bin/sh" > /tmp/join-k8s.sh && cat /tmp/k8s-output | grep "kubeadm join" | sed -e 's/^[[:space:]]*//g' >> /tmp/join-k8s.sh args: creates: /tmp/join-k8s.sh - name: Fetch join script fetch: src: /tmp/join-k8s.sh dest: /tmp/join-k8s.sh flat: true - name: Make kube directory file: path: "{{ ansible_env.HOME }}/.kube" state: directory - name: Copy kubeconfig copy: src: /etc/kubernetes/admin.conf dest: "{{ ansible_env.HOME }}/.kube/config" remote_src: true become: true - hosts: coe-master tasks: - name: Run watcher shell: nohup watcher odl /tmp/watcher.out 2>&1 & args: creates: /tmp/watcher.out - hosts: coe-minions tasks: - name: Disable swapfile shell: swapoff -a become: true - name: Copy join file copy: src: /tmp/join-k8s.sh dest: /tmp/join-k8s.sh mode: 0700 become: true - name: Join cluster shell: /tmp/join-k8s.sh become: true