diff --git a/roles/ubuntu-firefox/files/etc/apt/preferences.d/mint-firefox b/roles/ubuntu-firefox/files/etc/apt/preferences.d/mint-firefox new file mode 100644 index 0000000..1233e6b --- /dev/null +++ b/roles/ubuntu-firefox/files/etc/apt/preferences.d/mint-firefox @@ -0,0 +1,11 @@ +Package: * +Pin: release o=linuxmint +Pin-Priority: -1 + +Package: firefox* +Pin: release o=linuxmint +Pin-Priority: 1002 + +Package: firefox* +Pin: release o=linuxmint +Pin-Priority: 1002 diff --git a/roles/ubuntu-firefox/files/tmp/fakepkg b/roles/ubuntu-firefox/files/tmp/fakepkg new file mode 100644 index 0000000..817f7f4 --- /dev/null +++ b/roles/ubuntu-firefox/files/tmp/fakepkg @@ -0,0 +1,7 @@ +Section: misc +Priority: optional +Standards-Version: 3.9.2 +Package: ubuntu-system-adjustments +Version: 2021.12.16 + +Description: Fake package to install firefox from linux mint diff --git a/roles/ubuntu-firefox/tasks/linux-mint.yml b/roles/ubuntu-firefox/tasks/linux-mint.yml new file mode 100644 index 0000000..b3255b0 --- /dev/null +++ b/roles/ubuntu-firefox/tasks/linux-mint.yml @@ -0,0 +1,83 @@ +- become: yes + block: + - name: Gather the package facts + ansible.builtin.package_facts: + manager: auto + + - name: remove snap + community.general.snap: + name: firefox + state: absent + when: + - "'snapd' in ansible_facts.packages" + - "'firefox' in ansible_facts.packages" + - ansible_facts.packages['firefox'][0].version == "1:1snap1-0ubuntu2" + + - name: remove snap + community.general.snap: + name: firefox + state: disabled + when: + - "'snapd' in ansible_facts.packages" + - "'firefox' in ansible_facts.packages" + - ansible_facts.packages['firefox'][0].version == "1:1snap1-0ubuntu2" + + - name: remove apt snap wrapper version + apt: + state: absent + pkg: + - firefox + when: + - "'firefox' in ansible_facts.packages" + - ansible_facts.packages['firefox'][0].version == "1:1snap1-0ubuntu2" + + - name: Add linux mint source list + ansible.builtin.apt_repository: + repo: deb http://packages.linuxmint.com vera upstream + state: present + + - name: set linux mint for higher priority + copy: + src: etc/apt/preferences.d/mint-firefox + dest: /etc/apt/preferences.d/mint-firefox + + - name: Remove unattended upgrades + file: + path: /etc/apt/apt.conf.d/51unattended-upgrades-firefox + state: absent + + - name: Remove mozilla ppa + apt_repository: + repo: ppa:mozillateam/ppa + state: absent + + - name: install equivs + become: yes + apt: + update_cache: yes + state: latest + pkg: + - equivs + + - name: copy fakepackage to satisfy dependencies + copy: + src: tmp/fakepkg + dest: /tmp/fakepkg + + - name: make fake ubuntu-system-adjustments package + shell: + cmd: equivs-build /tmp/fakepkg + chdir: /tmp + + - name: Install a .deb package + ansible.builtin.apt: + deb: /tmp/ubuntu-system-adjustments_2021.12.16_all.deb + + - name: install browser + become: yes + apt: + allow_downgrade: true + update_cache: yes + state: latest + pkg: + - firefox diff --git a/roles/ubuntu-firefox/tasks/main.yml b/roles/ubuntu-firefox/tasks/main.yml index d9de177..af74ad3 100644 --- a/roles/ubuntu-firefox/tasks/main.yml +++ b/roles/ubuntu-firefox/tasks/main.yml @@ -1,5 +1,5 @@ --- -- import_tasks: ppa.yml +- import_tasks: linux-mint.yml when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int >= 22 - import_tasks: update-alternatives.yml