Ansible --04- Uptime #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Ansible -- Uptime | |
on: | |
workflow_dispatch: | |
inputs: | |
hosts: | |
description: 'The value for the variable_host argument' | |
required: true | |
default: 'none' | |
verbosity: | |
description: 'The verbosity level for logs' | |
required: true | |
type: choice | |
default: '-v' | |
options: | |
- '-v' | |
- '-vv' | |
- '-vvv' | |
serial: | |
description: 'The value for the variable_serial argument' | |
required: true | |
default: 1 | |
type: number | |
jobs: | |
run_playbook: | |
name: Run Play | |
runs-on: ubuntu-latest | |
env: | |
WORKING_DIR: './ansible' | |
LINODE_API_TOKEN: ${{ secrets.LINODE_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 | |
- name: Setup Ansible and Dependencies | |
working-directory: ${{ env.WORKING_DIR }} | |
run: | | |
make install | |
ansible --version | |
- name: Set up SSH key | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_for_ansible.pem | |
chmod 600 ~/.ssh/id_for_ansible.pem | |
- name: Play -- Uptime | |
working-directory: ${{ env.WORKING_DIR }} | |
run: | | |
ansible-playbook play-any--uptime.yml \ | |
--private-key=~/.ssh/id_for_ansible.pem \ | |
-e "variable_host=${{ github.event.inputs.hosts }}" \ | |
-e "variable_serial=${{ github.event.inputs.serial }}" \ | |
${{ github.event.inputs.verbosity }} |