On Sun, 12 Jun 2016, at 21:37, Vincent Van der Kussen wrote:
> Maybe something like
> 
> when: 'webservers'  in group_names
> 
> Might help.

This is the crux of the issue - I can't put this in the vars file, so
how does one keep the roles and vars info reusable? I should be able to
constrain these only in the final playbook.

Here's the error I got trying to limit to a specific user, ignoring the
inventory class for the moment as it's a trivial when: clause.

{"failed": true, "msg": "The conditional check 'users.item.key ==
\"ansible\"' failed. The error was: error while evaluating conditional
(users.item.key == \"ansible\"): 'dict object' has no attribute 'item'"}

& the playbook:

```site.yml
- name: deploy and configure site
  hosts: all
  become: yes
  gather_facts: yes
  vars_files:
    - vars/users.yml
  roles:
    - { role: users, when: users.item.key == "ansible" }
```

Any other suggestions? Different approaches?

End goal is that on all hosts we have ansible user created, and on Y
hosts, a subset of all hosts, we have additional users set up

A+
Dave

-- 
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/1465771530.3199928.635526969.3783924E%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to