mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-15 18:20:02 -03:30
use ansible_service_mgr to detect init system
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
- name : reload systemd
|
||||
shell: systemctl daemon-reload
|
||||
when: init_system == "systemd"
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: reload calico-node
|
||||
service:
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
src: systemd-docker.service
|
||||
dest: /lib/systemd/system/docker.service
|
||||
notify: restart docker
|
||||
when: init_system == "systemd"
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
@@ -80,21 +80,21 @@
|
||||
|
||||
- name: Calico | Write /etc/network-environment
|
||||
template: src=network-environment.j2 dest=/etc/network-environment
|
||||
when: init_system == "sysvinit"
|
||||
when: ansible_service_mgr in ["sysvinit","upstart"]
|
||||
|
||||
- name: Calico | Write calico-node systemd init file
|
||||
template: src=calico-node.service.j2 dest=/etc/systemd/system/calico-node.service
|
||||
when: init_system == "systemd"
|
||||
when: ansible_service_mgr == "systemd"
|
||||
notify: restart calico-node
|
||||
|
||||
- name: Calico | Write calico-node initd script
|
||||
template: src=deb-calico.initd.j2 dest=/etc/init.d/calico-node owner=root mode=0755
|
||||
when: init_system == "sysvinit" and ansible_os_family == "Debian"
|
||||
when: ansible_service_mgr in ["sysvinit","upstart"] and ansible_os_family == "Debian"
|
||||
notify: restart calico-node
|
||||
|
||||
- name: Calico | Write calico-node initd script
|
||||
template: src=rh-calico.initd.j2 dest=/etc/init.d/calico-node owner=root mode=0755
|
||||
when: init_system == "sysvinit" and ansible_os_family == "RedHat"
|
||||
when: ansible_service_mgr in ["sysvinit","upstart"] and ansible_os_family == "RedHat"
|
||||
notify: restart calico-node
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Deployed by Ansible
|
||||
{% if init_system == "sysvinit" and kube_network_plugin == "flannel" and ansible_os_family == "Debian" %}
|
||||
{% if ansible_service_mgr in ["sysvinit","upstart"] and kube_network_plugin == "flannel" and ansible_os_family == "Debian" %}
|
||||
DOCKER_OPTS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}"
|
||||
{% elif kube_network_plugin == "flannel" and ansible_os_family == "RedHat" %}
|
||||
DOCKER_NETWORK_OPTIONS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
- name : reload systemd
|
||||
shell: systemctl daemon-reload
|
||||
when: init_system == "systemd"
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: reload docker
|
||||
service:
|
||||
|
||||
@@ -47,6 +47,6 @@
|
||||
src: systemd-docker.service
|
||||
dest: /lib/systemd/system/docker.service
|
||||
notify: restart docker
|
||||
when: init_system == "systemd"
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Deployed by Ansible
|
||||
{% if init_system == "sysvinit" and kube_network_plugin == "flannel" and ansible_os_family == "Debian" %}
|
||||
{% if ansible_service_mgr in ["sysvinit","upstart"] and kube_network_plugin == "flannel" and ansible_os_family == "Debian" %}
|
||||
DOCKER_OPTS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}"
|
||||
{% elif kube_network_plugin == "flannel" %}
|
||||
OPTIONS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
- name : reload systemd
|
||||
shell: systemctl daemon-reload
|
||||
when: init_system == "systemd"
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: restart weave
|
||||
command: /bin/true
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
src: systemd-docker.service
|
||||
dest: /lib/systemd/system/docker.service
|
||||
notify: restart docker
|
||||
when: init_system == "systemd"
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
@@ -41,17 +41,17 @@
|
||||
|
||||
- name: Weave | Write weave systemd init file
|
||||
template: src=weave.service.j2 dest=/etc/systemd/system/weave.service
|
||||
when: init_system == "systemd"
|
||||
when: ansible_service_mgr == "systemd"
|
||||
notify: restart systemd-weave
|
||||
|
||||
- name: Weave | Write weaveproxy systemd init file
|
||||
template: src=weaveproxy.service.j2 dest=/etc/systemd/system/weaveproxy.service
|
||||
when: init_system == "systemd"
|
||||
when: ansible_service_mgr == "systemd"
|
||||
notify: restart systemd-weaveproxy
|
||||
|
||||
- name: Weave | Write weaveexpose systemd init file
|
||||
template: src=weaveexpose.service.j2 dest=/etc/systemd/system/weaveexpose.service
|
||||
when: init_system == "systemd"
|
||||
when: ansible_service_mgr == "systemd"
|
||||
notify: restart systemd-weaveexpose
|
||||
|
||||
- name: Weave | Enable weave
|
||||
|
||||
Reference in New Issue
Block a user