Files

40 lines
1.2 KiB
YAML

name: Setup K8S Environment
description: Prepare the environment for A13labs CI/CD pipelines
inputs:
access-token:
description: "Bitwarden access token"
required: true
project-id:
description: "Bitwarden project ID"
required: true
organization-id:
description: "Bitwarden organization ID"
required: true
ansible-user:
description: "The user to use for Ansible"
required: true
target-host:
description: "The target host to read the system ID"
default: "microk8s"
outputs:
system-id:
description: "The system ID of the target host"
value: ${{ steps.get-system-id.outputs.system-id }}
runs:
using: "composite"
steps:
- name: Get System ID
id: get-system-id
shell: bash
env:
BW_ACCESS_TOKEN: ${{ inputs.access-token }}
BW_PROJECT_ID: ${{ inputs.project-id }}
BW_ORGANIZATION_ID: ${{ inputs.organization-id }}
ANSIBLE_USER: ${{ inputs.ansible-user }}
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
TARGET_HOST: ${{ inputs.target-host }}
run: |
system_id=$(ansible -i inventory/hosts -b -u $ANSIBLE_USER -m shell -a "read_system_id" $TARGET_HOST | tail -1)
echo "system-id=$system_id" >> $GITHUB_OUTPUT