fix: ansible taskfile ad-hoc tasks now have preconditions
Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
1 file changed
+12
@@ -40,21 +40,33 @@ tasks:
|
||||
desc: Shutdown all the k8s nodes
|
||||
deps: ["deps"]
|
||||
cmd: .venv/bin/ansible kubernetes -i {{.ANSIBLE_DIR}}/inventory/hosts.yaml -a '/usr/bin/systemctl poweroff' --become
|
||||
preconditions:
|
||||
- { msg: "Venv not found", sh: "test -d {{.ROOT_DIR}}/.venv" }
|
||||
- { msg: "Inventory not found", sh: "test -f {{.ANSIBLE_DIR}}/inventory/hosts.yaml" }
|
||||
|
||||
list:
|
||||
desc: List all the hosts
|
||||
deps: ["deps"]
|
||||
cmd: .venv/bin/ansible kubernetes -i {{.ANSIBLE_DIR}}/inventory/hosts.yaml --list-hosts
|
||||
preconditions:
|
||||
- { msg: "Venv not found", sh: "test -d {{.ROOT_DIR}}/.venv" }
|
||||
- { msg: "Inventory not found", sh: "test -f {{.ANSIBLE_DIR}}/inventory/hosts.yaml" }
|
||||
|
||||
ping:
|
||||
desc: Ping all the hosts
|
||||
deps: ["deps"]
|
||||
cmd: .venv/bin/ansible kubernetes -i {{.ANSIBLE_DIR}}/inventory/hosts.yaml --one-line -m 'ping'
|
||||
preconditions:
|
||||
- { msg: "Venv not found", sh: "test -d {{.ROOT_DIR}}/.venv" }
|
||||
- { msg: "Inventory not found", sh: "test -f {{.ANSIBLE_DIR}}/inventory/hosts.yaml" }
|
||||
|
||||
uptime:
|
||||
desc: Uptime of all the hosts
|
||||
deps: ["deps"]
|
||||
cmd: .venv/bin/ansible kubernetes -i {{.ANSIBLE_DIR}}/inventory/hosts.yaml --one-line -a 'uptime'
|
||||
preconditions:
|
||||
- { msg: "Venv not found", sh: "test -d {{.ROOT_DIR}}/.venv" }
|
||||
- { msg: "Inventory not found", sh: "test -f {{.ANSIBLE_DIR}}/inventory/hosts.yaml" }
|
||||
|
||||
.venv:
|
||||
internal: true
|
||||
|
||||
Reference in new issue
Block a user