Ok...found why, but I'm unsure how to fix. So iloms as defined in my
group_vars is:
iloms:
- gateway: 10.224.64.1
mask: 255.255.248.0
- gateway: 10.85.0.1
mask: 255.255.254.0
- gateway: 10.234.50.161
mask: 255.255.255.224
if the ilom.gateway/ilom.mask pair is the last in list, then ilom_gw and
ilom_mask get set and are usable. If the pair is *not* last then they get
set to false (because they did not match the filter) how can I specify a
"found first" and exit the loop when a match is made?
On Wednesday, October 26, 2016 at 11:06:51 AM UTC-5, Dayton Jones wrote:
>
> I'm setting 2 facts from a custom filter, which appears to be working, but
> when I go to use those facts in the playbook they aren't there...
>
> set_fact:
> ilom_gw: "{{ ilom_ip | ilom_net(item.gateway,item.mask) }}"
> ilom_mask: "{{ ilom_ip | ilom_net(item.gateway,item.mask,
> return_value='mask') }}"
> with_items: iloms
>
> here's the output of that task:
>
> {
>
> "changed": false,
>
> "msg": "All items completed",
>
> "results": [
>
> {
>
> "_ansible_no_log": false,
>
> "ansible_facts": {
>
> * "ilom_gw": "10.224.64.1",*
>
> * "ilom_mask": "255.255.248.0"*
>
> },
>
>
> as you can see both ilom_gw and ilom_mask are set here, but then:
>
>
> debug: var=ilom_gw
>
> [mgmt_port:debug] ilom_gw
>
> 2016-10-26 15:31:29+00:00 (0:01:05)
>
> Changed = False
>
> JSON : {
>
> "_ansible_no_log": false,
>
> "_ansible_verbose_always": true,
>
> "changed": false,
>
> *"ilom_gw": false*
>
> }
>
>
> debug: var=ilom_mask
>
> [mgmt_port:debug] ilom_mask
>
> 2016-10-26 15:31:30+00:00 (0:01:06)
>
> Changed = False
>
> JSON : {
>
> "_ansible_no_log": false,
>
> "_ansible_verbose_always": true,
>
> "changed": false,
>
> *"ilom_mask": false*
>
> }
>
>
>
> And I swear when I tested this yesterday it worked as expected, but then
> today it's broken... what am I missing?
>
>
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/50e4bbda-2641-46e3-a666-91989dbd2a73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.