Deploy VMs on KVM #39
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: Deploy VMs on KVM | |
on: | |
workflow_dispatch: | |
inputs: | |
hostname: | |
description: 'hostname' | |
required: true | |
default: hostname | |
target_server: | |
description: 'target_server' | |
required: true | |
default: rhel8-equinix | |
action: | |
description: 'action' | |
required: true | |
default: create | |
type: choice | |
options: | |
- create | |
- delete | |
vm_name: | |
description: 'VM Deployment' | |
required: true | |
default: 'freeipa' | |
type: choice | |
options: | |
- freeipa | |
- freeipa-server-container | |
- mirror-registry | |
- microshift-demos | |
- openshift-jumpbox | |
- device-edge-workshops | |
- ansible-aap | |
- rhel8 | |
- rhel9 | |
env: | |
TARGET_SERVER: ${{ inputs.target_server }} | |
VM_NAME: ${{ inputs.vm_name }} | |
ACTION: ${{ inputs.action }} | |
jobs: | |
deploy-vm: | |
runs-on: ubuntu-latest | |
timeout-minutes: 45 | |
steps: | |
- name: Deploying ${{ inputs.vm_name }} on KVM | |
uses: appleboy/ssh-action@v0.1.10 | |
with: | |
host: ${{ inputs.hostname }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
command_timeout: 30m | |
script: | | |
sudo yum install -y git | |
if [ -d "/opt/kcli-pipelines" ]; then | |
cd /opt/kcli-pipelines | |
git config pull.rebase false | |
git pull | |
else | |
cd /opt/ | |
git clone https://github.com/tosin2013/kcli-pipelines.git | |
fi | |
export TARGET_SERVER=${{ env.TARGET_SERVER }} | |
export VM_NAME=${{ env.VM_NAME }} | |
export VM_PROFILE=${{ env.VM_NAME }} | |
export ACTION=${{ env.ACTION }} | |
/opt/kcli-pipelines/deploy-vm.sh |