From dd6fb1cf502185690b3192b36c6d3bee8ea73f68 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Mon, 26 Jan 2026 21:00:47 +0100 Subject: [PATCH] add bare ansible config --- ansible/Makefile | 46 ++++++++++++++++++++++++++++++++++++ ansible/ansible.cfg | 7 ++++++ ansible/host_vars/nimbus.yml | 6 +++++ ansible/hosts.yaml | 16 +++++++++++++ ansible/pass.sh | 3 +++ 5 files changed, 78 insertions(+) create mode 100644 ansible/Makefile create mode 100644 ansible/ansible.cfg create mode 100644 ansible/host_vars/nimbus.yml create mode 100644 ansible/hosts.yaml create mode 100755 ansible/pass.sh diff --git a/ansible/Makefile b/ansible/Makefile new file mode 100644 index 0000000..df2ccd3 --- /dev/null +++ b/ansible/Makefile @@ -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) + diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg new file mode 100644 index 0000000..b2865a5 --- /dev/null +++ b/ansible/ansible.cfg @@ -0,0 +1,7 @@ +[defaults] +inventory = hosts.yaml +local_tmp = .ansible +cow_selection = random +vault_password_file = pass.sh +interpreter_python = auto_silent + diff --git a/ansible/host_vars/nimbus.yml b/ansible/host_vars/nimbus.yml new file mode 100644 index 0000000..4fff5ae --- /dev/null +++ b/ansible/host_vars/nimbus.yml @@ -0,0 +1,6 @@ +$ANSIBLE_VAULT;1.1;AES256 +61386535643036336233373332346437666166373335343732653734326465373430306464363066 +6337326238633966623333393864363639343965373138300a633964306639343165613266646136 +61646462656362306661343662343864613866323965323165393661646665393838343735313434 +6631646531396662310a393761643537626436303965636563643534643565366436393233353662 +3965 diff --git a/ansible/hosts.yaml b/ansible/hosts.yaml new file mode 100644 index 0000000..da7a006 --- /dev/null +++ b/ansible/hosts.yaml @@ -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: diff --git a/ansible/pass.sh b/ansible/pass.sh new file mode 100755 index 0000000..f97c7ef --- /dev/null +++ b/ansible/pass.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +pass dmz/xecut/dmz_ansible