-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (42 loc) · 1.66 KB
/
Copy pathMakefile
File metadata and controls
60 lines (42 loc) · 1.66 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
SHELL := /usr/bin/env bash
INVENTORY_ARGS := -i inventory/static_hosts.yml -i inventory/proxmox_guest_agent.py
PLAYBOOK := playbooks/update_ubuntu.yml
ANSIBLE := .venv/bin/ansible
ANSIBLE_INVENTORY := .venv/bin/ansible-inventory
ENV_FILE ?= .env
EXTRA_ARGS ?=
LIMIT ?=
ifneq ($(strip $(LIMIT)),)
LIMIT_ARGS := --limit $(LIMIT)
endif
define LOAD_ENV
if [[ ! -f "$(ENV_FILE)" ]]; then echo "Missing $(ENV_FILE). Copy .env.example to .env and fill in values." >&2; exit 1; fi; set -a; source "$(ENV_FILE)"; set +a; export PATH="$(CURDIR)/.venv/bin:$$PATH"; export ANSIBLE_REMOTE_USER="$${ANSIBLE_SSH_USER:-ansible}";
endef
.PHONY: bootstrap create-user known-hosts inventory ping update dry-run install-cron syntax-check static-inventory-check shell-check email-check known-hosts-check test
bootstrap:
./scripts/bootstrap.sh
create-user:
./scripts/create_ansible_user.sh $(EXTRA_ARGS)
known-hosts:
./scripts/seed_known_hosts.sh
inventory:
@$(LOAD_ENV) $(ANSIBLE_INVENTORY) $(INVENTORY_ARGS) --list $(EXTRA_ARGS)
static-inventory-check:
$(ANSIBLE_INVENTORY) -i inventory/static_hosts.yml --list
ping:
@$(LOAD_ENV) $(ANSIBLE) $(INVENTORY_ARGS) linux_update_targets -m ping $(LIMIT_ARGS) $(EXTRA_ARGS)
update:
./scripts/run_updates.sh $(LIMIT_ARGS) $(EXTRA_ARGS)
dry-run:
./scripts/run_updates.sh --check --diff $(LIMIT_ARGS) $(EXTRA_ARGS)
install-cron:
./scripts/install_cron.sh $(EXTRA_ARGS)
syntax-check:
.venv/bin/ansible-playbook -i tests/syntax_inventory.yml --syntax-check $(PLAYBOOK)
shell-check:
tests/shell_checks.sh
email-check:
tests/email_summary_checks.py
known-hosts-check:
tests/known_hosts_checks.py
test: shell-check email-check known-hosts-check syntax-check