add inistal user creation
This commit is contained in:
parent
2ae147a1be
commit
f3fe57ca09
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
- hosts: userhosts
|
||||
remote_user: ansible
|
||||
vars:
|
||||
git_url: "https://git.togrand.xyz"
|
||||
|
||||
tasks:
|
||||
- name: fetch user list from api
|
||||
uri:
|
||||
url: "{{ git_url }}/api/v1/orgs/mrtogrand/members"
|
||||
return_content: yes
|
||||
register: members
|
||||
|
||||
- name: "create users"
|
||||
user:
|
||||
name: "{{ item }}"
|
||||
with_items: "{{ members | json_query('json[*].login') }}"
|
||||
|
||||
- name: import user public keys
|
||||
authorized_key:
|
||||
key: "{{ git_url }}/{{ item }}.keys"
|
||||
exclusive: yes
|
||||
user: "{{ item }}"
|
||||
with_items: "{{ members | json_query('json[*].login') }}"
|
Loading…
Reference in New Issue