mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-05-07 17:37:39 -02:30
use ansible_service_mgr to detect init system
This commit is contained in:
@@ -15,24 +15,6 @@
|
||||
paths:
|
||||
- ../vars
|
||||
|
||||
- name: "Identify init system"
|
||||
shell: >
|
||||
$(pgrep systemd > /dev/null && systemctl status network.target > /dev/null);
|
||||
if [ $? -eq 0 ] ; then
|
||||
echo systemd;
|
||||
else
|
||||
echo sysvinit;
|
||||
fi
|
||||
always_run: True
|
||||
register: init_system_output
|
||||
changed_when: False
|
||||
tags: always
|
||||
|
||||
- set_fact:
|
||||
init_system: "{{ init_system_output.stdout }}"
|
||||
always_run: True
|
||||
tags: always
|
||||
|
||||
- name: Create kubernetes config directory
|
||||
file:
|
||||
path: "{{ kube_config_dir }}"
|
||||
@@ -56,7 +38,7 @@
|
||||
path: "{{ kube_log_dir }}"
|
||||
state: directory
|
||||
owner: kube
|
||||
when: init_system == "sysvinit"
|
||||
when: ansible_service_mgr in ["sysvinit","upstart"]
|
||||
|
||||
- name: Create cni directories
|
||||
file:
|
||||
|
||||
Reference in New Issue
Block a user