Fix systemd reload and calico unit

This commit is contained in:
ant31 2016-01-25 02:01:25 +01:00 committed by Antoine Legrand
parent 2cbbcee351
commit 56b92812fa
11 changed files with 39 additions and 31 deletions

View file

@ -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 }}"

View file

@ -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

View file

@ -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

View file

@ -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

View file

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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -50,6 +50,9 @@
notify: restart kubelet
when: kubelet_copy.stdout_lines
# reload-systemd
- meta: flush_handlers
- name: Enable kubelet
service:
name: kubelet

View file

@ -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

View file

@ -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