fix: update taskfiles and validation logic (#1264)
Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
1 parent
3b0fcb7ba5
commit
7fc4250ef2
8 files changed
+44
-40
No files matched your search
@@ -2,29 +2,27 @@
|
|||||||
# yaml-language-server: $schema=https://taskfile.dev/schema.json
|
# yaml-language-server: $schema=https://taskfile.dev/schema.json
|
||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
env:
|
|
||||||
PATH: "{{.ROOT_DIR}}/.venv/bin:$PATH"
|
|
||||||
VIRTUAL_ENV: "{{.ROOT_DIR}}/.venv"
|
|
||||||
ANSIBLE_COLLECTIONS_PATH: "{{.ROOT_DIR}}/.venv/galaxy"
|
|
||||||
ANSIBLE_ROLES_PATH: "{{.ROOT_DIR}}/.venv/galaxy/ansible_roles"
|
|
||||||
ANSIBLE_VARS_ENABLED: "host_group_vars"
|
|
||||||
ANSIBLE_LOCALHOST_WARNING: "False"
|
|
||||||
ANSIBLE_INVENTORY_UNPARSED_WARNING: "False"
|
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
ANSIBLE_LINT_FILE: "{{.ANSIBLE_DIR}}/.ansible-lint"
|
ANSIBLE_LINT_FILE: "{{.ANSIBLE_DIR}}/.ansible-lint"
|
||||||
ANSIBLE_INVENTORY_FILE: "{{.ANSIBLE_DIR}}/inventory/hosts.yaml"
|
ANSIBLE_INVENTORY_FILE: "{{.ANSIBLE_DIR}}/inventory/hosts.yaml"
|
||||||
ANSIBLE_REQUIREMENTS_FILE: "{{.ANSIBLE_DIR}}/requirements.yaml"
|
ANSIBLE_REQUIREMENTS_FILE: "{{.ANSIBLE_DIR}}/requirements.yaml"
|
||||||
ANSIBLE_PIP_REQUIREMENTS_FILE: "{{.ANSIBLE_DIR}}/requirements.txt"
|
ANSIBLE_PIP_REQUIREMENTS_FILE: "{{.ANSIBLE_DIR}}/requirements.txt"
|
||||||
|
|
||||||
|
env:
|
||||||
|
ANSIBLE_COLLECTIONS_PATH: "{{.VIRTUAL_ENV}}/galaxy"
|
||||||
|
ANSIBLE_ROLES_PATH: "{{.VIRTUAL_ENV}}/galaxy/ansible_roles"
|
||||||
|
ANSIBLE_VARS_ENABLED: "host_group_vars"
|
||||||
|
ANSIBLE_LOCALHOST_WARNING: "False"
|
||||||
|
ANSIBLE_INVENTORY_UNPARSED_WARNING: "False"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
deps:
|
deps:
|
||||||
desc: Set up Ansible dependencies
|
desc: Set up Ansible dependencies
|
||||||
deps: [":workstation:venv"]
|
deps: [":workstation:venv"]
|
||||||
cmds:
|
cmds:
|
||||||
- .venv/bin/python3 -m pip install --upgrade --requirement "{{.ANSIBLE_PIP_REQUIREMENTS_FILE}}"
|
- '{{.VIRTUAL_ENV}}/bin/python3 -m pip install --upgrade --requirement "{{.ANSIBLE_PIP_REQUIREMENTS_FILE}}"'
|
||||||
- .venv/bin/ansible-galaxy install --role-file "{{.ANSIBLE_REQUIREMENTS_FILE}}" {{if eq .force "true"}}--force{{end}}
|
- '{{.VIRTUAL_ENV}}/bin/ansible-galaxy install --role-file "{{.ANSIBLE_REQUIREMENTS_FILE}}" {{if eq .force "true"}}--force{{end}}'
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "Missing Ansible requirements file", sh: "test -f {{.ANSIBLE_REQUIREMENTS_FILE}}" }
|
- { msg: "Missing Ansible requirements file", sh: "test -f {{.ANSIBLE_REQUIREMENTS_FILE}}" }
|
||||||
- { msg: "Missing Pip requirements file", sh: "test -f {{.ANSIBLE_PIP_REQUIREMENTS_FILE}}" }
|
- { msg: "Missing Pip requirements file", sh: "test -f {{.ANSIBLE_PIP_REQUIREMENTS_FILE}}" }
|
||||||
@@ -44,7 +42,7 @@ tasks:
|
|||||||
playbook: Playbook to run (required)
|
playbook: Playbook to run (required)
|
||||||
prompt: Run Ansible playbook '{{.playbook}}'... continue?
|
prompt: Run Ansible playbook '{{.playbook}}'... continue?
|
||||||
deps: ["deps"]
|
deps: ["deps"]
|
||||||
cmd: .venv/bin/ansible-playbook --inventory {{.ANSIBLE_INVENTORY_FILE}} {{.ANSIBLE_DIR}}/playbooks/{{.playbook}}.yaml {{.CLI_ARGS}}
|
cmd: "{{.VIRTUAL_ENV}}/bin/ansible-playbook --inventory {{.ANSIBLE_INVENTORY_FILE}} {{.ANSIBLE_DIR}}/playbooks/{{.playbook}}.yaml {{.CLI_ARGS}}"
|
||||||
requires:
|
requires:
|
||||||
vars: ["playbook"]
|
vars: ["playbook"]
|
||||||
preconditions:
|
preconditions:
|
||||||
@@ -53,35 +51,35 @@ tasks:
|
|||||||
poweroff:
|
poweroff:
|
||||||
desc: Shutdown all the k8s nodes
|
desc: Shutdown all the k8s nodes
|
||||||
deps: ["deps"]
|
deps: ["deps"]
|
||||||
cmd: .venv/bin/ansible kubernetes --inventory {{.ANSIBLE_INVENTORY_FILE}} -a '/usr/bin/systemctl poweroff' --become
|
cmd: "{{.VIRTUAL_ENV}}/bin/ansible kubernetes --inventory {{.ANSIBLE_INVENTORY_FILE}} -a '/usr/bin/systemctl poweroff' --become"
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "Missing Ansible inventory file", sh: "test -f {{.ANSIBLE_INVENTORY_FILE}}" }
|
- { msg: "Missing Ansible inventory file", sh: "test -f {{.ANSIBLE_INVENTORY_FILE}}" }
|
||||||
|
|
||||||
list:
|
list:
|
||||||
desc: List all the hosts
|
desc: List all the hosts
|
||||||
deps: ["deps"]
|
deps: ["deps"]
|
||||||
cmd: .venv/bin/ansible kubernetes --inventory {{.ANSIBLE_INVENTORY_FILE}} --list-hosts
|
cmd: "{{.VIRTUAL_ENV}}/bin/ansible kubernetes --inventory {{.ANSIBLE_INVENTORY_FILE}} --list-hosts"
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "Missing Ansible inventory file", sh: "test -f {{.ANSIBLE_INVENTORY_FILE}}" }
|
- { msg: "Missing Ansible inventory file", sh: "test -f {{.ANSIBLE_INVENTORY_FILE}}" }
|
||||||
|
|
||||||
ping:
|
ping:
|
||||||
desc: Ping all the hosts
|
desc: Ping all the hosts
|
||||||
deps: ["deps"]
|
deps: ["deps"]
|
||||||
cmd: .venv/bin/ansible kubernetes --inventory {{.ANSIBLE_INVENTORY_FILE}} --one-line -m 'ping'
|
cmd: "{{.VIRTUAL_ENV}}/bin/ansible kubernetes --inventory {{.ANSIBLE_INVENTORY_FILE}} --one-line -m 'ping'"
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "Missing Ansible inventory file", sh: "test -f {{.ANSIBLE_INVENTORY_FILE}}" }
|
- { msg: "Missing Ansible inventory file", sh: "test -f {{.ANSIBLE_INVENTORY_FILE}}" }
|
||||||
|
|
||||||
uptime:
|
uptime:
|
||||||
desc: Uptime of all the hosts
|
desc: Uptime of all the hosts
|
||||||
deps: ["deps"]
|
deps: ["deps"]
|
||||||
cmd: .venv/bin/ansible kubernetes --inventory {{.ANSIBLE_INVENTORY_FILE}} --one-line -a 'uptime'
|
cmd: "{{.VIRTUAL_ENV}}/bin/ansible kubernetes --inventory {{.ANSIBLE_INVENTORY_FILE}} --one-line -a 'uptime'"
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "Missing Ansible inventory file", sh: "test -f {{.ANSIBLE_INVENTORY_FILE}}" }
|
- { msg: "Missing Ansible inventory file", sh: "test -f {{.ANSIBLE_INVENTORY_FILE}}" }
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
desc: Lint Ansible
|
desc: Lint Ansible
|
||||||
deps: ["deps"]
|
deps: ["deps"]
|
||||||
cmd: ./.venv/bin/ansible-lint --config-file {{.ANSIBLE_LINT_FILE}} {{.ANSIBLE_DIR}}/**/*.yaml
|
cmd: "{{.VIRTUAL_ENV}}/bin/ansible-lint --config-file {{.ANSIBLE_LINT_FILE}} {{.ANSIBLE_DIR}}/**/*.yaml"
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "Missing Ansible lint file", sh: "test -f {{.ANSIBLE_LINT_FILE}}" }
|
- { msg: "Missing Ansible lint file", sh: "test -f {{.ANSIBLE_LINT_FILE}}" }
|
||||||
|
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ tasks:
|
|||||||
- kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --filename https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/{{.PROMETHEUS_OPERATOR_VERSION}}/example/prometheus-operator-crd/monitoring.coreos.com_scrapeconfigs.yaml
|
- kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --filename https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/{{.PROMETHEUS_OPERATOR_VERSION}}/example/prometheus-operator-crd/monitoring.coreos.com_scrapeconfigs.yaml
|
||||||
- kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --filename https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/{{.PROMETHEUS_OPERATOR_VERSION}}/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml
|
- kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --filename https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/{{.PROMETHEUS_OPERATOR_VERSION}}/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml
|
||||||
- kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --kustomize {{.KUBERNETES_DIR}}/bootstrap
|
- kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --kustomize {{.KUBERNETES_DIR}}/bootstrap
|
||||||
- cat {{.SOPS_AGE_KEY_FILE}} | kubectl -n flux-system create secret generic sops-age --from-file=age.agekey=/dev/stdin
|
- cat {{.AGE_FILE}} | kubectl -n flux-system create secret generic sops-age --from-file=age.agekey=/dev/stdin
|
||||||
- sops --decrypt {{.CLUSTER_SECRET_SOPS_FILE}} | kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --filename -
|
- sops --decrypt {{.CLUSTER_SECRET_SOPS_FILE}} | kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --filename -
|
||||||
- kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --filename {{.CLUSTER_SETTINGS_FILE}}
|
- kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --filename {{.CLUSTER_SETTINGS_FILE}}
|
||||||
- kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --kustomize {{.KUBERNETES_DIR}}/flux/config
|
- kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --kustomize {{.KUBERNETES_DIR}}/flux/config
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "Missing kubeconfig", sh: "test -f {{.KUBECONFIG_FILE}}" }
|
- { msg: "Missing kubeconfig", sh: "test -f {{.KUBECONFIG_FILE}}" }
|
||||||
- { msg: "Flux already installed", sh: "kubectl get namespace flux-system --kubeconfig {{.KUBECONFIG_FILE}} &>/dev/null && exit 1 || exit 0" }
|
- { msg: "Flux already installed", sh: "kubectl get namespace flux-system --kubeconfig {{.KUBECONFIG_FILE}} &>/dev/null && exit 1 || exit 0" }
|
||||||
- { msg: "Missing Sops Age key file", sh: "test -f {{.SOPS_AGE_KEY_FILE}}" }
|
- { msg: "Missing Sops Age key file", sh: "test -f {{.AGE_FILE}}" }
|
||||||
|
|
||||||
apply:
|
apply:
|
||||||
desc: Apply a Flux Kustomization resource for a cluster
|
desc: Apply a Flux Kustomization resource for a cluster
|
||||||
|
|||||||
@@ -2,18 +2,19 @@
|
|||||||
# yaml-language-server: $schema=https://taskfile.dev/schema.json
|
# yaml-language-server: $schema=https://taskfile.dev/schema.json
|
||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
|
vars:
|
||||||
|
K0S_DIR: "{{.KUBERNETES_DIR}}/k0s"
|
||||||
|
K0S_CONFIG_FILE: "{{.K0S_DIR}}/k0sctl.yaml"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DISABLE_TELEMETRY: "true"
|
DISABLE_TELEMETRY: "true"
|
||||||
DISABLE_UPGRADE_CHECK: "true"
|
DISABLE_UPGRADE_CHECK: "true"
|
||||||
|
|
||||||
vars:
|
|
||||||
K0S_CONFIG_FILE: "{{.KUBERNETES_DIR}}/k0s/k0sctl.yaml"
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
apply:
|
apply:
|
||||||
desc: Apply k0s cluster config
|
desc: Apply k0s cluster config
|
||||||
dir: "{{.KUBERNETES_DIR}}/k0s" # Needed for uploading files in k0sctl.yaml
|
dir: "{{.K0S_DIR}}"
|
||||||
cmds:
|
cmds:
|
||||||
- k0sctl apply --config {{.K0S_CONFIG_FILE}}
|
- k0sctl apply --config {{.K0S_CONFIG_FILE}}
|
||||||
- task: kubeconfig
|
- task: kubeconfig
|
||||||
@@ -22,14 +23,14 @@ tasks:
|
|||||||
|
|
||||||
nuke:
|
nuke:
|
||||||
desc: Nuke the k0s cluster
|
desc: Nuke the k0s cluster
|
||||||
deps: [":ansible:deps"]
|
dir: "{{.K0S_DIR}}"
|
||||||
cmds:
|
cmd: k0sctl reset --config {{.K0S_CONFIG_FILE}}
|
||||||
- k0sctl reset --config {{.K0S_CONFIG_FILE}}
|
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "Missing K0s config file", sh: "test -f {{.K0S_CONFIG_FILE}}" }
|
- { msg: "Missing K0s config file", sh: "test -f {{.K0S_CONFIG_FILE}}" }
|
||||||
|
|
||||||
kubeconfig:
|
kubeconfig:
|
||||||
desc: Gets k0s kubeconfig
|
desc: Gets k0s kubeconfig
|
||||||
|
dir: "{{.K0S_DIR}}"
|
||||||
prompt: This will overwrite the existing kubeconfig... continue?
|
prompt: This will overwrite the existing kubeconfig... continue?
|
||||||
cmds:
|
cmds:
|
||||||
- k0sctl kubeconfig --config {{.K0S_CONFIG_FILE}} > {{.KUBECONFIG_FILE}}
|
- k0sctl kubeconfig --config {{.K0S_CONFIG_FILE}} > {{.KUBECONFIG_FILE}}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ tasks:
|
|||||||
|
|
||||||
age-keygen:
|
age-keygen:
|
||||||
desc: Initialize Age Key for Sops
|
desc: Initialize Age Key for Sops
|
||||||
cmd: age-keygen --output {{.SOPS_AGE_KEY_FILE}}
|
cmd: age-keygen --output {{.AGE_FILE}}
|
||||||
status:
|
status:
|
||||||
- test -f "{{.SOPS_AGE_KEY_FILE}}"
|
- test -f "{{.AGE_FILE}}"
|
||||||
|
|
||||||
encrypt:
|
encrypt:
|
||||||
desc: Encrypt all Kubernetes SOPS secrets that are not already encrypted
|
desc: Encrypt all Kubernetes SOPS secrets that are not already encrypted
|
||||||
@@ -31,7 +31,7 @@ tasks:
|
|||||||
vars: ["file"]
|
vars: ["file"]
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "Missing Sops config file", sh: "test -f {{.SOPS_CONFIG_FILE}}" }
|
- { msg: "Missing Sops config file", sh: "test -f {{.SOPS_CONFIG_FILE}}" }
|
||||||
- { msg: "Missing Sops Age key file", sh: "test -f {{.SOPS_AGE_KEY_FILE}}" }
|
- { msg: "Missing Sops Age key file", sh: "test -f {{.AGE_FILE}}" }
|
||||||
|
|
||||||
.reset:
|
.reset:
|
||||||
internal: true
|
internal: true
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
TALOS_DIR: "{{.ROOT_DIR}}/kubernetes/talos"
|
TALOS_DIR: "{{.KUBERNETES_DIR}}/talos"
|
||||||
TALHELPER_SECRET_FILE: "{{.TALOS_DIR}}/talhelper.sops.yaml"
|
TALHELPER_SECRET_FILE: "{{.TALOS_DIR}}/talhelper.sops.yaml"
|
||||||
TALHELPER_CONFIG_FILE: "{{.TALOS_DIR}}/talconfig.yaml"
|
TALHELPER_CONFIG_FILE: "{{.TALOS_DIR}}/talconfig.yaml"
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ version: "3"
|
|||||||
vars:
|
vars:
|
||||||
ARCHFILE: "{{.ROOT_DIR}}/.taskfiles/Workstation/Archfile"
|
ARCHFILE: "{{.ROOT_DIR}}/.taskfiles/Workstation/Archfile"
|
||||||
BREWFILE: "{{.ROOT_DIR}}/.taskfiles/Workstation/Brewfile"
|
BREWFILE: "{{.ROOT_DIR}}/.taskfiles/Workstation/Brewfile"
|
||||||
|
GENERIC_BIN_DIR: "{{.ROOT_DIR}}/.bin"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
@@ -18,13 +19,13 @@ tasks:
|
|||||||
venv:
|
venv:
|
||||||
desc: Set up virtual environment
|
desc: Set up virtual environment
|
||||||
cmds:
|
cmds:
|
||||||
- "{{.PYTHON_BIN}} -m venv {{.ROOT_DIR}}/.venv"
|
- "{{.PYTHON_BIN}} -m venv {{.VIRTUAL_ENV}}"
|
||||||
- .venv/bin/python3 -m pip install --upgrade pip setuptools wheel
|
- '{{.VIRTUAL_ENV}}/bin/python3 -m pip install --upgrade pip setuptools wheel'
|
||||||
- .venv/bin/python3 -m pip install --upgrade --requirement "{{.PIP_REQUIREMENTS_FILE}}"
|
- '{{.VIRTUAL_ENV}}/bin/python3 -m pip install --upgrade --requirement "{{.PIP_REQUIREMENTS_FILE}}"'
|
||||||
sources:
|
sources:
|
||||||
- "{{.PIP_REQUIREMENTS_FILE}}"
|
- "{{.PIP_REQUIREMENTS_FILE}}"
|
||||||
generates:
|
generates:
|
||||||
- "{{.ROOT_DIR}}/.venv/pyvenv.cfg"
|
- "{{.VIRTUAL_ENV}}/pyvenv.cfg"
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "Missing Pip requirements file", sh: "test -f {{.PIP_REQUIREMENTS_FILE}}" }
|
- { msg: "Missing Pip requirements file", sh: "test -f {{.PIP_REQUIREMENTS_FILE}}" }
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ tasks:
|
|||||||
|
|
||||||
generic-linux:
|
generic-linux:
|
||||||
desc: Install CLI tools into the projects .bin directory using curl
|
desc: Install CLI tools into the projects .bin directory using curl
|
||||||
dir: "{{.ROOT_DIR}}/.bin"
|
dir: "{{.GENERIC_BIN_DIR}}"
|
||||||
platforms: ["linux/amd64", "linux/arm64"]
|
platforms: ["linux/amd64", "linux/arm64"]
|
||||||
cmds:
|
cmds:
|
||||||
- for:
|
- for:
|
||||||
|
|||||||
+8
-4
@@ -9,15 +9,19 @@ vars:
|
|||||||
KUBERNETES_DIR: "{{.ROOT_DIR}}/kubernetes"
|
KUBERNETES_DIR: "{{.ROOT_DIR}}/kubernetes"
|
||||||
PRIVATE_DIR: "{{.ROOT_DIR}}/.private"
|
PRIVATE_DIR: "{{.ROOT_DIR}}/.private"
|
||||||
# Files
|
# Files
|
||||||
|
AGE_FILE: "{{.ROOT_DIR}}/age.key"
|
||||||
BOOTSTRAP_CONFIG_FILE: "{{.BOOTSTRAP_DIR}}/vars/config.yaml"
|
BOOTSTRAP_CONFIG_FILE: "{{.BOOTSTRAP_DIR}}/vars/config.yaml"
|
||||||
KUBECONFIG_FILE: "{{.ROOT_DIR}}/kubeconfig"
|
KUBECONFIG_FILE: "{{.ROOT_DIR}}/kubeconfig"
|
||||||
MAKEJINJA_CONFIG_FILE: "{{.ROOT_DIR}}/makejinja.toml"
|
MAKEJINJA_CONFIG_FILE: "{{.ROOT_DIR}}/makejinja.toml"
|
||||||
PIP_REQUIREMENTS_FILE: "{{.ROOT_DIR}}/requirements.txt"
|
PIP_REQUIREMENTS_FILE: "{{.ROOT_DIR}}/requirements.txt"
|
||||||
SOPS_AGE_KEY_FILE: "{{.ROOT_DIR}}/age.key"
|
|
||||||
# Binaries
|
# Binaries
|
||||||
PYTHON_BIN: python3
|
PYTHON_BIN: python3
|
||||||
# Python
|
|
||||||
|
env:
|
||||||
|
KUBECONFIG: "{{.KUBECONFIG_FILE}}"
|
||||||
PYTHONDONTWRITEBYTECODE: "1"
|
PYTHONDONTWRITEBYTECODE: "1"
|
||||||
|
SOPS_AGE_KEY_FILE: "{{.AGE_FILE}}"
|
||||||
|
VIRTUAL_ENV: "{{.ROOT_DIR}}/.venv"
|
||||||
|
|
||||||
includes:
|
includes:
|
||||||
ansible: .taskfiles/Ansible/Taskfile.yaml
|
ansible: .taskfiles/Ansible/Taskfile.yaml
|
||||||
@@ -62,9 +66,9 @@ tasks:
|
|||||||
|
|
||||||
.template:
|
.template:
|
||||||
internal: true
|
internal: true
|
||||||
cmd: ./.venv/bin/makejinja
|
cmd: "{{.VIRTUAL_ENV}}/bin/makejinja"
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "Missing virtual environment", sh: "test -d {{.ROOT_DIR}}/.venv" }
|
- { msg: "Missing virtual environment", sh: "test -d {{.VIRTUAL_ENV}}" }
|
||||||
- { msg: "Missing Makejinja config file", sh: "test -f {{.MAKEJINJA_CONFIG_FILE}}" }
|
- { msg: "Missing Makejinja config file", sh: "test -f {{.MAKEJINJA_CONFIG_FILE}}" }
|
||||||
- { msg: "Missing Makejinja plugin file", sh: "test -f {{.BOOTSTRAP_DIR}}/scripts/plugin.py" }
|
- { msg: "Missing Makejinja plugin file", sh: "test -f {{.BOOTSTRAP_DIR}}/scripts/plugin.py" }
|
||||||
- { msg: "Missing bootstrap config file", sh: "test -f {{.BOOTSTRAP_CONFIG_FILE}}" }
|
- { msg: "Missing bootstrap config file", sh: "test -f {{.BOOTSTRAP_CONFIG_FILE}}" }
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ def _validate_node(node: dict, node_cidr: str, distribution: str) -> None:
|
|||||||
raise ValueError(f"A node is missing a name")
|
raise ValueError(f"A node is missing a name")
|
||||||
if not node.get("ssh", {}).get("username") and distribution in ["k0s", "k3s"]:
|
if not node.get("ssh", {}).get("username") and distribution in ["k0s", "k3s"]:
|
||||||
raise ValueError(f"Node {node.get('name')} is missing a SSH username")
|
raise ValueError(f"Node {node.get('name')} is missing a SSH username")
|
||||||
if not node.get("disk_device") and distribution in ["talos"]:
|
if not node.get("talos", {}).get("disk_device") and distribution in ["talos"]:
|
||||||
raise ValueError(f"Node {node.get('name')} is missing a disk device")
|
raise ValueError(f"Node {node.get('name')} is missing a disk device")
|
||||||
if not re.match(r"^[a-z0-9-\.]+$", node.get('name')):
|
if not re.match(r"^[a-z0-9-\.]+$", node.get('name')):
|
||||||
raise ValueError(f"Node {node.get('name')} has an invalid name")
|
raise ValueError(f"Node {node.get('name')} has an invalid name")
|
||||||
|
|||||||
Reference in new issue
Block a user