Got it, I’ll use the lookup. Thanks Brian
> On Mar 18, 2024, at 10:36 AM, Brian Coca wrote:
>
> `vars` was undocumented and for internal use, we stopped using it
> internally but have been unable to remove it (and save many resources)
> because people keep using(abusing) it.
>
> Soon we will
`vars` was undocumented and for internal use, we stopped using it
internally but have been unable to remove it (and save many resources)
because people keep using(abusing) it.
Soon we will have 'variable deprecation' which will allow us to start
removing things like these, `vars` has long been the
Hey Brian - any concerns with
assert:
that: item in vars
Short and sweet!
Rob
On Fri, Mar 15, 2024 at 3:03 PM Brian Coca wrote:
> also varnames lookup
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe fr
also varnames lookup
--
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit
h
You can also use the vars lookup: lookup('vars', item), which has
broader scope over hostvars.
--
--
Brian Coca (he/him/yo)
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails fr
In the first loop assert is evaluating that 'item' itself is defined.
In the second loop assert is evaluating whether a variable who's name is stored
in 'item' is defined.
% cat foo.yml
---
- hosts: localhost
gather_facts: no
become: no
tasks:
- name: without templating
asser
Hey Todd - apologies, I don't understand your comment.
Hey Walter - yes, you are correct.
To elaborate on the use case. FIrst task in my playbooks confirms the user
provided all the expected/required variables. I iterate over the list of
variables and make sure they are defined with assert. Th
I sense that "with templating" does as expected?
% ansible --version
ansible [core 2.16.4]
config file = None
configured module search path = ['/Users/wrowe/.ansible/plugins/modules',
'/usr/share/ansible/plugins/modules']
ansible python module location =
/opt/homebrew/lib/python3.11/s
Maybe it will facilitate understanding what's going on if we name things
what they really are:
---
- hosts: localhost
gather_facts: no
tasks:
- name: Strings in a loop are indeed defined
ignore_errors: true
assert:
that: item is defined
loop:
- RandomStringA
-
Hi all - I recently upgraded to Ansible core 2.15, and started hitting
"Conditional is marked as unsafe, and cannot be evaluated." As discussed
at
https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_9.html,
I removed templating from when and assert. All seemed fine, but then
10 matches
Mail list logo