feat: replace ansible templating with makejinja (#1156)
This commit is contained in:
1 parent
a4731906d9
commit
f9481d6202
114 files changed
+555
-906
No files matched your search
@@ -11,7 +11,7 @@ env:
|
||||
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,community.sops.sops"
|
||||
ANSIBLE_VARS_ENABLED: "host_group_vars"
|
||||
ANSIBLE_LOCALHOST_WARNING: "False"
|
||||
ANSIBLE_INVENTORY_UNPARSED_WARNING: "False"
|
||||
|
||||
|
||||
@@ -10,14 +10,14 @@ tasks:
|
||||
kubeconfig:
|
||||
desc: Gets k0s cluster kubeconfig
|
||||
cmds:
|
||||
- k0sctl kubeconfig --config k0s-config.yaml > kubeconfig
|
||||
- k0sctl kubeconfig --config {{.ROOT_DIR}}/k0s-config.yaml > kubeconfig
|
||||
preconditions:
|
||||
- { msg: "k0s-config.yaml not found", sh: "test -f {{.ROOT_DIR}}/k0s-config.yaml" }
|
||||
|
||||
apply:
|
||||
desc: Apply k0s cluster k0s-config.yaml
|
||||
cmds:
|
||||
- k0sctl apply --config k0s-config.yaml
|
||||
- k0sctl apply --config {{.ROOT_DIR}}/k0s-config.yaml
|
||||
- task: kubeconfig
|
||||
preconditions:
|
||||
- { msg: "k0s-config.yaml not found", sh: "test -f {{.ROOT_DIR}}/k0s-config.yaml" }
|
||||
@@ -25,7 +25,7 @@ tasks:
|
||||
reset:
|
||||
desc: Resets the k0s cluster
|
||||
cmds:
|
||||
- k0sctl reset --config k0s-config.yaml
|
||||
- k0sctl reset --config {{.ROOT_DIR}}/k0s-config.yaml
|
||||
- task: :ansible:run
|
||||
vars:
|
||||
playbook: cluster-nuke
|
||||
|
||||
@@ -12,28 +12,28 @@ tasks:
|
||||
- rm -rf {{.ROOT_DIR}}/.github/workflows/e2e.yaml
|
||||
# Move bootstrap directory to gitignored directory
|
||||
- mkdir -p {{.ROOT_DIR}}/.private
|
||||
- mv {{.ROOT_DIR}}/bootstrap {{.ROOT_DIR}}/.private/bootstrap-{{now | date "150405"}}
|
||||
- mv {{.BOOTSTRAP_DIR}} {{.ROOT_DIR}}/.private/bootstrap-{{now | date "150405"}}
|
||||
# Update renovate.json5
|
||||
- sed -i {{if eq OS "darwin"}}''{{end}} 's/(..\.j2)\?(..\.j2)\?//g' {{.ROOT_DIR}}/.github/renovate.json5
|
||||
- sed -i {{if eq OS "darwin"}}''{{end}} '/addons/d' {{.ROOT_DIR}}/.github/renovate.json5
|
||||
preconditions:
|
||||
- { msg: "bootstrap dir not found", sh: "test -d {{.ROOT_DIR}}/bootstrap" }
|
||||
- { msg: "bootstrap dir not found", sh: "test -d {{.BOOTSTRAP_DIR}}" }
|
||||
- { msg: "renovate.json5 not found", sh: "test -f {{.ROOT_DIR}}/.github/renovate.json5" }
|
||||
|
||||
reset:
|
||||
desc: Remove templated configuration files
|
||||
prompt: Remove templated configuration files... continue?
|
||||
desc: Reset templated configuration files
|
||||
prompt: Reset templated configuration files... continue?
|
||||
cmds:
|
||||
- rm -rf {{.ROOT_DIR}}/.sops.yaml
|
||||
- rm -rf {{.ROOT_DIR}}/k0s-config.yaml
|
||||
- rm -rf {{.ROOT_DIR}}/ansible
|
||||
- rm -rf {{.ROOT_DIR}}/kubernetes
|
||||
- rm -rf {{.ANSIBLE_DIR}}
|
||||
- rm -rf {{.KUBERNETES_DIR}}
|
||||
|
||||
reset-repo:
|
||||
desc: Set repo back to HEAD
|
||||
prompt: Set repo back to HEAD... continue?
|
||||
force-reset:
|
||||
desc: Reset repo back to HEAD
|
||||
prompt: Reset repo back to HEAD... continue?
|
||||
cmds:
|
||||
- task: reset
|
||||
- git reset --hard HEAD
|
||||
- git clean -f -d
|
||||
- git pull
|
||||
- git pull origin main
|
||||
@@ -12,7 +12,6 @@ tasks:
|
||||
|
||||
encrypt:
|
||||
desc: Encrypt a secret
|
||||
aliases: ["e"]
|
||||
summary: |
|
||||
Args:
|
||||
file: Path to file to encrypt (required)
|
||||
@@ -23,15 +22,13 @@ tasks:
|
||||
- { msg: "Sops config not found", sh: "test -f {{.ROOT_DIR}}/.sops.yaml" }
|
||||
- { msg: "Age key not found", sh: "test -f {{.ROOT_DIR}}/age.key" }
|
||||
|
||||
decrypt:
|
||||
desc: Decrypt a secret
|
||||
aliases: ["d"]
|
||||
summary: |
|
||||
Args:
|
||||
file: Path to file to decrypt (required)
|
||||
cmd: sops --decrypt --in-place {{.SECRET}}
|
||||
encrypt:all:
|
||||
desc: Encrypt all Kubernetes SOPS secrets
|
||||
cmds:
|
||||
- for: { var: file }
|
||||
task: encrypt
|
||||
vars:
|
||||
file: '{{.ITEM}}'
|
||||
vars:
|
||||
claim: '{{ or .file (fail "Argument (file) is required") }}'
|
||||
preconditions:
|
||||
- { msg: "Sops config not found", sh: "test -f {{.ROOT_DIR}}/.sops.yaml" }
|
||||
- { msg: "Age key not found", sh: "test -f {{.ROOT_DIR}}/age.key" }
|
||||
file:
|
||||
sh: find {{.KUBERNETES_DIR}} -type f -name "*.sops.*"
|
||||
@@ -1,17 +1,15 @@
|
||||
age
|
||||
cilium-cli
|
||||
cloudflared-bin
|
||||
direnv
|
||||
flux-bin
|
||||
go-task
|
||||
go-yq
|
||||
helm
|
||||
jq
|
||||
k0sctl-bin
|
||||
k9s
|
||||
kubeconform
|
||||
kubectl-bin
|
||||
kustomize
|
||||
moreutils
|
||||
sops
|
||||
stern-bin
|
||||
go-task
|
||||
go-yq
|
||||
@@ -1,18 +1,15 @@
|
||||
tap "fluxcd/tap"
|
||||
tap "go-task/tap"
|
||||
tap "k0sproject/tap"
|
||||
tap "kubecolor/tap"
|
||||
brew "age"
|
||||
brew "cilium-cli"
|
||||
brew "cloudflared"
|
||||
brew "direnv"
|
||||
brew "fluxcd/tap/flux"
|
||||
brew "go-task/tap/go-task"
|
||||
brew "helm"
|
||||
brew "jq"
|
||||
brew "k0sproject/tap/k0sctl"
|
||||
brew "k9s"
|
||||
brew "kubeconform"
|
||||
brew "kubecolor/tap/kubecolor"
|
||||
brew "kubernetes-cli"
|
||||
brew "kustomize"
|
||||
brew "moreutils"
|
||||
|
||||
@@ -14,8 +14,18 @@ tasks:
|
||||
Head over to https://brew.sh to get up and running.
|
||||
- { msg: "Brewfile not found", sh: "test -f {{.ROOT_DIR}}/.taskfiles/Workstation/Brewfile" }
|
||||
|
||||
yay:
|
||||
paru:
|
||||
desc: Install workstation dependencies with Paru
|
||||
cmd: paru -Syu --needed --noconfirm --noprogressbar $(cat {{.ROOT_DIR}}/.taskfiles/Workstation/ArchPackages | xargs)
|
||||
preconditions:
|
||||
- sh: command -v paru
|
||||
msg: |
|
||||
Paru is not installed. Using ArchLinux?
|
||||
Head over to https://github.com/Morganamilo/paru to get up and running.
|
||||
- { msg: "ArchPackages not found", sh: "test -f {{.ROOT_DIR}}/.taskfiles/Workstation/ArchPackages" }
|
||||
|
||||
yay:
|
||||
desc: Install workstation dependencies with Yay
|
||||
cmd: yay -Syu --needed --noconfirm --noprogressbar $(cat {{.ROOT_DIR}}/.taskfiles/Workstation/ArchPackages | xargs)
|
||||
preconditions:
|
||||
- sh: command -v yay
|
||||
|
||||
Reference in new issue
Block a user