style: formating
This commit is contained in:
parent
f1b471bc31
commit
975dd6d8aa
@ -2,22 +2,22 @@
|
||||
# tasks file for ansible-user
|
||||
- name: Print user name
|
||||
ansible.builtin.debug:
|
||||
msg: {{ user_name }}
|
||||
msg: '{{ user_name }}'
|
||||
- name: Create system user
|
||||
become: true
|
||||
ansible.builtin.user:
|
||||
name: '{{ user_name }}'
|
||||
system: true
|
||||
password: "{{ user_password|default('') }}"
|
||||
password: "{{ user_password | default('') }}"
|
||||
groups: "{{ user_groups | join(',') }}"
|
||||
home: "{{ user_home | default('/') }}"
|
||||
shell: "{{ user_shell | default('/usr/bin/nologin') }}"
|
||||
when: user_name != "root" and not user_ldap
|
||||
- name: simulate login
|
||||
stat:
|
||||
path: "/home/{{user.name}}"
|
||||
become: true
|
||||
become_user: "{{user.name}}"
|
||||
- name: Simulate login
|
||||
ansible.builtin.stat:
|
||||
path: '/home/{{ user.name }}'
|
||||
become: true
|
||||
become_user: '{{ user.name }}'
|
||||
when: user_ldap
|
||||
|
||||
- name: Ensure .ssh exist for user
|
||||
@ -38,12 +38,11 @@
|
||||
selevel: s0
|
||||
owner: '{{ user_name }}'
|
||||
|
||||
|
||||
- name: Install ssh private key
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
content: '{{ item.key }}'
|
||||
dest: '{{ user_home}}/.ssh/{{ item.keyname }}'
|
||||
dest: '{{ user_home }}/.ssh/{{ item.keyname }}'
|
||||
mode: 0600
|
||||
owner: '{{ user_name }}'
|
||||
with_items: '{{ user_privatekey }}'
|
||||
@ -54,5 +53,3 @@
|
||||
key: '{{ item }}'
|
||||
exclusive: false
|
||||
with_items: '{{ user_authorized_key }}'
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user