diff --git a/composer.json b/composer.json index b902389..249bb90 100644 --- a/composer.json +++ b/composer.json @@ -9,5 +9,8 @@ } ], "homepage": "https://github.com/operations-project/site-runner", - "require": {} + "require": {}, + "bin": [ + "scripts/server-verify-self" + ] } diff --git a/roles/operations.runner/tasks/main.yml b/roles/operations.runner/tasks/main.yml index 9110a73..6f08992 100644 --- a/roles/operations.runner/tasks/main.yml +++ b/roles/operations.runner/tasks/main.yml @@ -28,4 +28,3 @@ - name: Configure GitHub Runners include_tasks: github.yml with_items: "{{ operations_github_runners }}" - diff --git a/scripts/server-verify-self b/scripts/server-verify-self new file mode 100755 index 0000000..a21590e --- /dev/null +++ b/scripts/server-verify-self @@ -0,0 +1,16 @@ +#!/usr/bin/bash + +# +# This generic script lets a server run the playbook limited to itself. +# +# Setup +# 1. Run a server/container with a FQDN hostname. eg. operations.local.computer +# 2. Add that host to the ansible inventory. +# 3. Run this script on the server you want to configure and it will use the variables from the operations.local.computer ansible host automatically + +set -e +echo "" +echo "> Running playbook for host $(hostname -f) ..." + +set -x +ansible-playbook vendor/operations/site-runner/playbook.yml --limit $(hostname -f) --connection local