56 lines
1.6 KiB
Makefile
56 lines
1.6 KiB
Makefile
venv_bin := "venv/bin"
|
|
|
|
# List available commands
|
|
default:
|
|
@just --list
|
|
|
|
# Create the Python virtualenv used to run ansible
|
|
venv:
|
|
python3 -m venv venv
|
|
{{venv_bin}}/pip install --upgrade pip
|
|
|
|
# Install Python deps (requirements.txt) and Galaxy collections (requirements.yml)
|
|
install:
|
|
{{venv_bin}}/pip install -r requirements.txt
|
|
{{venv_bin}}/ansible-galaxy collection install -r requirements.yml < /dev/null
|
|
|
|
# Ping all hosts, or a group/host, e.g. `just ping kitchenpi`
|
|
ping group="all":
|
|
{{venv_bin}}/ansible {{group}} -m ping
|
|
|
|
# Show the resolved inventory as a tree
|
|
inventory:
|
|
{{venv_bin}}/ansible-inventory --graph
|
|
|
|
# Syntax-check a playbook, e.g. `just syntax mediapis.yml`
|
|
syntax playbook:
|
|
{{venv_bin}}/ansible-playbook {{playbook}} --syntax-check
|
|
|
|
# Dry-run a playbook against a host/group without making changes
|
|
check playbook limit="all":
|
|
{{venv_bin}}/ansible-playbook {{playbook}} --limit {{limit}} --check --diff
|
|
|
|
# Run a playbook against a host/group, e.g. `just run mediapis.yml kitchenpi`
|
|
run playbook limit="all":
|
|
{{venv_bin}}/ansible-playbook {{playbook}} --limit {{limit}}
|
|
|
|
# Run mediapis.yml (pi roles) against one host/group, e.g. `just mediapis kitchenpi`
|
|
mediapis limit="all":
|
|
just run mediapis.yml {{limit}}
|
|
|
|
# Run server.yml against the server host
|
|
server:
|
|
just run server.yml server
|
|
|
|
# Run the deliberate fleet package-update playbook, e.g. `just update kitchenpi`
|
|
update limit="all":
|
|
just run update-packages.yml {{limit}}
|
|
|
|
# List installed Galaxy collections
|
|
collections:
|
|
{{venv_bin}}/ansible-galaxy collection list
|
|
|
|
# Lint playbooks and roles
|
|
lint:
|
|
{{venv_bin}}/ansible-lint
|