Skip to content

Use Vagrant to system-test Ansible playbook #31

Use Vagrant to system-test Ansible playbook

Use Vagrant to system-test Ansible playbook #31

Workflow file for this run

name: Ansible
on:
push:
branches:
- main
paths:
- '.github/workflows/ansible.yml'
- 'ansible/**'
- 'docker/ansible*/*'
pull_request:
paths:
- '.github/workflows/ansible.yml'
- 'ansible/**'
- 'docker/ansible*/*'
workflow_dispatch:
inputs:
key_code:
description: 'Magic Wormhole key code'
type: string
required: true
target:
description: 'Target environment'
type: choice
options:
- 'stage'
- 'prod'
mode:
description: 'Mode'
type: choice
options:
- 'safe'
- 'fast'
- 'dry'
jobs:
ansible:
name: Ansible
runs-on: ubuntu-22.04
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Setup Vagrant
id: setup_vagrant
run: |
PACKAGES="\
qemu \
libvirt-daemon-system \
ebtables \
libguestfs-tools \
vagrant-libvirt \
ruby-fog-libvirt \
nfs-common \
nfs-kernel-server \
"
sudo apt-get update && \
sudo apt-get install --no-install-recommends -y ${PACKAGES} && \
sudo rm -rf /var/lib/apt/lists/*
sudo vagrant plugin install vagrant-libvirt
sudo setfacl -m user:$USER:rw /var/run/libvirt/libvirt-sock
sudo systemctl enable libvirtd
sudo systemctl start libvirtd
sudo cat /etc/exports || sudo touch /etc/exports
sudo ls -lA /etc/exports
sudo cat /etc/nfs.conf
sudo systemctl status nfs-server || sudo systemctl start nfs-server
sudo nfsconf --dump
sudo rpcinfo -p
sudo ps -edaf | grep -i nfs
sudo netstat -tlnp
sudo ip addr show
- name: Cache Vagrant boxes
id: cache_vgrant
uses: actions/cache@v2
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-
- name: Show Vagrant version
run: vagrant --version
- name: Run vagrant up
run: |
#vagrant init debian/bookworm64
vagrant up --provider=libvirt --no-tty
- name: Update deployment in vagrant guest
run: |
vagrant ssh -c "sudo ls -lA /root"
vagrant ssh -c "sudo ls -lA /root/sbx-actions"
vagrant ssh -c "sudo ls -lA /root/sbx-actions/ansible"
vagrant ssh -c "sudo ls -lA /root/sbx-actions/ansible/files"
vagrant ssh -c "sudo /root/sbx-actions/ansible/files/update-deployment base-local"