summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/tasks/packages.yaml1
-rw-r--r--common/tasks/user.yaml22
2 files changed, 23 insertions, 0 deletions
diff --git a/common/tasks/packages.yaml b/common/tasks/packages.yaml
index 41b0aeb..88b1123 100644
--- a/common/tasks/packages.yaml
+++ b/common/tasks/packages.yaml
@@ -6,6 +6,7 @@
with_items:
- bash
- dash
+ - gnupg
- "{{ openssh_server }}"
- sudo
- name: Update all packages
diff --git a/common/tasks/user.yaml b/common/tasks/user.yaml
index e8e5eb4..9b81e0d 100644
--- a/common/tasks/user.yaml
+++ b/common/tasks/user.yaml
@@ -10,3 +10,25 @@
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