wiggels / ansible-role-snipe-it

Ansible role to install, configure, and update a Snipe-IT server
https://galaxy.ansible.com/wiggels/snipeit
MIT License
5 stars 7 forks source link

Github Actions tests of playbook #12

Closed p-rintz closed 1 year ago

p-rintz commented 1 year ago

This introduces a testsuite for the playbook run itself on Ubuntu 22.04 and 20.04 for three python versions. This includes my changes in the other PR #11 so that should probably be merged first. (or I need to change this, but not today)

Some notes on some of my choices:

re: .github/workflows/ansible-playbook.yml I decided to use nick-fields/retry@v2 for the ansible-galaxy install because it would randomly fail. This will retry the install thrice before failing for just this specific step.

re: tasks/mysql.yml As the Github Actions Ubuntu images include a mysql server, I had to add the user/password for this as an "omit" parameter to the mysql tasks.

I have tested this separately on another Ubuntu vm, and it works as expected, where the parameter gets omitted if not run inside Github Actions. (as evidenced by the GITHUB_ACTIONS environment variable)

re: tests/test-gha.yml Since its a very minimal setup of snipe, the default vhost of the nginx install is kept at localhost, which also means that we need to remove the default.conf that is shipped with nginx to actually be able to reach our snipe-it install via localhost.

I am open to ideas for any better way than to simply test if the /setup uri returns a 200 http response code.