Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just a Question about the Ansible playbooks #253

Closed
corincorvus opened this issue Apr 30, 2024 · 3 comments
Closed

Just a Question about the Ansible playbooks #253

corincorvus opened this issue Apr 30, 2024 · 3 comments
Labels
question Users question

Comments

@corincorvus
Copy link

Hi,

in many of your ansible yamls you use hosts: "{{ my_hosts | d([]) }}".

How i have to manage with this in Semaphone? I tried with some inventories, but every time it call "no matched hosts". Do you use tags or similar in playbook or other configuration? In your Video about Semaphone i didnt find any of that.

And in some of your videos you add plugins/modules. In Ansible Semaphone i think it is complicated. Do you have a smart solution to use modules in Semaphone? I didnt find a solution in the boilerplates.

Thanks in advance.

@cschug
Copy link
Collaborator

cschug commented May 31, 2024

I suppose the idea here it is the pass the list of hosts as extra variable to Ansible.

As I'm not using Semaphore I cannot tell if this is an actual requirement, because in my opinion it makes things much more complicated to maintain, especially when it comes to host_vars & group_var as the integrity of consistent naming is much easier to achive if the Ansible inventory is just a file in the repository (think of hosts or hosts.yaml).

As you might guess I'm personally also not a big fan of that implementation, it was just me a while ago who changed the that line from

hosts: "{{ hosts }}"

to the current form to rather end up with an empty list instead of Ansible bailing out with an undefined variable and also avoid a naming clash because hosts is a reserved word in Ansible (see 746aa1d).

It would be best to let @ChristianLempa comment on that.

@cschug cschug added the question Users question label May 31, 2024
@ChristianLempa
Copy link
Owner

Like @cschug said, I'm using this to pass in the hosts, which allows me to execute the same playbooks on different hosts, depending on what variable is filled in by Semaphore.

However, I think that it could be misleading and confusing within the templates. What do you think @cschug should we just replace the hosts: "{{ hosts }}" with hosts: all?

@corincorvus
Copy link
Author

Hey,

yes in one of your last Videos you explaned the Kestra Automations and the Variable hosts for inputs. I switched from semaphore to kestra now. Only with some topics i have problems (use andible collections and modules in the container to send a matrix message for example. Interpreter wont find the module).

Thanks for your posts, i will close this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Users question
Projects
None yet
Development

No branches or pull requests

3 participants