Merge pull request #97 from ansibl8s/systemd_reload

Fix systemd reload and calico unit
This commit is contained in:
Antoine Legrand 2016-01-25 11:01:11 +01:00
commit cece179bd4
11 changed files with 39 additions and 31 deletions

View file

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

View file

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

View file

@ -7,7 +7,7 @@
when: init_system == "systemd" when: init_system == "systemd"
notify: restart systemd-etcd notify: restart systemd-etcd
- name: Configure | Write calico-node initd script - name: Configure | Write etcd initd script
template: template:
src: deb-etcd.initd.j2 src: deb-etcd.initd.j2
dest: /etc/init.d/etcd dest: /etc/init.d/etcd
@ -21,9 +21,3 @@
src: etcd.j2 src: etcd.j2
dest: /etc/etcd.env dest: /etc/etcd.env
notify: restart etcd 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 command: /bin/true
notify: restart etcd notify: restart etcd
when: etcd_copy.stdout_lines 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] [Unit]
Description=etcd Description=etcd
Conflicts=etcd.service
[Service] [Service]
User=etcd 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 command: /bin/true
notify: notify:
- reload systemd - reload systemd
- restart kube-apiserver - reload kube-apiserver
- name: reload systemd - name: reload systemd
command: systemctl daemon-reload command: systemctl daemon-reload
when: init_system == "systemd"
- name: restart kubelet - name: reload kube-apiserver
service:
name: kubelet
state: restarted
- name: restart kube-apiserver
service: service:
name: kube-apiserver name: kube-apiserver
state: restarted state: restarted

View file

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

View file

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

View file

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

View file

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

View file

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