r/ansible • • 3d ago

GitHub actions

When developers need to kick off their GitHub actions are you using ansible for this?

18 Upvotes

17 comments sorted by

2

u/Busy-Examination1148 3d ago

I appreciate all of this input.

16

u/N7Valor 3d ago

No. I don't know about developers, but I generally use Github Actions to run Ansible.

If I were an IT guy doing weird things, I might try to use Ansible to run Github Actions as you can generally use the "uri" module to poke at any random API.

But if I were a developer (I'm not), I would think it's easier or simpler to use raw Python requests to do that. Certainly if I were using an LLM to get Github Actions to run Ansible, the LLM would probably do exactly what I described (use a short Python script or pure "curl" to interact with the GHA API).

11

u/onbiver9871 3d ago

…. no?

I mean, you could, sure. I’d be curious what Ansible or GHA use pattern would drive an interaction like that, though.

4

u/slayem26 3d ago

True. I never came across a use case where I had to trigger an action using ansible.

7

u/Rain-And-Coffee 3d ago

Our actions are kicked off by events, ex: a pull request, a merge to main, or a manual trigger.

We have a completely different system than runs ansible for us using a daily schedule. But it can also be triggered manually as well.

1

u/meangreenandunzeen 3d ago

What is the other system? I'm only familiar with CI/CD to automate this kind of thing.

1

u/Rain-And-Coffee 3d ago

AWX, it's a UI to kick off Ansible jobs.
https://www.redhat.com/en/technologies/management/ansible

Were moving towards Semaphore soon
https://semaphore.io

5

u/phxees 3d ago

Seems odd, but I wouldn’t avoid it if there was a good reason. Just make sure you aren’t using Ansible as a hammer to drive in a screw.

1

u/onbiver9871 3d ago

This :) like, pragmatism over dogmatism, right? If there’s a solid reason to do this, by all means go for it. Stable, pre-existing, legacy enterprise often has you doing things that on paper are a bit wonky but in reality are the best thing to do for reasons that aren’t purely technical.

The trick, as you say, is knowing when that’s true vs when you’re just doing things because the toolset will technically let you.

1

u/phxees 3d ago

Yup. I’d mainly reject this if it wasn’t clear what’s dispatching the GHA workflow or it seemed too much like a one off, even if it was a great idea.

3

u/Mrh1d3z 3d ago

Not GitHub but Gitlab. In GitLab I trigger CD pipelines with dokerized Ansible on the workers to test or deploy on the infra stages https://www.alessioligabue.it/en/portfolio/devops-pipeline-gitlab-cicd-ansible-molecule

2

u/Kaussaq 3d ago

Github actions are just scripts you can do whatever you want as part of that. If you have a git runner you could have that trigger an ansible job via API I would say

2

u/tibmeister 3d ago

Typically no, there’s a number of other triggers like on push and cron for that.

1

u/kevdogger 3d ago

I'm still trying to figure out exactly what and how to use github actions honestly. Somewhere in the mix I'm using renovate, github actions and arcane to keep my containers up to date...I'm usually using the base image latest version but usually I upgrade all the base packages via docker build files to reduce some of the compromised packages that seem to get reported regularly.

1

u/Zolty 3d ago

Ansible is for managing configs for the iaas layer

1

u/knowone1313 2d ago

I don't think developers are kicking off GitHub actions from ansible. Probably just using a schedule inside GitHub...