Skip to content

Commit

Permalink
Add librewolf setup
Browse files Browse the repository at this point in the history
  • Loading branch information
DO1JLR committed Sep 18, 2024
1 parent 87133a0 commit ca36ffe
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 5 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@
Librewolf ansible role
=======================

THis ansible role installs librewolf, a firefox fork, on linux. It is part of the l3d.liux collection
This ansible role installs librewolf, a firefox fork, on linux. It is part of the l3d.liux collection

```
WORK IN PROGRESS
```
## Variable

| name | default | description |
| ---- | --- | --- |
| ``librewolf__keyring_hash`` | ``sha256:4f438df8a84241e921edd26f164d1926e200ec3e36b1b330285242777ea3c693`` | librewolf gpg hash |
| ``librewolf__keyring`` | ``https://deb.librewolf.net/keyring.gpg`` | Librewolf keyring location |
| ``librewolf__xdg_settings`` | ``false`` | Optionally set librewolf as default browser |
| ``librewolf__xdg_settings_user`` | ``[]`` | List of users to set default browser |
| ``librewolf__xdg_settings_user[].user`` | | Username to set default browser |
| ``librewolf__xdg_settings_user[].home`` | ``/home/ ~ user`` | Home of User to set default browser |
| ``submodules_versioncheck`` | ``false`` | Optionally run versionscheck |
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
librewolf__keyring_hash: 'sha256:4f438df8a84241e921edd26f164d1926e200ec3e36b1b330285242777ea3c693'
librewolf__keyring: 'https://deb.librewolf.net/keyring.gpg'
librewolf__xdg_settings: false
librewolf__xdg_settings_user: []

# should we do a version check? (recomended)
submodules_versioncheck: false
15 changes: 15 additions & 0 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Update apt repo-cache on debian/ubuntu hosts
become: true
ansible.builtin.apt:
update_cache: true
cache_valid_time: 0
when:
- ansible_pkg_mgr == "apt"

- name: Install the package
become: true
ansible.builtin.package:
name: 'librewolf'
state: 'present'
register: _libreoffice_install
13 changes: 13 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,16 @@
ansible.builtin.include_tasks:
file: 'versioncheck.yml'
when: submodules_versioncheck | bool

- name: Prepare Package Repo
ansible.builtin.include_tasks:
file: 'repo.yml'

- name: Install librewolf
ansible.builtin.include_tasks:
file: 'install.yml'

- name: Optional set browser as default
ansible.builtin.include_tasks:
file: 'xdg.yml'
when: librewolf__xdg_settings | bool
40 changes: 40 additions & 0 deletions tasks/repo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
- name: "Pulling list of packages that are already installed"
ansible.builtin.package_facts:
manager: "auto"

- name: Update apt repo-cache on debian/ubuntu hosts
become: true
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
when:
- ansible_pkg_mgr == "apt"

- name: Install requirements to add packages via https
become: true
ansible.builtin.apt:
package:
- apt-transport-https
state: present

- name: Download repo signing key
become: true
ansible.builtin.get_url:
checksum: "{{ librewolf__keyring_hash }}"
url: "{{ librewolf__keyring }}"
dest: /usr/share/keyrings/librewolf.gpg
mode: '644'
owner: root
group: root
when: "'librewolf' not in ansible_facts.packages and ansible_os_family == 'Debian'"

- name: Add repo to list of sources
become: true
ansible.builtin.template:
source: 'templates/librewolf.sources.j2'
dest: '/etc/apt/sources.list.d/librewolf.sources'
mode: '644'
owner: 'root'
group: 'root'
when: "'librewolf' not in ansible_facts.packages and ansible_os_family == 'Debian'"
11 changes: 11 additions & 0 deletions tasks/xdg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Set default web browser to LibreWolf for each user

Check failure on line 2 in tasks/xdg.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

ignore-errors

Use failed_when and specify error conditions instead of using ignore_errors.
become: true
ansible.builtin.command: >
sudo -u {{ item.user }} xdg-settings set default-web-browser librewolf.desktop
environment:
DISPLAY: ":0"
HOME: "{{ item.home | default('/home/' ~ item.user) }}"
loop: "{{ librewolf__xdg_settings_user }}"
ignore_errors: true
changed_when: _libreoffice_install.changed
7 changes: 7 additions & 0 deletions templates/librewolf.sources.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{ ansible_managed | comment }}
Types: deb
URIs: https://deb.librewolf.net
Suites: {{ ansible_lsb.codename }}
Components: main
Architectures: amd64
Signed-By: /usr/share/keyrings/librewolf.gpg
2 changes: 1 addition & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
# versionscheck
playbook_version_number: 03
playbook_version_number: 04
playbook_version_path: 'l3d.linuc.librewolf.version'

0 comments on commit ca36ffe

Please sign in to comment.