diff options
Diffstat (limited to 'playbooks.d')
-rw-r--r-- | playbooks.d/k3s-master/playbook.bash | 12 | ||||
-rw-r--r-- | playbooks.d/k3s-node/playbook.bash | 17 |
2 files changed, 22 insertions, 7 deletions
diff --git a/playbooks.d/k3s-master/playbook.bash b/playbooks.d/k3s-master/playbook.bash index cfd0330..f19fe8c 100644 --- a/playbooks.d/k3s-master/playbook.bash +++ b/playbooks.d/k3s-master/playbook.bash @@ -10,6 +10,7 @@ playbook_add() { node-name: "${BASHTARD_PLATFORM[fqdn]}" node-ip: "$(config "$BASHTARD_PLAYBOOK.internal-ip" "127.0.0.1")" bind-address: "$(config "$BASHTARD_PLAYBOOK.bind-address" "0.0.0.0")" + flannel-backend: wireguard-native cluster-cidr: "$(config "$BASHTARD_PLAYBOOK.cluster-cidr" "172.19.0.0/16")" cluster-domain: "$(config "$BASHTARD_PLAYBOOK.cluster-domain" "cluster.local")" service-cidr: "$(config "$BASHTARD_PLAYBOOK.service-cidr" "172.20.0.0/16")" @@ -17,17 +18,22 @@ playbook_add() { - traefik EOF + if [[ -n "$(config "$BASHTARD_PLAYBOOK.flannel-iface" "")" ]] + then + printf "flannel-iface: \"%s\"\n" "$(config "$BASHTARD_PLAYBOOK.flannel-iface")" + fi + if [[ -n "$(config "$BASHTARD_PLAYBOOK.external-ip" "")" ]] then - printf "%s: \"%s\"\n" "node-external-ip" "$(config "$BASHTARD_PLAYBOOK.external-ip" "")" + printf "node-external-ip: \"%s\"\n" "$(config "$BASHTARD_PLAYBOOK.external-ip")" fi } > "$(config "fs.etcdir")/rancher/k3s/config.yaml" info "$BASHTARD_PLAYBOOK/add" "Installing k3s" curl -sfL https://get.k3s.io | sh -s - server --cluster-init # I hate this - #notice "$BASHTARD_PLAYBOOK/add" "Creating data directories" - #mkdir -pv -- "$(playbook_path "data")/manifests.d" + notice "$BASHTARD_PLAYBOOK/add" "Creating data directories" + mkdir -pv -- "$(playbook_path "data")/manifests.d" notice "$BASHTARD_PLAYBOOK/add" "Waiting for node to become available" { grep -q -m 1 "${BASHTARD_PLATFORM[fqdn]}[[:space:]]\+Ready"; kill $!; } < <(k3s kubectl get node -w) diff --git a/playbooks.d/k3s-node/playbook.bash b/playbooks.d/k3s-node/playbook.bash index 361c176..e5eb2a6 100644 --- a/playbooks.d/k3s-node/playbook.bash +++ b/playbooks.d/k3s-node/playbook.bash @@ -40,27 +40,36 @@ playbook_add() { cat <<-EOF node-name: "${BASHTARD_PLATFORM[fqdn]}" node-ip: "$(config "$BASHTARD_PLAYBOOK.internal-ip" "127.0.0.1")" - server: "https://$(config "$BASHTARD_PLAYBOOK.entry.host"):$(config "$BASHTARD_PLAYBOOK.entry.port" "6443")" - token: "$token" EOF + if [[ -n "$(config "$BASHTARD_PLAYBOOK.flannel-iface" "")" ]] + then + printf "flannel-iface: \"%s\"\n" "$(config "$BASHTARD_PLAYBOOK.flannel-iface")" + fi + if [[ -n "$(config "$BASHTARD_PLAYBOOK.external-ip" "")" ]] then - printf "%s: \"%s\"\n" "node-external-ip" "$(config "$BASHTARD_PLAYBOOK.external-ip" "")" + printf "node-external-ip: \"%s\"\n" "$(config "$BASHTARD_PLAYBOOK.external-ip")" fi if [[ "$role" == "server" ]] then info "$BASHTARD_PLAYBOOK/add" "Node is a server, adding master configuration" - cat <<-EOF >> /etc/rancher/k3s/config.yaml + cat <<-EOF + bind-address: "$(config "$BASHTARD_PLAYBOOK.bind-address" "0.0.0.0")" cluster-cidr: "$(config "$BASHTARD_PLAYBOOK.cluster-cidr" "172.19.0.0/16")" cluster-domain: "$(config "$BASHTARD_PLAYBOOK.cluster-domain" "cluster.local")" + flannel-backend: wireguard-native service-cidr: "$(config "$BASHTARD_PLAYBOOK.service-cidr" "172.20.0.0/16")" service-node-port-range: "$(config "$BASHTARD_PLAYBOOK.service-node-port-min" "30000")-$(config "$BASHTARD_PLAYBOOK.service-node-port-max" "32767")" disable: - traefik EOF fi + + printf "\n" + printf "server: %s\n" "https://$(config "$BASHTARD_PLAYBOOK.entry.host"):$(config "$BASHTARD_PLAYBOOK.entry.port" "6443")" + printf "token: %s\n" "$token" } > "$(config "fs.etcdir")/rancher/k3s/config.yaml" info "$BASHTARD_PLAYBOOK/add" "Installing k3s" |