Write the data to a file on the local host then delegate to the local host to read and delete the file, then continue with the playbook?

Mike

On Mar 19, 2023, at 12:00, Linux Study <[email protected]> wrote:


 i am creating jenkins pipe line to pass extra variable and want run playbook on host which i want to pass from jenkins...

On Sat, 18 Mar 2023, 19:35 Todd Lewis, <[email protected]> wrote:
Abhi,

Is this "hostname" the name of the host you want Ansible to manage? If so, why pass that through an extra variable rather than using the limit parameter?

In Ansible Tower, you have projects which define where your playbooks are stored and several more parameters such as credentials. Here's what a typical project looks like.


Each project can have any number of job templates, where each template allows you to configure which hosts or Ansible host groups to run the playbook on ("Limit" in the red box below), what extra variables to use, what parameters to prompt for, etc. Here's a typical job template.

Note that the nearly empty box below "Variables" would be where extra variables are defined. This job template doesn't use any extra variables. When editing a job template, almost any of the fields shown above can be marked "Prompt on launch", in which case you can override the default values at the time you launch the job.

Job templates can also be scheduled to run at regular intervals. Parameters which normally generate prompts can be filled in by the schedule just as if someone had manually started a job.

So, to address your question, "[H]ow can I add this hostname to [a] playbook?" If you really want to pass an extra variable called "hostname" that you can use in a playbook, you do that when you edit your job template. Be sure to check "Prompt on launch" if you want to override the default value when you run your job, like this:


In your playbook, you simply use the variable like any other:
- name: My task
  ansible.builtin.debug:
    msg: "My hostname variable is {{ hostname }}."
I hope this helps. Good luck.

On 3/18/23 5:09 AM, Linux Study wrote:
Hi there,

I want to pass hostname as extra variable from ansible tower to Playbook.how can i do this and how can i add this hostname to playbook?


Regards,
Abhi
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAEcjLFwUoRLfQG7Yy4NVpfjuwEAL4bqHwmFo-OijUFgmxLD0ng%40mail.gmail.com.



--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/946107ed-d83f-c8d3-d641-5b1e65ace095%40gmail.com.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAEcjLFw4Q75%3DDMpYzQhs9B2gio9iW%3DSeJUHgwo0AKgtRSEh%2BVA%40mail.gmail.com.
<IXK0gtW2kQGM2nTE.png>
<N11HRyzT34kDo2Rd.png>
<k0q4sltEEuX0BsRg.png>

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/40289ED9-5F16-4FCF-A073-43886949922E%40gmail.com.

Reply via email to