Last active
August 13, 2017 14:31
-
-
Save jgornick/0586deadad6bb2693f03 to your computer and use it in GitHub Desktop.
Ansible: with_items and selectattr equalto
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: with_items and selectattr equalto | |
hosts: 127.0.0.1 | |
connection: local | |
sudo: no | |
vars: | |
users: | |
- username: user1 | |
state: present | |
name: User 1 | |
keys: | |
- pub-key-01 | |
groups: | |
- www-data | |
- username: user2 | |
state: present | |
name: User 2 | |
keys: | |
- pub-key-02 | |
groups: | |
- admin | |
tasks: | |
- debug: > | |
var=item | |
with_items: > | |
users | selectattr("username", "equalto", "user1") | list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment