Skip to content
name: Configure Image Factory VM
on:
push:
paths:
- ".github/workflows/ansible-configure-if-vm.yml"
- "ansible/**"
workflow_dispatch:
jobs:
configure-vm:
runs-on: ubuntu-latest
env:
JUMPHOST_IP: ${{ secrets.JUMPHOST_IP }}
RUNNER_HOST_IP: ${{ secrets.RUNNER_HOST_IP }}
SSH_KEY: ${{ secrets.SSH_KEY }}
REGISTRY: ${{ secrets.REGISTRY_PRIVATE_ENDPOINT }}
ACR_USERNAME: ${{ secrets.ACR_USERNAME }}
ACR_PASSWORD: ${{ secrets.ACR_PASSWORD }}
GH_PAT_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
GH_OWNER: ${{ vars.GH_OWNER }}
GH_REPO: ${{ vars.GH_REPO }}
ACR_RUNNER_IMAGE_NAME: ${{ vars.ACR_RUNNER_IMAGE_NAME }}
ANSIBLE_VERSION: 2.17.4
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Template Ansible private key file
uses: cuchi/[email protected]
with:
template: ansible/templates/ansible_ssh_key.j2
output_file: ansible/ansible_ssh_key
- run: |
chmod 600 ansible/ansible_ssh_key
ssh -o StrictHostKeyChecking=no -o ForwardAgent=yes -i ansible/ansible_ssh_key -J [email protected] [email protected] 'echo test'
# - name: Template Ansible vars file
# uses: cuchi/[email protected]
# with:
# template: ansible/templates/group_vars_all.yml.j2
# output_file: ansible/group_vars/all.yml
# - name: Template Ansible inventory
# uses: cuchi/[email protected]
# with:
# template: ansible/templates/inventory.ini.j2
# output_file: ansible/inventory.ini
# - name: Template Ansible private key file
# uses: cuchi/[email protected]
# with:
# template: ansible/templates/ansible_ssh_key.j2
# output_file: ansible/ansible_ssh_key
# - name: Install Ansible
# run: |
# pip3 install ansible
# - name: Print Ansible Version
# run: ansible-playbook --version
# - name: Configure VM with ansible
# run: |
# cd ansible
# eval "$(ssh-agent -s)"
# chmod 600 ansible_ssh_key
# ssh-add ansible_ssh_key
# cat inventory.ini
# ansible-playbook configure-image-factory-vm.yml
# # Test comment to trigger build #