From a1856b66bb30c03ecdcd45c4bab53092049bef59 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Mon, 21 Jan 2019 23:17:56 +0100 Subject: Configure OpenPGP public key for common --- common/tasks/packages.yaml | 1 + common/tasks/user.yaml | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'common') 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 -- cgit v1.2.3