From 47f0553dd444a71340dfa38903752dad955fbcc5 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Sat, 16 Sep 2023 23:08:02 +0200 Subject: [PATCH] feat(user/gpg): create a GPG role Signed-off-by: Matej Focko --- playbooks/bootstrap.yml | 4 ++++ roles/user/gpg/tasks/main.yml | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 roles/user/gpg/tasks/main.yml diff --git a/playbooks/bootstrap.yml b/playbooks/bootstrap.yml index de48b00..cb42874 100644 --- a/playbooks/bootstrap.yml +++ b/playbooks/bootstrap.yml @@ -49,6 +49,10 @@ - role: user/ssh tags: ssh + # Set up GPG + - role: user/gpg + tags: gpg + # Configure Alacritty terminal - role: user/terminals/alacritty tags: alacritty diff --git a/roles/user/gpg/tasks/main.yml b/roles/user/gpg/tasks/main.yml new file mode 100644 index 0000000..cae943a --- /dev/null +++ b/roles/user/gpg/tasks/main.yml @@ -0,0 +1,13 @@ +--- +- name: Download the public GPG key + ansible.builtin.get_url: + url: "https://gitlab.com/{{ gitlab_login }}.gpg" + dest: /tmp/public.gpg + mode: 0600 + +- name: Import the public GPG key + ansible.builtin.command: + cmd: gpg --import /tmp/public.gpg + register: gpg_import_result + failed_when: gpg_import_result.rc != 0 + changed_when: "'imported: 1' in gpg_import_result.stdout"