use rsync instead of copy

This commit is contained in:
Smaine Kahlouch 2016-01-23 17:20:33 +01:00
parent 95cd00065a
commit 90037f3aff
8 changed files with 42 additions and 26 deletions

@ -1 +1 @@
Subproject commit b5015aed8ff5eed9c325911205cfbb23ad0e57be Subproject commit d6df09a89721d98e2969a8abf29b4eb5e787fca6

View file

@ -1,8 +1,9 @@
--- ---
- name: INSTALL | Copy etcd binaries - name: Install | Copy etcd binary
command: cp -pf "{{ etcd_bin_dir }}/{{ item }}" "{{ bin_dir }}" command: rsync -piu "{{ etcd_bin_dir }}/etcd" "{{ bin_dir }}/etcd"
with_items: register: etcd_copy
- etcdctl changed_when: false
- etcd
- name: Install | Copy etcdctl binary
command: rsync -piu "{{ etcd_bin_dir }}/etcdctl" "{{ bin_dir }}/etcdctl"
changed_when: false changed_when: false
notify: restart etcd

View file

@ -1,3 +1,8 @@
--- ---
- include: install.yml - include: install.yml
- include: configure.yml - include: configure.yml
- name: Restart etcd if binary changed
command: /bin/true
notify: restart etcd
when: etcd_copy.stdout_lines

View file

@ -7,12 +7,14 @@
src: kubectl_bash_completion.sh src: kubectl_bash_completion.sh
dest: /etc/bash_completion.d/kubectl.sh dest: /etc/bash_completion.d/kubectl.sh
- name: Install kubernetes binaries - name: Copy kube-apiserver binary
command: cp -pf "{{ local_release_dir }}/kubernetes/bin/{{ item }}" "{{ bin_dir }}/{{ item }}" 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 changed_when: false
with_items:
- kubectl
- kube-apiserver
- name: populate users for basic auth in API - name: populate users for basic auth in API
lineinfile: lineinfile:
@ -47,15 +49,10 @@
when: init_system == "systemd" when: init_system == "systemd"
notify: restart systemd-kube-apiserver notify: restart systemd-kube-apiserver
- name: install | Write kube-apiserver initd script - name: Restart apiserver
template: command: /bin/true
src: "deb-kube-apiserver.initd.j2"
dest: "/etc/init.d/kube-apiserver"
owner: root
mode: 755
backup: yes
when: init_system == "sysvinit" and ansible_os_family == "Debian"
notify: restart kube-apiserver 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 - name: Allow apiserver to bind on both secure and insecure ports
shell: setcap cap_net_bind_service+ep {{ bin_dir }}/kube-apiserver shell: setcap cap_net_bind_service+ep {{ bin_dir }}/kube-apiserver

View file

@ -15,16 +15,15 @@
notify: restart kubelet notify: restart kubelet
- name: install | Install kubelet binary - 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 changed_when: false
notify: restart kubelet
- name: install | Calico-plugin | Directory - name: install | Calico-plugin | Directory
file: path=/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/ state=directory file: path=/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/ state=directory
when: kube_network_plugin == "calico" when: kube_network_plugin == "calico"
- name: install | Calico-plugin | Binary - 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" when: kube_network_plugin == "calico"
changed_when: false changed_when: false
notify: restart kubelet

View file

@ -45,6 +45,11 @@
src: manifests/kube-proxy.manifest.j2 src: manifests/kube-proxy.manifest.j2
dest: "{{ kube_manifest_dir }}/kube-proxy.manifest" 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 - name: Enable kubelet
service: service:
name: kubelet name: kubelet

View file

@ -26,9 +26,12 @@
always_run: True always_run: True
register: init_system_output register: init_system_output
changed_when: False changed_when: False
tags: always
- set_fact: - set_fact:
init_system: "{{ init_system_output.stdout }}" init_system: "{{ init_system_output.stdout }}"
always_run: True
tags: always
- name: Install python-apt for Debian distribs - name: Install python-apt for Debian distribs
shell: apt-get install -y python-apt shell: apt-get install -y python-apt

View file

@ -1,8 +1,8 @@
--- ---
- name: Calico | Install calicoctl bin - 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 changed_when: false
notify: restart calico-node
- name: Calico | install calicoctl - name: Calico | install calicoctl
file: path={{ bin_dir }}/calicoctl mode=0755 state=file file: path={{ bin_dir }}/calicoctl mode=0755 state=file
@ -71,6 +71,12 @@
- name: Calico | Enable calico-node - name: Calico | Enable calico-node
service: name=calico-node enabled=yes state=started 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 - name: Calico | Disable node mesh
shell: calicoctl bgp node-mesh off shell: calicoctl bgp node-mesh off
environment: environment: