Skip to content

Configure RHEL 8 Equinix Server #46

Configure RHEL 8 Equinix Server

Configure RHEL 8 Equinix Server #46

name: Configure RHEL 8 Equinix Server
on:
workflow_dispatch:
inputs:
hostname:
description: 'hostname'
required: true
default: hostname
target_server:
description: 'target_server'
required: true
default: rhel8-equinix
forwarder:
description: 'forwarder'
required: true
default: 1.1.1.1
domain:
description: 'domain'
required: true
default: example.com
env:
TARGET_SERVER: ${{ inputs.target_server }}
DOMAIN: ${{ inputs.domain }}
FORWARDER: ${{ inputs.forwarder }}
ACTIVE_BRIDGE: 'false'
INTERFACE: 'bond0'
jobs:
configure-rhel8-equinix:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Configure RHEL 8 Equinix Server
uses: appleboy/[email protected]
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/quibinode_navigator" ]; then
cd /opt/quibinode_navigator
git config --global --add safe.directory /opt/quibinode_navigator
git config pull.rebase false
git pull
else
cd /opt/
sudo usermod -aG users ${{ secrets.USERNAME }}
sudo chown -R root:users /opt
sudo chmod -R g+w /opt
git clone https://github.com/tosin2013/quibinode_navigator.git
fi
echo "export CICD_PIPELINE=true" > /opt/quibinode_navigator/.env
echo "export SSH_PASSWORD=${{ secrets.SSH_PASSWORD }}" >> /opt/quibinode_navigator/.env
echo "export INVENTORY='${{ env.TARGET_SERVER }}'" >> /opt/quibinode_navigator/.env
echo "export ENV_USERNAME=${{ secrets.USERNAME }}" >> /opt/quibinode_navigator/.env
echo "export DOMAIN=${{ env.DOMAIN }}" >> /opt/quibinode_navigator/.env
echo "export FORWARDER=${{ env.FORWARDER }}" >> /opt/quibinode_navigator/.env
echo "export ACTIVE_BRIDGE=${{ env.ACTIVE_BRIDGE }}" >> /opt/quibinode_navigator/.env
echo "export INTERFACE=${{ env.INTERFACE }}" >> /opt/quibinode_navigator/.env
source /opt/quibinode_navigator/.env && sudo -E /opt/quibinode_navigator/rhel8-linux-hypervisor.sh || exit $?
- name: Send a repository dispatch event to restart the workflow if it failed
uses: actions/github-script@v6
if: ${{ failure() }}
with:
script: |
github.actions.createRepositoryDispatchEvent(repository_dispatch_event: {type: 'restart-workflow'})