blob: 9e576b6eeb03d6e3c057669285cee32eb3c9761d (
plain)
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
|
- name: "Create user {{ user_name }}"
user:
name: "{{ user_name }}"
comment: "{{ user_full_name }}"
shell: /bin/bash
uid: 1000
groups:
- sudo
append: yes
- name: "Configure authorized key for {{ user_name }}"
authorized_key:
user: "{{ user_name }}"
key: "{{ user_ssh_key }}"
- name: Create GnuPG directory
file:
path: "{{ user_name }}/.gnupg"
owner: "{{ user_name }}"
group: "{{ user_name }}"
mode: u=rwx,g=,o=
state: directory
- name: Copy OpenPGP key
copy:
src: "{{ user_pgp_key }}.txt"
dest: "{{ user_name }}/.gnupg/{{ user_pgp_key }}.txt"
owner: "{{ user_name }}"
group: "{{ user_name }}"
mode: u=rw,g=,o=
- name: Import OpenPGP key
command: "gpg --import {{ user_name}}/.gnupg/{{ user_pgp_key }}.txt"
become: yes
become_user: "{{ user_name }}"
- name: Delete temporary key file
file:
path: "{{ user_name }}/.gnupg/{{ user_pgp_key }}.txt"
state: absent
|