]> git.phdru.name Git - ansible.git/commitdiff
Feat(run-role): Run a role using a universal playbook
authorOleg Broytman <phd@phdru.name>
Tue, 16 Jul 2019 19:32:06 +0000 (22:32 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 16 Jul 2019 23:57:08 +0000 (02:57 +0300)
playbooks/debian-init-system.sh
playbooks/debian-init-system.yml
playbooks/debian-init-user-phd.yml [deleted file]
playbooks/run-role [new file with mode: 0755]
playbooks/run-role.yml [moved from playbooks/debian-logcheck.yml with 53% similarity]

index bc2cc93c543e35ca687f6f1fac95459569b9e5e5..3ff2524b1def932fad9f397468bfebebc2b654d4 100755 (executable)
@@ -4,5 +4,4 @@ cd "`dirname \"$0\"`" &&
 
 # Passwordless access isn't configured yet; use `ssh` connection sharing.
 # `sudo` isn't configured yet too; use `su` and ask for root password.
-exec ansible-playbook debian-init-system.yml debian-init-user-phd.yml \
-   "$@" --become-method=su -Kv
+exec ansible-playbook debian-init-system.yml "$@" --become-method=su -Kv
index 61be2f431693c47e14c53b24601cdae6fa7400a0..1418f14c45277855dd4a1b8df6f52b36aa851234 100644 (file)
@@ -4,3 +4,4 @@
   roles:
     - debian-init-system
     - debian-sudo
+    - debian-phd
diff --git a/playbooks/debian-init-user-phd.yml b/playbooks/debian-init-user-phd.yml
deleted file mode 100644 (file)
index d14f4af..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-- name: Create user phd
-  hosts: "{{ hosts | default('servers') }}"
-  gather_facts: false
-  roles:
-    - debian-phd
diff --git a/playbooks/run-role b/playbooks/run-role
new file mode 100755 (executable)
index 0000000..f2ea245
--- /dev/null
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+if [ -z "$1" ]; then
+   echo "Usage: $0 role" >&2
+   exit 1
+fi
+
+role="$1"
+shift
+
+cd "`dirname \"$0\"`" &&
+ansible-playbook run-role.yml "$@" -e role="$role"
similarity index 53%
rename from playbooks/debian-logcheck.yml
rename to playbooks/run-role.yml
index 1311f450cedaabf8031139eb035e0a361e4c18f0..bc179640cb6e2d762434f97ce3e75a59ff8b831f 100644 (file)
@@ -1,5 +1,5 @@
-- name: Update logcheck ignore patterns
+- name: "Run role {{ role }}"
   hosts: "{{ hosts | default('all') }}"
   gather_facts: false
   roles:
-    - debian-logcheck
+    - "{{ role }}"