-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
61 lines (47 loc) · 1.74 KB
/
Copy pathJustfile
File metadata and controls
61 lines (47 loc) · 1.74 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
# Workstation — machine state management
# Usage: just <recipe> (e.g. just apply, just plan, just role shell)
set shell := ["bash", "-euo", "pipefail", "-c"]
yml_file := "site.yml"
# Full state apply (packages + configs + services)
apply:
ansible-playbook {{yml_file}} --ask-become-pass --diff
# Deploy only configs (no package installs, no sudo)
sync:
ansible-playbook {{yml_file}} --ask-become-pass --tags config --diff
# Dry-run: show what would change
plan:
ansible-playbook {{yml_file}} --ask-become-pass --check --diff
# Apply specific role(s): just role shell desktop
role +TAGS:
ansible-playbook {{yml_file}} --ask-become-pass --tags {{ TAGS }} --diff
# Install ansible-galaxy requirements
deps:
ansible-galaxy collection install -r requirements.yml
# Edit encrypted secrets
vault-edit:
ansible-vault edit vault/secrets.yml
# Create encrypted vault file from example template
vault-encrypt:
@if [ ! -f vault/secrets.yml ]; then \
echo "Error: vault/secrets.yml not found. Please create it from vault/secrets.yml.example and add your secrets before encrypting."; \
exit 1; \
fi
ansible-vault encrypt vault/secrets.yml
# Create vault password file (first-time setup)
vault-init:
@echo "Enter vault password:"
@read -s pass && echo "$$pass" > .vault-password
@chmod 600 .vault-password
@echo "Created .vault-password"
# Show systemd user services status
services:
systemctl --user list-units --type=service --type=timer --state=running --no-pager
# Run molecule tests (requires: pip install -r requirements-dev.txt)
molecule:
molecule test
# Lint all playbooks and roles
lint:
ansible-lint {{yml_file}}
# Validate syntax only
check:
ansible-playbook {{yml_file}} --syntax-check