Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Useradd task
- - hosts: service-all
- become: yes
- gather_facts: true
- - name: User creation
- user: name="{{item.username}}"
- group="{{item.username if users_create_per_user_group
- else users_group}}"
- groups="{{item.groups | join(',')}}"
- shell={{item.shell if item.shell is defined else users_default_shell}}
- password="{{item.password if item.password is defined else '!'}}"
- comment="{{item.name}}"
- update_password="{{item.update_password if item_update_password is defined else users_update_password }}"
- uid="{{item.uid | default(omit) }}"
- createhome="{{'yes' if users_create_homedirs else 'no'}}"
- expires="{{item.expires | default(omit) }}"
- with_items: users
- tags: ['users','configuration']
- group_vars/service-all
- users:
- - username: "{% if host in groups['service-prod'] and host in groups['service-mgmt'] %} '952292' {% elif host in groups['service-proj'] %} '9e2292' {% endif %}"
- name: test user
- groups: []
- uid: 2001
- ssh_key: []
- password: "{{ test_pass }}"
- expires: 1496501879
- host
- [service-prod]
- Hostname1
- [service-mgmt]
- Hostname2
- [service-proj]
- Hostname3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement