Skip to content

Commit

Permalink
test new ansible setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Silvija Tovernic committed Sep 21, 2024
1 parent 323141c commit 79ca092
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions .github/workflows/ansible-configure-if-vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,42 @@ jobs:
output_file: ansible/inventory.ini


# - 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 vars file
uses: cuchi/[email protected]
with:
template: ansible/templates/group_vars_all.yml.j2
output_file: ansible/group_vars/all.yml

- name: Install Ansible and add SSH key for connection
run: |
pip3 install ansible
ansible-playbook --version
eval "$(ssh-agent -s)"
chmod 600 ansible/ansible_ssh_key
ssh-add ansible_ssh_key
- name: Test connection to air-gapped VM (needed populate known_hosts file)
if: env.VM_ENV == 'air-gapped' # -> TODO: remove condition when devel env is no longer needed
run: |
ssh_command="ssh -o StrictHostKeyChecking=no azureadmin@${JUMPHOST_IP} 'ssh -o StrictHostKeyChecking=no azureadmin@${RUNNER_HOST_IP} whoami'"
eval $ssh_command
- name: Configure VM with ansible
run: |
cd ansible
ansible-playbook configure-image-factory-vm.yml
# # - name: Configure VM with ansible
# # run: |
# # cd ansible
# # cat inventory.ini

# # ssh-add ansible_ssh_key
# # ssh_command="ssh -o StrictHostKeyChecking=no azureadmin@${JUMPHOST_IP} 'ssh -o StrictHostKeyChecking=no azureadmin@${RUNNER_HOST_IP} whoami'"
# # eval $ssh_command
# # ansible-playbook configure-image-factory-vm.yml

# OLD
# - name: Install Ansible
# run: |
# pip3 install ansible
Expand All @@ -93,4 +123,4 @@ jobs:
# # ssh-add ansible_ssh_key
# # ssh_command="ssh -o StrictHostKeyChecking=no azureadmin@${JUMPHOST_IP} 'ssh -o StrictHostKeyChecking=no azureadmin@${RUNNER_HOST_IP} whoami'"
# # eval $ssh_command
# # ansible-playbook configure-image-factory-vm.yml
# # ansible-playbook configure-image-factory-vm.yml

0 comments on commit 79ca092

Please sign in to comment.