From: Oleg Broytman Date: Tue, 16 Jul 2019 19:32:06 +0000 (+0300) Subject: Feat(run-role): Run a role using a universal playbook X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=9a901b798b4dd29afa0ebed585652675d58e6e8d;p=ansible.git Feat(run-role): Run a role using a universal playbook --- diff --git a/playbooks/debian-init-system.sh b/playbooks/debian-init-system.sh index bc2cc93..3ff2524 100755 --- a/playbooks/debian-init-system.sh +++ b/playbooks/debian-init-system.sh @@ -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 diff --git a/playbooks/debian-init-system.yml b/playbooks/debian-init-system.yml index 61be2f4..1418f14 100644 --- a/playbooks/debian-init-system.yml +++ b/playbooks/debian-init-system.yml @@ -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 index d14f4af..0000000 --- a/playbooks/debian-init-user-phd.yml +++ /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 index 0000000..f2ea245 --- /dev/null +++ b/playbooks/run-role @@ -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" diff --git a/playbooks/debian-logcheck.yml b/playbooks/run-role.yml similarity index 53% rename from playbooks/debian-logcheck.yml rename to playbooks/run-role.yml index 1311f45..bc17964 100644 --- a/playbooks/debian-logcheck.yml +++ b/playbooks/run-role.yml @@ -1,5 +1,5 @@ -- name: Update logcheck ignore patterns +- name: "Run role {{ role }}" hosts: "{{ hosts | default('all') }}" gather_facts: false roles: - - debian-logcheck + - "{{ role }}"