-
Notifications
You must be signed in to change notification settings - Fork 0
/
Loop_practice.yaml
38 lines (35 loc) · 924 Bytes
/
Loop_practice.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
- hosts: localhost
name: Create user on a linux server
become: yes
become_method: sudo
gather_facts: no
connection: ssh
tasks:
- user:
name: '{{ item.name }}'
password: "{{ item.password }}' | password_hash('sha512')"
uid: '{{ item.uid }}'
state: '{{ item.state }}'
groups: sudo
update_password: on_create
with_items:
- name: "Boss"
password: "123456"
uid: "1234"
state: 'present'
# - ansible.builtin.user:
# name: "johnd"
# comment: "John Doe"
# uid: 1040
# group: "admin"
# password: "{{ 'password' | password_hash('sha512') }}"
# password: "{{ 'password' | password_hash('sha512') }}"
# shell: /bin/zsh
# update_password: on_create
# - user:
# name: "{{ user }}"
# password: "{{ password }}"
# groups:
# - wheel
# state: present