use command instead of synchronize

This commit is contained in:
Smaine Kahlouch 2016-01-22 16:37:07 +01:00
parent 078b67c50f
commit cb59559835
8 changed files with 41 additions and 63 deletions

View file

@ -25,24 +25,34 @@ downloads:
dest: calico/bin/calicoctl
sha256: "{{ calico_checksum }}"
url: "{{ calico_download_url }}"
owner: "root"
mode: "0755"
- name: calico-plugin
dest: calico/bin/calico
sha256: "{{ calico_plugin_checksum }}"
url: "{{ calico_plugin_download_url }}"
owner: "root"
mode: "0755"
- name: etcd
dest: "etcd/etcd-{{ etcd_version }}-linux-amd64.tar.gz"
sha256: "{{ etcd_checksum }}"
url: "{{ etcd_download_url }}"
unarchive: true
owner: "etcd"
mode: "0755"
- name: kubernetes-kubelet
dest: kubernetes/bin/kubelet
sha256: "{{kubelet_checksum}}"
url: "{{ kube_download_url }}/kubelet"
owner: "kube"
mode: "0755"
- name: kubernetes-kubectl
dest: kubernetes/bin/kubectl
sha256: "{{kubectl_checksum}}"
url: "{{ kube_download_url }}/kubectl"
owner: "kube"
mode: "0755"

View file

@ -1,4 +1,19 @@
---
- name: Create system kube user
user:
name=kube
comment="Kubernetes user"
shell=/sbin/nologin
state=present
system=yes
groups={{ kube_cert_group }}
- name: Create etcd user
user:
name: etcd
shell: /bin/nologin
home: /var/lib/etcd
- name: Create dest directories
file: path={{local_release_dir}}/{{item.dest|dirname}} state=directory recurse=yes
with_items: downloads
@ -8,6 +23,8 @@
url: "{{item.url}}"
dest: "{{local_release_dir}}/{{item.dest}}"
sha256sum: "{{item.sha256 | default(omit)}}"
owner: "{{ item.owner|default(omit) }}"
mode: "{{ item.mode|default(omit) }}"
with_items: downloads
- name: Extract archives

View file

@ -1,16 +1,8 @@
---
- name: INSTALL | Create etcd user
user: name=etcd shell=/bin/nologin home=/var/lib/etcd
- name: INSTALL | Copy etcd binaries
synchronize:
src: "{{ etcd_bin_dir }}/{{ item }}"
dest: "{{ bin_dir }}"
times: yes
archive: no
set_remote_user: false
delegate_to: "{{ inventory_hostname }}"
command: cp -pf "{{ etcd_bin_dir }}/{{ item }}" "{{ bin_dir }}"
with_items:
- etcdctl
- etcd
changed_when: false
notify: restart etcd

View file

@ -5,17 +5,9 @@
dest: /etc/bash_completion.d/kubectl.sh
- name: Install kubectl binary
synchronize:
src: "{{ local_release_dir }}/kubernetes/bin/kubectl"
dest: "{{ bin_dir }}/kubectl"
archive: no
checksum: yes
times: yes
set_remote_user: false
delegate_to: "{{ inventory_hostname }}"
- name: Perms kubectl binary
file: path={{ bin_dir }}/kubectl owner=kube mode=0755 state=file
command: cp -pf "{{ local_release_dir }}/kubernetes/bin/kubectl" "{{ bin_dir }}/kubectl"
changed_when: false
notify: restart kubelet
- name: populate users for basic auth in API
lineinfile:
@ -46,8 +38,7 @@
template:
src: manifests/kube-apiserver.manifest.j2
dest: "{{ kube_manifest_dir }}/kube-apisever.manifest"
notify:
- restart kubelet
notify: restart kubelet
- meta: flush_handlers

View file

@ -18,34 +18,16 @@
notify: restart kubelet
- name: install | Install kubelet binary
synchronize:
src: "{{ local_release_dir }}/kubernetes/bin/kubelet"
dest: "{{ bin_dir }}/kubelet"
times: yes
archive: no
set_remote_user: false
delegate_to: "{{ inventory_hostname }}"
notify:
- restart kubelet
- name: install | Perms kubelet binary
file: path={{ bin_dir }}/kubelet owner=kube mode=0755 state=file
command: cp -pf "{{ local_release_dir }}/kubernetes/bin/kubelet" "{{ bin_dir }}/kubelet"
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
synchronize:
src: "{{ local_release_dir }}/calico/bin/calico"
dest: "/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/calico"
times: yes
archive: no
set_remote_user: false
delegate_to: "{{ inventory_hostname }}"
command: cp -pf "{{ 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
- name: install | Perms calico plugin binary
file: path=/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/calico owner=kube mode=0755 state=file
when: kube_network_plugin == "calico"

View file

@ -12,15 +12,6 @@
- name: certs | create system kube-cert groups
group: name={{ kube_cert_group }} state=present system=yes
- name: create system kube user
user:
name=kube
comment="Kubernetes user"
shell=/sbin/nologin
state=present
system=yes
groups={{ kube_cert_group }}
- include: secrets.yml
tags:
- secrets

View file

@ -17,7 +17,7 @@
- name: "Identify init system"
shell: >
$(pgrep systemd > /dev/null && systemctl status network > /dev/null);
$(pgrep systemd > /dev/null && systemctl status network.target > /dev/null);
if [ $? -eq 0 ] ; then
echo systemd;
else

View file

@ -1,12 +1,7 @@
---
- name: Calico | Install calicoctl bin
synchronize:
src: "{{ local_release_dir }}/calico/bin/calicoctl"
dest: "{{ bin_dir }}/calicoctl"
archive: no
times: yes
set_remote_user: false
delegate_to: "{{ inventory_hostname }}"
command: cp -pf "{{ local_release_dir }}/calico/bin/calicoctl" "{{ bin_dir }}/calicoctl"
changed_when: false
notify: restart calico-node
- name: Calico | install calicoctl