mirror of
https://github.com/famedly/ansible-collection-services
synced 2024-11-13 23:37:09 +00:00
feat(drivestrike): add role for installation
Co-authored-by: Jan Christian Grünhage <jan.christian@gruenhage.xyz>
This commit is contained in:
parent
63bdce3f34
commit
c27ce21d37
4 changed files with 99 additions and 0 deletions
11
roles/drivestrike/defaults/main.yml
Normal file
11
roles/drivestrike/defaults/main.yml
Normal file
|
@ -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
|
42
roles/drivestrike/tasks/install/archlinux.yml
Normal file
42
roles/drivestrike/tasks/install/archlinux.yml
Normal file
|
@ -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
|
41
roles/drivestrike/tasks/install/void.yml
Normal file
41
roles/drivestrike/tasks/install/void.yml
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
- name: Set build directory
|
||||
ansible.builtin.set_fact:
|
||||
drivestrike_void_packages_dir: "{{ lookup('env', 'XDG_CACHE_HOME') | default(lookup('env', 'HOME') + '/.cache', true) }}/ansible-drivestrike-void"
|
||||
|
||||
- name: Clone void-packages
|
||||
ansible.builtin.git:
|
||||
repo: https://github.com/void-linux/void-packages.git
|
||||
dest: "{{ drivestrike_void_packages_dir }}"
|
||||
force: true
|
||||
version: master
|
||||
|
||||
- name: Bootstrap build environment
|
||||
ansible.builtin.command: "./xbps-src binary-bootstrap"
|
||||
args:
|
||||
chdir: "{{ drivestrike_void_packages_dir }}"
|
||||
creates: "{{ drivestrike_void_packages_dir }}/masterdir"
|
||||
|
||||
- name: Allow building restricted packages
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ drivestrike_void_packages_dir }}/etc/conf"
|
||||
line: XBPS_ALLOW_RESTRICTED=yes
|
||||
create: true
|
||||
|
||||
- name: Build drivestrike package
|
||||
ansible.builtin.shell: |
|
||||
git fetch origin pull/38917/head:drivestrike
|
||||
git cherry-pick drivestrike
|
||||
git branch -D drivestrike
|
||||
./xbps-src pkg drivestrike
|
||||
args:
|
||||
chdir: "{{ drivestrike_void_packages_dir }}"
|
||||
creates: "{{ drivestrike_void_packages_dir }}/hostdir/binpkgs/nonfree/drivestrike-2.1.20_1.x86_64.xbps"
|
||||
|
||||
- name: Install drivestrike
|
||||
become: true
|
||||
ansible.builtin.shell: "xbps-install --repository=hostdir/binpkgs/nonfree/ -y drivestrike"
|
||||
args:
|
||||
chdir: "{{ drivestrike_void_packages_dir }}"
|
||||
creates: "/usr/bin/drivestrike"
|
||||
|
5
roles/drivestrike/tasks/main.yml
Normal file
5
roles/drivestrike/tasks/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
|
||||
- name: Install drivestrike
|
||||
include_tasks:
|
||||
file: "install/{{ ansible_os_family | lower }}.yml"
|
Loading…
Reference in a new issue