-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (66 loc) · 1.92 KB
/
Makefile
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
78
79
80
81
82
83
84
.PHONY: init run run-password run-debug run-check vault-create vault-edit clean get-info update-submodules
fetch_git_submodules:
git submodule update --init --recursive
update_git_submodules:
git submodule update --remote --merge
prepare_vault_password_file:
cp .vault_password.env.dist .vault_password.env
chmod 600 .vault_password.env
prepare_log_directory:
mkdir ./log
run:
ansible-playbook $(NODE).yml \
--inventory inventory.ini
run-init:
ansible-playbook $(NODE)_init.yml \
--inventory inventory_init.ini
run-local:
ansible-playbook $(NODE).yml \
--inventory inventory_local.ini
run-direct:
ansible-playbook $(PLAYBOOK).yml \
--connection "ssh" \
--user "root" \
--ask-pass \
--extra-vars "{target: $(ADDRESS)}" \
--inventory $(ADDRESS), \
--extra-vars "@./group_vars/all/vars.yml" \
--extra-vars "@./group_vars/all/vault.yml" \
--extra-vars "@./group_vars/$(PLAYBOOK)/vars.yml" \
--extra-vars "@./group_vars/$(PLAYBOOK)/vault.yml"
run-debug:
ansible-playbook $(NODE).yml -vvv
run-check:
ansible-playbook $(NODE).yml --check --diff
get-info:
ansible $(NODE) -m setup
get-info-direct:
ansible all \
--connection "ssh" \
--user "root" \
--ask-pass \
--inventory $(ADDRESS), \
--module-name setup
init: fetch_git_submodules \
ansible-collection-install \
prepare_vault_password_file \
prepare_log_directory
vault-create:
ifdef NODE
mkdir -p ./_external/secrets/group_vars/$(NODE)
ansible-vault create ./_external/secrets/group_vars/$(NODE)/vault.yml
else
mkdir -p ./_external/secrets/group_vars/all
ansible-vault create ./_external/secrets/group_vars/all/vault.yml
endif
vault-edit:
ifdef NODE
ansible-vault edit ./_external/secrets/group_vars/$(NODE)/vault.yml
else
ansible-vault edit ./_external/secrets/group_vars/all/vault.yml
endif
ansible-collection-install:
ansible-galaxy collection install -r ./requirements.yml
clean:
rm -rf ~/.ansible
update-submodules: update_git_submodules