Skip to content

Use root for GitHub Actions container #17

Use root for GitHub Actions container

Use root for GitHub Actions container #17

Workflow file for this run

---
name: Linter and test the project
env:
ANSIBLE_INVENTORY_UNPARSED_WARNING: 'False'
ANSIBLE_LOCALHOST_WARNING: 'False'
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
container:
image: quay.io/mmul/kpa
options: --user root
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: YAML check
run: yamllint tests/terraform_tfs_generator.yml
- name: Ansible Linter check
run: ansible-lint tests/terraform_tfs_generator.yml
- name: Ansible syntax check
run: ansible-playbook --syntax-check tests/terraform_tfs_generator.yml
test:
runs-on: ubuntu-latest
needs: lint
container:
image: quay.io/mmul/kpa
options: --user root
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Ansible effective execution (should produce terraform/*.tf files)
run: ansible-playbook -i tests/inventory tests/terraform_tfs_generator.yml
- name: Check terraform/*.tf files existence
run: for tf in cloud_init.tf mylabvmsgroup.vms.tf networks.tf pools.tf
provider.tf volumes.tf; do
echo "Checking tests/terraform/${tf}";
test -f tests/terraform/${tf};
done
trigger_galaxy_import:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Release Ansible Role to Galaxy
uses: hspaans/ansible-galaxy-action@v1
with:
api_key: ${{ secrets.GALAXY_API_KEY }}