When I print out "{{ ansible_play_name }}" I simply get "localhost."

On Tue, Oct 17, 2023 at 12:18 PM 'Philippe Kueck' via Ansible Project <
[email protected]> wrote:

> Hi,
>
> On 17.10.23 18:13, Kathy Lyons wrote:
> > We use it in many instances to only do something for a specific
> > playbook.  We have about 5 playbooks that work on different networks and
> > rather than maintain 5 different playbooks we use the "when
> > playbook_name == abc.yml" a lot. Is there another way to get the
> > playbook name?
>
> How about this?
>
> ---
> - name: "foobar playbook"
>    hosts: localhost
>    gather_facts: no
>    tasks:
>      - debug:
>          msg: '{{ansible_play_name}}'
> ...
>
> - Philippe
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/UcCnrJRs4iY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/674aaf12-2177-46eb-a995-1dbe04113fd4%40quarantine.de
> .
>

-- 
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/CAK9%2BsMc9TdqUcWtvOFNv9Uw6p5Upcgx3qGZ5cqbT8Y%3DQnSksiA%40mail.gmail.com.

Reply via email to