Browse Source

Fix systemd reload and calico unit

pull/97/head
ant31 8 years ago
committed by Antoine Legrand
parent
commit
56b92812fa
11 changed files with 39 additions and 31 deletions
  1. 2
      roles/docker/tasks/main.yml
  2. 7
      roles/etcd/handlers/main.yml
  3. 8
      roles/etcd/tasks/configure.yml
  4. 10
      roles/etcd/tasks/main.yml
  5. 2
      roles/etcd/templates/etcd.service.j2
  6. 17
      roles/kubernetes/master/handlers/main.yml
  7. 5
      roles/kubernetes/master/tasks/main.yml
  8. 7
      roles/kubernetes/node/handlers/main.yml
  9. 5
      roles/kubernetes/node/tasks/main.yml
  10. 5
      roles/network_plugin/tasks/calico.yml
  11. 2
      roles/network_plugin/templates/calico/calico-node.service.j2

2
roles/docker/tasks/main.yml

@ -47,6 +47,8 @@
with_items: docker_package_info.pkgs
when: docker_package_info.pkgs|length > 0
- meta: flush_handlers
- name: ensure docker service is started and enabled
service:
name: "{{ item }}"

7
roles/etcd/handlers/main.yml

@ -1,14 +1,15 @@
---
- name: restart systemd-etcd
- name: restart etcd
command: /bin/true
notify:
- reload systemd
- restart etcd
- reload etcd
- name: reload systemd
command: systemctl daemon-reload
when: init_system == "systemd"
- name: restart etcd
- name: reload etcd
service:
name: etcd
state: restarted

8
roles/etcd/tasks/configure.yml

@ -7,7 +7,7 @@
when: init_system == "systemd"
notify: restart systemd-etcd
- name: Configure | Write calico-node initd script
- name: Configure | Write etcd initd script
template:
src: deb-etcd.initd.j2
dest: /etc/init.d/etcd
@ -21,9 +21,3 @@
src: etcd.j2
dest: /etc/etcd.env
notify: restart etcd
- name: Configure | Ensure etcd is running
service:
name: etcd
state: started
enabled: yes

10
roles/etcd/tasks/main.yml

@ -6,3 +6,13 @@
command: /bin/true
notify: restart etcd
when: etcd_copy.stdout_lines
# reload systemd before starting service
- meta: flush_handlers
- name: Ensure etcd is running
service:
name: etcd
state: started
enabled: yes

2
roles/etcd/templates/etcd.service.j2

@ -1,6 +1,6 @@
[Unit]
Description=etcd
Conflicts=etcd.service
[Service]
User=etcd

17
roles/kubernetes/master/handlers/main.yml

@ -1,25 +1,16 @@
---
- name: restart systemd-kubelet
command: /bin/true
notify:
- reload systemd
- restart kubelet
- name: restart systemd-kube-apiserver
- name: restart kube-apiserver
command: /bin/true
notify:
- reload systemd
- restart kube-apiserver
- reload kube-apiserver
- name: reload systemd
command: systemctl daemon-reload
when: init_system == "systemd"
- name: restart kubelet
service:
name: kubelet
state: restarted
- name: restart kube-apiserver
- name: reload kube-apiserver
service:
name: kube-apiserver
state: restarted

5
roles/kubernetes/master/tasks/main.yml

@ -47,7 +47,7 @@
dest: "/etc/systemd/system/kube-apiserver.service"
backup: yes
when: init_system == "systemd"
notify: restart systemd-kube-apiserver
notify: restart kube-apiserver
- name: install | Write kube-apiserver initd script
template:
@ -80,6 +80,9 @@
notify: restart kube-apiserver
changed_when: is_gentoken_calico|default(false)
# reload-systemd
- meta: flush_handlers
- name: Enable apiserver
service:
name: kube-apiserver

7
roles/kubernetes/node/handlers/main.yml

@ -1,18 +1,19 @@
---
- name: reload systemd
command: systemctl daemon-reload
when: init_system == "systemd"
- name: restart systemd-kubelet
- name: restart kubelet
command: /bin/true
notify:
- reload systemd
- restart kubelet
- reload kubelet
- name: set is_gentoken_calico fact
set_fact:
is_gentoken_calico: true
- name: restart kubelet
- name: reload kubelet
service:
name: kubelet
state: restarted

5
roles/kubernetes/node/tasks/main.yml

@ -41,7 +41,7 @@
- restart kubelet
- name: Write proxy manifest
template:
template:
src: manifests/kube-proxy.manifest.j2
dest: "{{ kube_manifest_dir }}/kube-proxy.manifest"
@ -50,6 +50,9 @@
notify: restart kubelet
when: kubelet_copy.stdout_lines
# reload-systemd
- meta: flush_handlers
- name: Enable kubelet
service:
name: kubelet

5
roles/network_plugin/tasks/calico.yml

@ -13,7 +13,8 @@
dest: /usr/bin/calicoctl
state: link
- wait_for:
- name: Calico | wait for etcd
wait_for:
port: 2379
when: inventory_hostname in groups['kube-master']
@ -68,6 +69,8 @@
when: init_system == "sysvinit" and ansible_os_family == "RedHat"
notify: restart calico-node
- meta: flush_handlers
- name: Calico | Enable calico-node
service: name=calico-node enabled=yes state=started

2
roles/network_plugin/templates/calico/calico-node.service.j2

@ -2,7 +2,7 @@
Description=Calico per-node agent
Documentation=https://github.com/projectcalico/calico-docker
Requires=docker.service
After=docker.service etcd2.service
After=docker.service etcd.service
[Service]
User=root

Loading…
Cancel
Save