Skip to content

Instantly share code, notes, and snippets.

@halberom
Created January 29, 2014 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halberom/8699152 to your computer and use it in GitHub Desktop.
Save halberom/8699152 to your computer and use it in GitHub Desktop.
passing items to lookup
---
- hosts: all
vars:
users:
- user1
- user2
tasks:
- name: create users
user: name={{item}} state=present
with_items: users
- name: copy key
authorized_key: user={{item}}
key="{{ lookup('file', '/etc/ansible/files/keys/' + item + '.pub') }}" manage_dir=yes
with_items: users
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment