Re: [ansible-project] loops, file globs, ssh_keys...

2016-09-20 Thread pixel fairy
On Monday, September 19, 2016 at 12:33:10 PM UTC-7, Kai Stian Olstad wrote
>
>
> You could put this in it's own file, use include with with_items and 
> loop_control. 
>
> https://docs.ansible.com/ansible/playbooks_loops.html#loop-control


 odd to have to put that into two files, but exactly what i was looking for

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3bc764b0-5314-4242-b2f0-7335d7affd3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] loops, file globs, ssh_keys...

2016-09-19 Thread Kai Stian Olstad

On 19. sep. 2016 14:00, pixel fairy wrote:

looking on google, this seems to come up a lot.
have users. each user has N ssh keys. sometimes, one of the users keys is
revoked. for example, a crashed cellphone sent in for repair.

we keep keys like this
.
├── voxel
│   └── voxel.pub
├── pixel
│   ├── pixelphone3.pub
│   ├── pixel.pub
│   └── revoked
│   └── pixelphone2.pub
└── root
├── voxel.pub
└── pixel.pub


with a single user, this works

---
- hosts: all
  tasks:
  - name: install ssh keys
authorized_key:
  user=root
  key="{{ lookup('file',item) }}"
with_fileglob:
  - ssh_keys/root/*
  - name: remove unwanted keys
authorized_key:
  user=root
  state=absent
  key="{{ lookup('file',item) }}"
with_fileglob:
  - ssh_keys/root/revoked/*

how can you do that with a list of users?


You could put this in it's own file, use include with with_items and 
loop_control.


https://docs.ansible.com/ansible/playbooks_loops.html#loop-control

--
Kai Stian Olstad

--
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6d9f8f49-969d-5ea2-5734-896f0c4753f3%40olstad.com.
For more options, visit https://groups.google.com/d/optout.