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