summaryrefslogtreecommitdiff
path: root/playbooks.d/k3s-node/playbook.bash
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks.d/k3s-node/playbook.bash')
-rw-r--r--playbooks.d/k3s-node/playbook.bash35
1 files changed, 23 insertions, 12 deletions
diff --git a/playbooks.d/k3s-node/playbook.bash b/playbooks.d/k3s-node/playbook.bash
index e1d77b3..d5b9a76 100644
--- a/playbooks.d/k3s-node/playbook.bash
+++ b/playbooks.d/k3s-node/playbook.bash
@@ -12,18 +12,29 @@ playbook_add() {
info "$BASHTARD_PLAYBOOK" "Writing config.yaml for k3s"
mkdir -pv -- /etc/rancher/k3s
- cat <<-EOF > /etc/rancher/k3s/config.yaml
- 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: "$(config "$BASHTARD_PLAYBOOK.entry.token")"
- EOF
-
- if [[ -n "$(config "$BASHTARD_PLAYBOOK.external-ip" "")" ]]
- then
- printf "%s: %s\n" "node-external-ip" "$(config "$BASHTARD_PLAYBOOK.external-ip" "")"\
- >> /etc/rancher/k3s/config.yaml
- fi
+ {
+ 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: "$(config "$BASHTARD_PLAYBOOK.entry.token")"
+ EOF
+
+ if [[ -n "$(config_subkeys "$BASHTARD_PLAYBOOK.flannel.interfaces")" ]]
+ then
+ printf "flannel-iface:\n"
+
+ while read -r iface
+ do
+ printf -- "- %s\n" "$(config "$BASHTARD_PLAYBOOK.flannel.interfaces.$iface")"
+ done < <( config_subkeys "$BASHTARD_PLAYBOOK.flannel.interfaces" )
+ fi
+
+ if [[ -n "$(config "$BASHTARD_PLAYBOOK.external-ip" "")" ]]
+ then
+ printf "%s: %s\n" "node-external-ip" "$(config "$BASHTARD_PLAYBOOK.external-ip" "")"
+ fi
+ } "$(config "fs.etcdir")/rancher/k3s/config.yaml"
if [[ "$role" == "server" ]]
then