From 9476a8df610de248ea6776894f59298a75def106 Mon Sep 17 00:00:00 2001 From: Johanna Dorothea Reichmann Date: Mon, 22 Aug 2022 18:50:18 +0200 Subject: [PATCH] feat(drivestrike): add role to install on archlinux --- roles/drivestrike/defaults/main.yml | 11 +++++ roles/drivestrike/tasks/install-Archlinux.yml | 42 +++++++++++++++++++ roles/drivestrike/tasks/main.yml | 5 +++ 3 files changed, 58 insertions(+) create mode 100644 roles/drivestrike/defaults/main.yml create mode 100644 roles/drivestrike/tasks/install-Archlinux.yml create mode 100644 roles/drivestrike/tasks/main.yml diff --git a/roles/drivestrike/defaults/main.yml b/roles/drivestrike/defaults/main.yml new file mode 100644 index 0000000..83bf47a --- /dev/null +++ b/roles/drivestrike/defaults/main.yml @@ -0,0 +1,11 @@ +--- + +drivestrike_package_name: drivestrike +drivestrike_package_name_arch: "{{ drivestrike_package_name }}" + +drivestrike_arch_pubkey_url: "https://app.drivestrike.com/static/drivestrike.pubkey.txt" +drivestrike_arch_pubkey_file: "/tmp/drivestrike.pub" +drivestrike_arch_pubkey_id: 6B48829B +drivestrike_arch_pubkey_fingerprint: A9CA32527A44BC385FCAEF85441FF83A6B48829B +drivestrike_arch_repo_server_url: "https://app.drivestrike.com/static/arch" +drivestrike_arch_pacman_config_file: /etc/pacman.conf diff --git a/roles/drivestrike/tasks/install-Archlinux.yml b/roles/drivestrike/tasks/install-Archlinux.yml new file mode 100644 index 0000000..108ba01 --- /dev/null +++ b/roles/drivestrike/tasks/install-Archlinux.yml @@ -0,0 +1,42 @@ +--- + +- name: Ensure dependencies are installed + pacman: + name: "{{ item }}" + state: present + loop: + - gnupg + +- name: Retrieve pacman repository key + uri: + method: GET + url: "{{ drivestrike_arch_pubkey_url }}" + dest: "{{ drivestrike_arch_pubkey_file }}" + register: drivestrik_pub_key_download + +- name: Import drivestrike public key + community.general.pacman_key: + id: "{{ drivestrike_arch_pubkey_fingerprint }}" + file: "{{ drivestrike_arch_pubkey_file }}" + verify: true + state: present + when: drivestrik_pub_key_download.changed + +- name: Configure pacman for external repositoy + blockinfile: + dest: "{{ drivestrike_arch_pacman_config_file }}" + marker: "# {mark} ANSIBLE MANAGED BLOCK by famedly.services.drivestrike" + block: |+2 + [drivestrike] + SigLevel = Required DatabaseOptional + Server = {{ drivestrike_arch_repo_server_url }} + +- name: Update pacman cache + pacman: + update_cache: true + when: drivestrik_pub_key_download.changed + +- name: Install drivestrike package + pacman: + name: "{{ drivestrike_package_name_arch }}" + state: present diff --git a/roles/drivestrike/tasks/main.yml b/roles/drivestrike/tasks/main.yml new file mode 100644 index 0000000..f6867cf --- /dev/null +++ b/roles/drivestrike/tasks/main.yml @@ -0,0 +1,5 @@ +--- + +- name: Install drivestrike + include_tasks: + file: "install-{{ ansible_os_family }}.yml"