2026-02-08 15:50:57 -05:00
SHELL := /bin/bash
INVENTORY ?= inventory.ini
2026-02-08 18:21:55 -05:00
PLAYBOOK ?= site.yml
2026-02-08 15:50:57 -05:00
EXTRA_VARS ?=
2026-02-08 18:21:55 -05:00
ANSIBLE ?= ansible-playbook
2026-02-08 15:50:57 -05:00
2026-02-08 21:41:17 -05:00
.PHONY : help ping check run dry -run diff vars tree clean prep bbb bbb -dry -run greenlight greenlight -dry -run
2026-02-08 15:50:57 -05:00
help :
@echo "Targets:"
@echo " make ping - ping hosts (Ansible)"
@echo " make check - syntax-check playbook"
@echo " make run - apply playbook"
@echo " make dry-run - check mode with diff (no changes)"
@echo " make diff - show diff of changes (implies --check)"
@echo " make vars - show vars for a host (requires host=...)"
@echo " make tree - show repository tree"
@echo ""
@echo "Examples:"
@echo " make run EXTRA_VARS='-e ssh_allow_cidrs_v4=[\"1.2.3.4/32\"]'"
@echo " make vars host=bbb"
2026-02-08 21:41:17 -05:00
@echo " make greenlight - installer/mettre à niveau Greenlight v3 (bbb-install -g)"
@echo " make greenlight-dry-run - check mode pour Greenlight"
2026-02-08 15:50:57 -05:00
ping :
ansible -i $( INVENTORY) vps -m ping
check :
$( ANSIBLE) -i $( INVENTORY) $( PLAYBOOK) --syntax-check
run :
$( ANSIBLE) -i $( INVENTORY) $( PLAYBOOK) --become $( EXTRA_VARS)
dry-run :
$( ANSIBLE) -i $( INVENTORY) $( PLAYBOOK) --become --check --diff $( EXTRA_VARS)
diff :
$( ANSIBLE) -i $( INVENTORY) $( PLAYBOOK) --become --check --diff $( EXTRA_VARS)
vars :
@if [ [ -z " $( host) " ] ] ; then echo "ERROR: host is required, e.g. make vars host=bbb" ; exit 2; fi
ansible -i $( INVENTORY) $( host) -m debug -a "var=hostvars[inventory_hostname]" | sed -n '1,200p'
tree :
2026-02-08 18:21:55 -05:00
@python3 -c $'import os\nfor root, dirs, files in os.walk("."):\n dirs[:] = [d for d in dirs if d not in {".git","__pycache__",".venv",".cache"}]\n level = root.count(os.sep)\n indent = " " * level\n print(f"{indent}{os.path.basename(root)}/")\n subindent = " " * (level + 1)\n for f in sorted(files):\n print(f"{subindent}{f}")'
2026-02-08 15:50:57 -05:00
clean :
@find . -name "*.retry" -delete
2026-02-08 20:47:25 -05:00
prep :
$( ANSIBLE) -i $( INVENTORY) $( PLAYBOOK) --become --tags prep $( EXTRA_VARS)
bbb :
$( ANSIBLE) -i $( INVENTORY) $( PLAYBOOK) --become --tags bbb $( EXTRA_VARS)
bbb-dry-run :
$( ANSIBLE) -i $( INVENTORY) $( PLAYBOOK) --become --tags bbb --check --diff $( EXTRA_VARS)
2026-02-08 21:41:17 -05:00
greenlight :
$( ANSIBLE) -i $( INVENTORY) $( PLAYBOOK) --become --tags bbb $( EXTRA_VARS) -e bbb_install_greenlight = true
greenlight-dry-run :
$( ANSIBLE) -i $( INVENTORY) $( PLAYBOOK) --become --tags bbb --check --diff $( EXTRA_VARS) -e bbb_install_greenlight = true