when: inventory_hostname != play_hosts[-1] not working

27 views
Skip to first unread message

chrono

unread,
Jul 12, 2017, 4:35:11 PM7/12/17
to Ansible Project
Hello,

I'm trying to get a role to run on all hosts except the last.  I thought this would work:

- { role: wait, timeout: 300, tags: ['wait'], when: inventory_hostname != play_hosts[-1] }

...but I get a YAML syntax error.

Is there a way to do this?

Best,

- C
Reply all
Reply to author
Forward
0 new messages