Skip to content
Snippets Groups Projects
Commit 4984b57a authored by Smaine Kahlouch's avatar Smaine Kahlouch
Browse files

use rsync instead of command

parent 87d8d87c
No related branches found
No related tags found
No related merge requests found
......@@ -5,8 +5,7 @@
dest: /lib/systemd/system/etcd.service
backup: yes
when: init_system == "systemd"
notify:
- restart systemd-etcd
notify: restart systemd-etcd
- name: Configure | Write calico-node initd script
template:
......@@ -24,4 +23,7 @@
notify: restart etcd
- name: Configure | Ensure etcd is running
service: name=etcd state=started enabled=yes
service:
name: etcd
state: started
enabled: yes
---
- name: INSTALL | Copy etcd binaries
command: cp -pf "{{ etcd_bin_dir }}/{{ item }}" "{{ bin_dir }}"
with_items:
- etcdctl
- etcd
- name: Install | Copy etcd binary
command: rsync -piu "{{ etcd_bin_dir }}/etcd" "{{ bin_dir }}/etcd"
register: etcd_copy
changed_when: false
- name: Install | Copy etcdctl binary
command: rsync -piu "{{ etcd_bin_dir }}/etcdctl" "{{ bin_dir }}/etcdctl"
changed_when: false
notify: restart etcd
---
- include: install.yml
- include: configure.yml
- name: Restart etcd if binary changed
command: /bin/true
notify: restart etcd
when: etcd_copy.stdout_lines
......@@ -7,12 +7,14 @@
src: kubectl_bash_completion.sh
dest: /etc/bash_completion.d/kubectl.sh
- name: Install kubernetes binaries
command: cp -pf "{{ local_release_dir }}/kubernetes/bin/{{ item }}" "{{ bin_dir }}/{{ item }}"
- name: Copy kube-apiserver binary
command: rsync -piu "{{ local_release_dir }}/kubernetes/bin/kube-apiserver" "{{ bin_dir }}/kube-apiserver"
register: kube_apiserver_copy
changed_when: false
- name: Copy kubectl binary
command: rsync -piu "{{ local_release_dir }}/kubernetes/bin/kubectl" "{{ bin_dir }}/kubectl"
changed_when: false
with_items:
- kubectl
- kube-apiserver
- name: populate users for basic auth in API
lineinfile:
......@@ -55,7 +57,11 @@
mode: 755
backup: yes
when: init_system == "sysvinit" and ansible_os_family == "Debian"
- name: Restart apiserver
command: /bin/true
notify: restart kube-apiserver
changed_when: is_gentoken_calico|default(false) or kube_apiserver_copy.stdout_lines
- name: Allow apiserver to bind on both secure and insecure ports
shell: setcap cap_net_bind_service+ep {{ bin_dir }}/kube-apiserver
......
......@@ -15,16 +15,15 @@
notify: restart kubelet
- name: install | Install kubelet binary
command: cp -pf "{{ local_release_dir }}/kubernetes/bin/kubelet" "{{ bin_dir }}/kubelet"
command: rsync -piu "{{ local_release_dir }}/kubernetes/bin/kubelet" "{{ bin_dir }}/kubelet"
register: kubelet_copy
changed_when: false
notify: restart kubelet
- name: install | Calico-plugin | Directory
file: path=/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/ state=directory
when: kube_network_plugin == "calico"
- name: install | Calico-plugin | Binary
command: cp -pf "{{ local_release_dir }}/calico/bin/calico" "/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/calico"
command: rsync -piu "{{ local_release_dir }}/calico/bin/calico" "/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/calico"
when: kube_network_plugin == "calico"
changed_when: false
notify: restart kubelet
......@@ -45,6 +45,11 @@
src: manifests/kube-proxy.manifest.j2
dest: "{{ kube_manifest_dir }}/kube-proxy.manifest"
- name: Restart kubelet if binary changed
command: /bin/true
notify: restart kubelet
when: kubelet_copy.stdout_lines
- name: Enable kubelet
service:
name: kubelet
......
......@@ -26,9 +26,12 @@
always_run: True
register: init_system_output
changed_when: False
tags: always
- set_fact:
init_system: "{{ init_system_output.stdout }}"
always_run: True
tags: always
- name: Install python-apt for Debian distribs
shell: apt-get install -y python-apt
......
---
- name: Calico | Install calicoctl bin
command: cp -pf "{{ local_release_dir }}/calico/bin/calicoctl" "{{ bin_dir }}/calicoctl"
command: rsync -piu "{{ local_release_dir }}/calico/bin/calicoctl" "{{ bin_dir }}/calicoctl"
register: calico_copy
changed_when: false
notify: restart calico-node
- name: Calico | install calicoctl
file: path={{ bin_dir }}/calicoctl mode=0755 state=file
......@@ -71,6 +71,12 @@
- name: Calico | Enable calico-node
service: name=calico-node enabled=yes state=started
- name: Calico | Restart calico if binary changed
service:
name: calico-node
state: restarted
when: calico_copy.stdout_lines
- name: Calico | Disable node mesh
shell: calicoctl bgp node-mesh off
environment:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment