aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-04-17 17:57:17 +0200
committerRomain Gonçalves <me@rgoncalves.se>2021-04-17 17:57:17 +0200
commit24edb45881ac7a469f0c3fdcda6fd26edb199120 (patch)
treec54615fdb11b2d3868425033336ff84ac04f5b32
parent138c194c45de4e36b9852c8eeadd49f4a30efa30 (diff)
downloadinfrastructure-24edb45881ac7a469f0c3fdcda6fd26edb199120.tar.gz
Makefile: Fire hosts quickly
-rw-r--r--Makefile27
1 files changed, 27 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..9a33226
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,27 @@
+# Ansible Makefile
+#
+# ~ rgoncalves.se
+#
+# Why:
+# I don't want to always run `ansible-playbook playbooks/playbook-name.yml`,
+# I am tired of it.
+#
+# Some inspiration that might made its way here -or will-:
+# - https://github.com/paulRbr/ansible-makefile/blob/master/Makefile
+# - https://dreisbach.us/articles/simple-ansible-makefile/
+
+PLAYBOOK_DIR = playbooks
+PLAYBOOKS != find $(PLAYBOOK_DIR) -iname "*.yml" | \
+ sed 's/^$(PLAYBOOK_DIR)\///g' | \
+ sed 's/.yml//g'
+.PHONY: $(PLAYBOOKS)
+
+_debug:
+ @echo "available tasks:"
+ @echo $(PLAYBOOKS) | \
+ tr " " "\n" | \
+ sed 's/^/- /g' | \
+ sort
+
+$(PLAYBOOKS):
+ ansible-playbook $(PLAYBOOK_DIR)/$@.yml
remember that computers suck.