25 lines
690 B
Makefile
25 lines
690 B
Makefile
|
# Password size
|
||
|
size ?= 256
|
||
|
# Password
|
||
|
password ?= $(shell pwgen -1s $(size))
|
||
|
|
||
|
alpines: inventory.yml
|
||
|
ansible-playbook -i $< --vault-pass-file vault.key alpines.yml
|
||
|
|
||
|
dockers: inventory.yml
|
||
|
ansible-playbook -i $< --vault-pass-file vault.key dockers.yml
|
||
|
|
||
|
inventory: inventory.yml
|
||
|
ansible-inventory -i $< --list
|
||
|
|
||
|
encrypt-string: vault.key
|
||
|
@echo name=\"$(name)\" is the variable name
|
||
|
@test -n "$(name)"
|
||
|
@echo host=\"$(host)\" is a host file
|
||
|
@test -f "host_vars/$(host).yml"
|
||
|
@ansible-vault encrypt_string "$(password)" --name "$(name)" --vault-pass-file $< >> "host_vars/$(host).yml"
|
||
|
|
||
|
vault.key:
|
||
|
@echo Creating a vault password on $@. Keep this file safe!
|
||
|
@echo -n "$(password)" > $@
|