This commit is contained in:
Kris Lamoureux 2024-05-02 00:47:39 -04:00
parent 324fe0b191
commit 71d73e8c55
2 changed files with 33 additions and 9 deletions

View File

@ -8,7 +8,7 @@ on:
jobs: jobs:
homelab-ci: homelab-ci:
runs-on: macos-latest runs-on: macos-13
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -21,19 +21,42 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-vagrant- ${{ runner.os }}-vagrant-
- name: Install VirtualBox
run: brew install --cask virtualbox
- name: Install Vagrant
run: brew install --cask vagrant
- name: Install Ansible - name: Install Ansible
run: brew install ansible@7 run: brew install ansible
- name: Software Versions - name: Software Versions
run: | run: |
printf "VirtualBox " printf "VirtualBox "; vboxmanage --version
vboxmanage --version
vagrant --version vagrant --version
export PATH="/usr/local/opt/ansible@7/bin:$PATH"
ansible --version ansible --version
- name: Install nmap
run: brew install nmap
- name: Vagrant Up with Dockerbox Playbook - name: Vagrant Up with Dockerbox Playbook
env:
SSH_AUTH_SOCK: ''
run: | run: |
export PATH="/usr/local/opt/ansible@7/bin:$PATH" ssh-add -D && echo "[homelab-ci] SSH Agent disabled"
PLAYBOOK=dockerbox vagrant up PLAYBOOK=dockerbox vagrant up --debug &
vagrant ssh -c "docker ps" VAGRANT_UP_PID=$!
sleep 30
echo "[homelab-ci] Checking SSH connection availability..."
PRIVATE_KEY="$(find .vagrant -name "private_key" 2>/dev/null | sort)"
HOST_IP="$(vagrant ssh-config | grep HostName | awk '{print $2}')"
echo "[homelab-ci] Private Key: $PRIVATE_KEY"
echo "[homelab-ci] Host IP: $HOST_IP"
echo "[homelab-ci] Running nmap to check open ports..."
nmap -p 22 "$HOST_IP"
echo "[homelab-ci] Attempting raw SSH connection with high verbosity..."
ssh -vvv -i "$PRIVATE_KEY" \
-o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no \
-v vagrant@"$HOST_IP"
wait $VAGRANT_UP_PID

3
Vagrantfile vendored
View File

@ -36,6 +36,7 @@ Vagrant.configure("2") do |config|
config.vm.provider :virtualbox do |vbox| config.vm.provider :virtualbox do |vbox|
vbox.cpus = VAGRANT_CPUS vbox.cpus = VAGRANT_CPUS
vbox.memory = VAGRANT_MEM vbox.memory = VAGRANT_MEM
vbox.gui = true
end end
# Provision with Ansible # Provision with Ansible
@ -43,6 +44,6 @@ Vagrant.configure("2") do |config|
ENV['ANSIBLE_ROLES_PATH'] = File.dirname(__FILE__) + "/roles" ENV['ANSIBLE_ROLES_PATH'] = File.dirname(__FILE__) + "/roles"
ansible.compatibility_mode = "2.0" ansible.compatibility_mode = "2.0"
ansible.playbook = "dev/" + PLAYBOOK + ".yml" ansible.playbook = "dev/" + PLAYBOOK + ".yml"
ansible.raw_arguments = ["--diff"] ansible.raw_arguments = ["--diff", "-vvv"]
end end
end end