Try and keep this short and simple - I obviously don't know how to use when
I guess...
so I do some stuff trying users to login to linux instances from a list of
users.
- centos
- ec2-user
- somotheruser
I have the cumulative results registered. Then I try to run this task:
- name: assign to remote user
remote_user: "{{ item ['user'] }}"
# so the problem is that when the below evaluates, item['user'] is
still centos
when: item['ping'] is defined
with_items: "{{result.results}}"
user:
name: bmcdisc
password: "lestsayitsasecret"
so my 'when' tests if ping is defined in the result.results because it is
on the attempted connection that succeeds.
But the problem is that the ec2-user succeeds... but when I run that task,
it says it is skipping the first and last as they are not defined, but
running with -vvv I see
<10.5.162.167> ESTABLISH SSH CONNECTION FOR USER: centos
so it seems like I don't have 'when' in the right place (i have tried
moving it up and down etc, no luck), or don't understand how it works or
something - I am on
ansible 2.9.0.dev0
as the kind ansible folks fixed the issue with trying to assign users to
remote_user for me this week and just merged the code so that is working.
Can anyone tell me why?
Thank you
Bill
--
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/21a86c48-3391-44b9-927e-af9b526bb91b%40googlegroups.com.