-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
77 lines (69 loc) · 1.94 KB
/
Taskfile.yml
File metadata and controls
77 lines (69 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
includes:
git-hooks: ./scripts/git-hooks.taskfile.yml
lint: ./scripts/lint.taskfile.yml
setup: ./scripts/setup.taskfile.yml
vars:
BECOME_PASSWORD_FILE: become-password.secret
VAULT_PASSWORD_FILE: vault-password.txt
env:
ANSIBLE_FORCE_COLOR: "true"
tasks:
help:
desc: List all tasks
aliases:
- default
cmds:
- task --list-all
clean:
desc: Remove artifacts.
deps:
- git-hooks:clean
- clean:python
cmds:
- rm -v "{{.VAULT_PASSWORD_FILE}}" "{{.BECOME_PASSWORD_FILE}}" || true
clean:python:
desc: Remove Python stuff.
cmds:
- uv cache clean
- uv sync --reinstall
install:
desc: Install dependencies.
deps:
- git-hooks:build
cmds:
# Install Xcode for Homebrew.
- xcode-select --install || true
# Install Homebrew.
- >-
command -v brew > /dev/null || { /bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; }
# Install uv.
- command -v uv > /dev/null || { brew install uv; }
# Install target Python version.
- uv python install
# Install Python dependencies from Pipfile.
- uv sync
# Install Ansible collections and modules.
- uv run ansible-galaxy install --role-file requirements.yml
run:
desc: Run Ansible playbook.
deps:
- setup:become-password
- setup:vault-password
- install
vars:
PLAYBOOK: main.yml
ANSIBLE_PYTHON_INTERPRETER:
sh: which python3
# Force buffering to stdout.
# Somehow, PYTHONUNBUFFERED did not help.
interactive: true
cmds:
- >-
uv run ansible-playbook {{.PLAYBOOK}}
--extra-vars="ansible_python_interpreter={{.ANSIBLE_PYTHON_INTERPRETER}}"
--inventory inventory
--vault-password-file {{.VAULT_PASSWORD_FILE}}
{{.CLI_ARGS}}