add bare ansible config
This commit is contained in:
46
ansible/Makefile
Normal file
46
ansible/Makefile
Normal file
@@ -0,0 +1,46 @@
|
||||
hosts = $(wildcard host_vars/*.yml)
|
||||
|
||||
logs = $(patsubst host_vars/%.yml, logs/%.json, $(hosts) )
|
||||
|
||||
playbooks = $(wildcard playbooks/*.yml)
|
||||
plays = $(patsubst playbooks/%.yml, %, $(playbooks) )
|
||||
|
||||
defaults += $(wildcard logs/*)
|
||||
|
||||
###### Recipes ######
|
||||
|
||||
.PHONY: help
|
||||
help: ## Print the help message.
|
||||
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | \
|
||||
column -s ':' -t
|
||||
|
||||
.PHONY: lint
|
||||
lint: $(playbooks) | .ansible/ ## Check syntax and lint all playbooks
|
||||
ansible-playbook --syntax-check $^
|
||||
ansible-lint $^
|
||||
|
||||
.PHONY: records
|
||||
records: $(logs) ## Current info on each host
|
||||
|
||||
$(logs): logs/%.json: | logs/
|
||||
ansible -m setup $(basename $(@F) ) > $@
|
||||
|
||||
-include logs/play.mk
|
||||
|
||||
make_play = printf '.PHONY: %s\n%s: %s \#\# %s\n\n' '$(notdir $(basename $1) )' '$(notdir $(basename $1) )' '$1' '$(shell grep -m1 -oP 'name: \K.*' $1)'
|
||||
|
||||
logs/play.mk: playbooks/*.yml
|
||||
@$(RM) $@
|
||||
@$(foreach book, $^, \
|
||||
$(call make_play, $(book), $@ ) >> $@ ; \
|
||||
printf '\t%s\n\n' 'ansible-playbook $(book)' >> $@ ; \
|
||||
)
|
||||
|
||||
%/:
|
||||
mkdir $@
|
||||
echo '*' > $@.gitignore
|
||||
|
||||
.PHONY: clean
|
||||
clean: ## Remove generated files.
|
||||
$(RM) $(defaults)
|
||||
|
||||
7
ansible/ansible.cfg
Normal file
7
ansible/ansible.cfg
Normal file
@@ -0,0 +1,7 @@
|
||||
[defaults]
|
||||
inventory = hosts.yaml
|
||||
local_tmp = .ansible
|
||||
cow_selection = random
|
||||
vault_password_file = pass.sh
|
||||
interpreter_python = auto_silent
|
||||
|
||||
6
ansible/host_vars/nimbus.yml
Normal file
6
ansible/host_vars/nimbus.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
61386535643036336233373332346437666166373335343732653734326465373430306464363066
|
||||
6337326238633966623333393864363639343965373138300a633964306639343165613266646136
|
||||
61646462656362306661343662343864613866323965323165393661646665393838343735313434
|
||||
6631646531396662310a393761643537626436303965636563643534643565366436393233353662
|
||||
3965
|
||||
16
ansible/hosts.yaml
Normal file
16
ansible/hosts.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
all:
|
||||
vars:
|
||||
username: dmz
|
||||
locale: Europe/Belgrade
|
||||
libc_locale: en_GB.UTF-8 UTF-8
|
||||
var_locale: LANG=en_GB.UTF-8
|
||||
|
||||
ungrouped:
|
||||
hosts:
|
||||
nimbus:
|
||||
cloud:
|
||||
hosts:
|
||||
nimbus:
|
||||
arch:
|
||||
hosts:
|
||||
nimbus:
|
||||
3
ansible/pass.sh
Executable file
3
ansible/pass.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
pass dmz/xecut/dmz_ansible
|
||||
Reference in New Issue
Block a user