diff options
author | Robin Krahl <me@robin-krahl.de> | 2019-01-21 23:17:56 +0100 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2019-01-21 23:17:56 +0100 |
commit | a1856b66bb30c03ecdcd45c4bab53092049bef59 (patch) | |
tree | 60f7dc2cd44b217a04440f05bdc0a27336abf236 | |
parent | 7a46d423706deb9dd89b89145fb7049943a10b17 (diff) | |
download | ansible-roles-a1856b66bb30c03ecdcd45c4bab53092049bef59.tar.gz ansible-roles-a1856b66bb30c03ecdcd45c4bab53092049bef59.tar.bz2 |
Configure OpenPGP public key for common
-rw-r--r-- | common/tasks/packages.yaml | 1 | ||||
-rw-r--r-- | common/tasks/user.yaml | 22 |
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 |