mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-18 11:40:10 -03:30
Drop non systemd OS types support
Signed-off-by: Bogdan Dobrelya <bogdando@mail.ru>
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
|
||||
- name : Calico | reload systemd
|
||||
shell: systemctl daemon-reload
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: Calico | reload calico-node
|
||||
service:
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
- name : Calico-rr | reload systemd
|
||||
shell: systemctl daemon-reload
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: Calico-rr | reload calico-rr
|
||||
service:
|
||||
|
||||
@@ -36,12 +36,10 @@
|
||||
|
||||
- name: Calico-rr | Write calico-rr.env for systemd init file
|
||||
template: src=calico-rr.env.j2 dest=/etc/calico/calico-rr.env
|
||||
when: ansible_service_mgr == "systemd"
|
||||
notify: restart calico-rr
|
||||
|
||||
- name: Calico-rr | Write calico-rr systemd init file
|
||||
template: src=calico-rr.service.j2 dest=/etc/systemd/system/calico-rr.service
|
||||
when: ansible_service_mgr == "systemd"
|
||||
notify: restart calico-rr
|
||||
|
||||
- name: Calico-rr | Configure route reflector
|
||||
|
||||
@@ -162,33 +162,19 @@
|
||||
run_once: true
|
||||
when: legacy_calicoctl
|
||||
|
||||
- name: Calico | Write /etc/network-environment
|
||||
template: src=network-environment.j2 dest=/etc/network-environment
|
||||
when: ansible_service_mgr in ["sysvinit","upstart"]
|
||||
|
||||
- name: Calico (old) | Write calico-node systemd init file
|
||||
template: src=calico-node.service.legacy.j2 dest=/etc/systemd/system/calico-node.service
|
||||
when: ansible_service_mgr == "systemd" and legacy_calicoctl
|
||||
when: legacy_calicoctl
|
||||
notify: restart calico-node
|
||||
|
||||
- name: Calico | Write calico.env for systemd init file
|
||||
template: src=calico.env.j2 dest=/etc/calico/calico.env
|
||||
when: ansible_service_mgr == "systemd" and not legacy_calicoctl
|
||||
when: not legacy_calicoctl
|
||||
notify: restart calico-node
|
||||
|
||||
- name: Calico | Write calico-node systemd init file
|
||||
template: src=calico-node.service.j2 dest=/etc/systemd/system/calico-node.service
|
||||
when: ansible_service_mgr == "systemd" and not legacy_calicoctl
|
||||
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: 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: ansible_service_mgr in ["sysvinit","upstart"] and ansible_os_family == "RedHat"
|
||||
when: not legacy_calicoctl
|
||||
notify: restart calico-node
|
||||
|
||||
- name: Calico | Restart calico-node if secrets changed
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: calico-node
|
||||
# Required-Start: $local_fs $network $syslog
|
||||
# Required-Stop:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Calico docker container
|
||||
# Description:
|
||||
# Runs calico as a docker container
|
||||
### END INIT INFO
|
||||
set -a
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="Calico-node Docker"
|
||||
NAME=calico-node
|
||||
DAEMON={{ bin_dir }}/calicoctl
|
||||
DAEMON_ARGS=""
|
||||
DOCKER=$(which docker)
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
DAEMON_USER=root
|
||||
|
||||
# Exit if the binary is not present
|
||||
[ -x "$DAEMON" ] || exit 0
|
||||
|
||||
# Exit if the docker package is not installed
|
||||
[ -x "$DOCKER" ] || exit 0
|
||||
|
||||
# Read configuration variable file if it is present
|
||||
[ -r /etc/network-environment ] && . /etc/network-environment
|
||||
|
||||
# Define LSB log_* functions.
|
||||
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
|
||||
# and status_of_proc is working.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
do_status()
|
||||
{
|
||||
if [ $($DOCKER ps --format "{{.Image}}" | grep -cw 'calico/node') -eq 1 ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function that starts the daemon/service
|
||||
#
|
||||
do_start()
|
||||
{
|
||||
do_status
|
||||
retval=$?
|
||||
if [ $retval -ne 0 ]; then
|
||||
{% if legacy_calicoctl %}
|
||||
${DAEMON} node --ip=${DEFAULT_IPV4} >>/dev/null && return 0 || return 2
|
||||
{% else %}
|
||||
${DAEMON} node run --ip=${DEFAULT_IPV4} >>/dev/null && return 0 || return 2
|
||||
{% endif %}
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service
|
||||
#
|
||||
do_stop()
|
||||
{
|
||||
{% if legacy_calicoctl %}
|
||||
${DAEMON} node stop >> /dev/null || ${DAEMON} node stop --force >> /dev/null
|
||||
{% else %}
|
||||
echo "Current version of ${DAEMON} doesn't support 'node stop' command!"
|
||||
return 1
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_daemon_msg "Starting $DESC" "$NAME"
|
||||
do_start
|
||||
case "$?" in
|
||||
0|1) log_end_msg 0 || exit 0 ;;
|
||||
2) log_end_msg 1 || exit 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
if do_stop; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_failure_msg "Can't stop calico-node"
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
if do_status; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_failure_msg "Calico-node is not running"
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
|
||||
restart|force-reload)
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
if do_stop; then
|
||||
if do_start; then
|
||||
log_end_msg 0
|
||||
exit 0
|
||||
else
|
||||
rc="$?"
|
||||
fi
|
||||
else
|
||||
rc="$?"
|
||||
fi
|
||||
log_failure_msg "Can't restart Calico-node"
|
||||
log_end_msg ${rc}
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
@@ -1,12 +0,0 @@
|
||||
# This host's IPv4 address (the source IP address used to reach other nodes
|
||||
# in the Kubernetes cluster).
|
||||
DEFAULT_IPV4={{ip | default(ansible_default_ipv4.address) }}
|
||||
|
||||
# The Kubernetes master IP
|
||||
KUBERNETES_MASTER={{ kube_apiserver_endpoint }}
|
||||
|
||||
# IP and port of etcd instance used by Calico
|
||||
ETCD_ENDPOINTS={{ etcd_access_endpoint }}
|
||||
ETCD_CA_CERT_FILE=/etc/calico/certs/ca_cert.crt
|
||||
ETCD_CERT_FILE=/etc/calico/certs/cert.crt
|
||||
ETCD_KEY_FILE=/etc/calico/certs/key.pem
|
||||
@@ -1,140 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# /etc/rc.d/init.d/calico-node
|
||||
#
|
||||
# chkconfig: 2345 95 95
|
||||
# description: Daemon for calico-node (http://www.projectcalico.org/)
|
||||
set -a
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: calico-node
|
||||
# Required-Start: $local_fs $network $syslog cgconfig
|
||||
# Required-Stop:
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: start and stop calico-node
|
||||
# Description:
|
||||
# Manage calico-docker container
|
||||
### END INIT INFO
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
prog="calicoctl"
|
||||
exec="{{ bin_dir }}/$prog"
|
||||
dockerexec="$(which docker)"
|
||||
logfile="/var/log/$prog"
|
||||
|
||||
[ -e /etc/network-environment ] && for i in $(cat /etc/network-environment | egrep '(^$|^#)'); do export $i; done
|
||||
|
||||
do_status()
|
||||
{
|
||||
if [ $($dockerexec ps --format "{{.Image}}" | grep -cw 'calico/node') -ne 1 ]; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
do_start() {
|
||||
if [ ! -x $exec ]; then
|
||||
if [ ! -e $exec ]; then
|
||||
echo "calico-node executable $exec not found"
|
||||
else
|
||||
echo "You do not have permission to execute the calico-node executable $exec"
|
||||
fi
|
||||
exit 5
|
||||
fi
|
||||
|
||||
[ -x "$dockerexec" ] || exit 0
|
||||
|
||||
do_status
|
||||
retval=$?
|
||||
if [ $retval -ne 0 ]; then
|
||||
printf "Starting $prog:\t"
|
||||
echo "\n$(date)\n" >> $logfile
|
||||
{% if legacy_calicoctl %}
|
||||
$exec node --ip=${DEFAULT_IPV4} &>>$logfile
|
||||
{% else %}
|
||||
$exec node run --ip=${DEFAULT_IPV4} &>>$logfile
|
||||
{% endif %}
|
||||
success
|
||||
echo
|
||||
else
|
||||
echo -n "calico-node's already running"
|
||||
success
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
do_stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
{% if legacy_calicoctl %}
|
||||
$exec node stop >> /dev/null || $exec node stop --force >> /dev/null
|
||||
{% else %}
|
||||
echo "Current version of ${exec} doesn't support 'node stop' command!"
|
||||
return 1
|
||||
{% endif %}
|
||||
retval=$?
|
||||
echo
|
||||
return $retval
|
||||
}
|
||||
|
||||
restart() {
|
||||
do_stop
|
||||
do_start
|
||||
}
|
||||
|
||||
reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
force_reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
do_start
|
||||
case "$?" in
|
||||
0|1) success || exit 0 ;;
|
||||
2) failure || exit 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping $DESC" "$NAME"
|
||||
if do_stop; then
|
||||
success
|
||||
echo
|
||||
else
|
||||
echo -n "Can't stop calico-node"
|
||||
failure
|
||||
echo
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
$1
|
||||
;;
|
||||
reload)
|
||||
$1
|
||||
;;
|
||||
force-reload)
|
||||
force_reload
|
||||
;;
|
||||
status)
|
||||
if do_status; then
|
||||
echo -n "Calico-node is running"
|
||||
success
|
||||
echo
|
||||
else
|
||||
echo -n "Calico-node is not running"
|
||||
failure
|
||||
echo
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}"
|
||||
exit 2
|
||||
esac
|
||||
|
||||
exit $?
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
- name : Flannel | reload systemd
|
||||
shell: systemctl daemon-reload
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: Flannel | reload docker.socket
|
||||
service:
|
||||
|
||||
@@ -51,31 +51,11 @@
|
||||
docker_network_options: '"--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}"'
|
||||
tags: facts
|
||||
|
||||
- name: Flannel | Remove non-systemd docker daemon network options that don't match desired line
|
||||
lineinfile:
|
||||
dest: "{{ docker_options_file }}"
|
||||
regexp: "^DOCKER_NETWORK_OPTIONS=(?!{{ docker_network_options|regex_escape() }})"
|
||||
state: absent
|
||||
when: ansible_service_mgr in ["sysvinit","upstart"]
|
||||
|
||||
- name: Flannel | Set non-systemd docker daemon network options
|
||||
lineinfile:
|
||||
dest: "{{ docker_options_file }}"
|
||||
line: DOCKER_NETWORK_OPTIONS={{ docker_network_options }}
|
||||
insertbefore: ^{{ docker_options_name }}=
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify:
|
||||
- Flannel | restart docker
|
||||
when: ansible_service_mgr in ["sysvinit","upstart"]
|
||||
|
||||
- name: Flannel | Ensure path for docker network systemd drop-in
|
||||
file:
|
||||
path: "/etc/systemd/system/docker.service.d"
|
||||
state: directory
|
||||
owner: root
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: Flannel | Create docker network systemd drop-in
|
||||
template:
|
||||
@@ -83,6 +63,3 @@
|
||||
dest: "/etc/systemd/system/docker.service.d/flannel-options.conf"
|
||||
notify:
|
||||
- Flannel | restart docker
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
- name : Weave | reload systemd
|
||||
shell: systemctl daemon-reload
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: restart weaveproxy
|
||||
command: /bin/true
|
||||
|
||||
@@ -31,17 +31,14 @@
|
||||
|
||||
- name: Weave | Write weave systemd init file
|
||||
template: src=weave.service.j2 dest=/etc/systemd/system/weave.service
|
||||
when: ansible_service_mgr == "systemd"
|
||||
notify: restart weave
|
||||
|
||||
- name: Weave | Write weaveproxy systemd init file
|
||||
template: src=weaveproxy.service.j2 dest=/etc/systemd/system/weaveproxy.service
|
||||
when: ansible_service_mgr == "systemd"
|
||||
notify: restart weaveproxy
|
||||
|
||||
- name: Weave | Write weaveexpose systemd init file
|
||||
template: src=weaveexpose.service.j2 dest=/etc/systemd/system/weaveexpose.service
|
||||
when: ansible_service_mgr == "systemd"
|
||||
notify: restart weaveexpose
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
Reference in New Issue
Block a user