From f378f95d4cbbda0a242698870beeb1e630ccaa14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Grondek?= Date: Fri, 19 Apr 2024 20:55:06 +0200 Subject: [PATCH] Merge ubuntu roles --- localhost.yml | 2 - roles/ubuntu-firefox/tasks/linux-mint.yml | 83 ------------------- roles/ubuntu-firefox/tasks/main.yml | 6 -- roles/ubuntu-firefox/tasks/ppa.yml | 55 ------------ .../tasks/update-alternatives.yml | 6 -- .../apt.conf.d/51unattended-upgrades-firefox | 0 .../files/etc/apt/preferences.d/mint-firefox | 0 .../etc/apt/preferences.d/mozillateamppa | 0 .../files/tmp/fakepkg | 0 roles/ubuntu/tasks/chromium.yml | 45 ++++++++++ roles/ubuntu/tasks/firefox.yml | 80 +++++++++++++----- roles/ubuntu/tasks/main.yml | 6 ++ .../tasks/openjdk-11.yml | 0 .../tasks/openjdk-17.yml | 0 .../tasks/openjdk-8.yml | 0 .../main.yml => ubuntu/tasks/openjdk.yml} | 0 16 files changed, 112 insertions(+), 171 deletions(-) delete mode 100644 roles/ubuntu-firefox/tasks/linux-mint.yml delete mode 100644 roles/ubuntu-firefox/tasks/main.yml delete mode 100644 roles/ubuntu-firefox/tasks/ppa.yml delete mode 100644 roles/ubuntu-firefox/tasks/update-alternatives.yml rename roles/{ubuntu-firefox => ubuntu}/files/etc/apt/apt.conf.d/51unattended-upgrades-firefox (100%) rename roles/{ubuntu-firefox => ubuntu}/files/etc/apt/preferences.d/mint-firefox (100%) rename roles/{ubuntu-firefox => ubuntu}/files/etc/apt/preferences.d/mozillateamppa (100%) rename roles/{ubuntu-firefox => ubuntu}/files/tmp/fakepkg (100%) create mode 100644 roles/ubuntu/tasks/chromium.yml rename roles/{ubuntu-java => ubuntu}/tasks/openjdk-11.yml (100%) rename roles/{ubuntu-java => ubuntu}/tasks/openjdk-17.yml (100%) rename roles/{ubuntu-java => ubuntu}/tasks/openjdk-8.yml (100%) rename roles/{ubuntu-java/tasks/main.yml => ubuntu/tasks/openjdk.yml} (100%) diff --git a/localhost.yml b/localhost.yml index 0986417..2e87805 100644 --- a/localhost.yml +++ b/localhost.yml @@ -4,8 +4,6 @@ - prepare - systemd-boot - ubuntu - - ubuntu-java - - ubuntu-firefox - prusa-slicer - dev-java - dev-js diff --git a/roles/ubuntu-firefox/tasks/linux-mint.yml b/roles/ubuntu-firefox/tasks/linux-mint.yml deleted file mode 100644 index b3255b0..0000000 --- a/roles/ubuntu-firefox/tasks/linux-mint.yml +++ /dev/null @@ -1,83 +0,0 @@ -- 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 deleted file mode 100644 index af74ad3..0000000 --- a/roles/ubuntu-firefox/tasks/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- import_tasks: linux-mint.yml - when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int >= 22 - -- import_tasks: update-alternatives.yml - when: ansible_distribution == "Ubuntu" diff --git a/roles/ubuntu-firefox/tasks/ppa.yml b/roles/ubuntu-firefox/tasks/ppa.yml deleted file mode 100644 index 16331bf..0000000 --- a/roles/ubuntu-firefox/tasks/ppa.yml +++ /dev/null @@ -1,55 +0,0 @@ -- 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 ppa - apt_repository: - repo: ppa:mozillateam/ppa - - - name: set mozillateam higher priority - copy: - src: etc/apt/preferences.d/mozillateamppa - dest: /etc/apt/preferences.d/mozillateamppa - - - name: set mozillateam for unattended upgrades - copy: - src: etc/apt/apt.conf.d/51unattended-upgrades-firefox - dest: /etc/apt/apt.conf.d/51unattended-upgrades-firefox - - - name: install browser - become: yes - apt: - allow_downgrade: true - update_cache: yes - state: latest - pkg: - - firefox diff --git a/roles/ubuntu-firefox/tasks/update-alternatives.yml b/roles/ubuntu-firefox/tasks/update-alternatives.yml deleted file mode 100644 index db9e8e5..0000000 --- a/roles/ubuntu-firefox/tasks/update-alternatives.yml +++ /dev/null @@ -1,6 +0,0 @@ -- name: Set firefox as x-www-browser - become: yes - command: update-alternatives --set x-www-browser /usr/bin/firefox - -- name: update xdg default-web-browser - command: xdg-settings set default-web-browser firefox.desktop \ No newline at end of file diff --git a/roles/ubuntu-firefox/files/etc/apt/apt.conf.d/51unattended-upgrades-firefox b/roles/ubuntu/files/etc/apt/apt.conf.d/51unattended-upgrades-firefox similarity index 100% rename from roles/ubuntu-firefox/files/etc/apt/apt.conf.d/51unattended-upgrades-firefox rename to roles/ubuntu/files/etc/apt/apt.conf.d/51unattended-upgrades-firefox diff --git a/roles/ubuntu-firefox/files/etc/apt/preferences.d/mint-firefox b/roles/ubuntu/files/etc/apt/preferences.d/mint-firefox similarity index 100% rename from roles/ubuntu-firefox/files/etc/apt/preferences.d/mint-firefox rename to roles/ubuntu/files/etc/apt/preferences.d/mint-firefox diff --git a/roles/ubuntu-firefox/files/etc/apt/preferences.d/mozillateamppa b/roles/ubuntu/files/etc/apt/preferences.d/mozillateamppa similarity index 100% rename from roles/ubuntu-firefox/files/etc/apt/preferences.d/mozillateamppa rename to roles/ubuntu/files/etc/apt/preferences.d/mozillateamppa diff --git a/roles/ubuntu-firefox/files/tmp/fakepkg b/roles/ubuntu/files/tmp/fakepkg similarity index 100% rename from roles/ubuntu-firefox/files/tmp/fakepkg rename to roles/ubuntu/files/tmp/fakepkg diff --git a/roles/ubuntu/tasks/chromium.yml b/roles/ubuntu/tasks/chromium.yml new file mode 100644 index 0000000..58c3e2a --- /dev/null +++ b/roles/ubuntu/tasks/chromium.yml @@ -0,0 +1,45 @@ +--- +- become: yes + block: + - name: Gather the package facts + ansible.builtin.package_facts: + manager: auto + + - name: add mint gpg key + command: apt-key adv --recv-keys --keyserver keyserver.ubuntu.com A1715D88E1DF1F24 40976EAF437D05B5 3B4FE6ACC0B21F32 A6616109451BBBF2 + + - name: remove snap + community.general.snap: + name: chromium + state: absent + when: + - "'snapd' in ansible_facts.packages" + - "'chromium-browser' in ansible_facts.packages" + - ansible_facts.packages['chromium-browser'][0].version == "1:85.0.4183.83-0ubuntu2.22.04.1" + + - name: remove apt snap wrapper version + apt: + state: absent + pkg: + - chromium + - chromium-browser + when: + - "'chromium-browser' in ansible_facts.packages" + - ansible_facts.packages['chromium-browser'][0].version == "1:85.0.4183.83-0ubuntu2.22.04.1" + + - name: add linux mint repo + apt_repository: + repo: deb http://packages.linuxmint.com vera upstream + state: present + filename: linux-mint + + - name: pin linux mint version of chromium + copy: + src: etc/apt/preferences.d/mint-chromium + dest: /etc/apt/preferences.d/mint-chromium + + - name: install chromium + apt: + update_cache: yes + pkg: + - chromium \ No newline at end of file diff --git a/roles/ubuntu/tasks/firefox.yml b/roles/ubuntu/tasks/firefox.yml index 58c3e2a..7c336c6 100644 --- a/roles/ubuntu/tasks/firefox.yml +++ b/roles/ubuntu/tasks/firefox.yml @@ -1,45 +1,87 @@ ---- - become: yes block: - name: Gather the package facts ansible.builtin.package_facts: manager: auto - - name: add mint gpg key - command: apt-key adv --recv-keys --keyserver keyserver.ubuntu.com A1715D88E1DF1F24 40976EAF437D05B5 3B4FE6ACC0B21F32 A6616109451BBBF2 - - name: remove snap community.general.snap: - name: chromium + name: firefox state: absent when: - "'snapd' in ansible_facts.packages" - - "'chromium-browser' in ansible_facts.packages" - - ansible_facts.packages['chromium-browser'][0].version == "1:85.0.4183.83-0ubuntu2.22.04.1" + - "'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: - - chromium - - chromium-browser + - firefox when: - - "'chromium-browser' in ansible_facts.packages" - - ansible_facts.packages['chromium-browser'][0].version == "1:85.0.4183.83-0ubuntu2.22.04.1" + - "'firefox' in ansible_facts.packages" + - ansible_facts.packages['firefox'][0].version == "1:1snap1-0ubuntu2" - - name: add linux mint repo - apt_repository: + - name: Add linux mint source list + ansible.builtin.apt_repository: repo: deb http://packages.linuxmint.com vera upstream state: present - filename: linux-mint - - name: pin linux mint version of chromium + - name: set linux mint for higher priority copy: - src: etc/apt/preferences.d/mint-chromium - dest: /etc/apt/preferences.d/mint-chromium + src: etc/apt/preferences.d/mint-firefox + dest: /etc/apt/preferences.d/mint-firefox - - name: install chromium + - 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 apt: update_cache: yes + state: latest pkg: - - chromium \ No newline at end of file + - 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 + apt: + allow_downgrade: true + update_cache: yes + state: latest + pkg: + - firefox + + - name: Set firefox as x-www-browser + command: update-alternatives --set x-www-browser /usr/bin/firefox + + - name: update xdg default-web-browser + command: xdg-settings set default-web-browser firefox.desktop diff --git a/roles/ubuntu/tasks/main.yml b/roles/ubuntu/tasks/main.yml index fffc4eb..0f8066c 100644 --- a/roles/ubuntu/tasks/main.yml +++ b/roles/ubuntu/tasks/main.yml @@ -14,8 +14,14 @@ - import_tasks: unsnap.yml when: ansible_distribution == "Ubuntu" +- import_tasks: chromium.yml + when: ansible_distribution == "Ubuntu" + - import_tasks: firefox.yml when: ansible_distribution == "Ubuntu" - import_tasks: dconf.yml when: ansible_distribution == "Ubuntu" + +- import_tasks: openjdk.yml + when: ansible_distribution == "Ubuntu" diff --git a/roles/ubuntu-java/tasks/openjdk-11.yml b/roles/ubuntu/tasks/openjdk-11.yml similarity index 100% rename from roles/ubuntu-java/tasks/openjdk-11.yml rename to roles/ubuntu/tasks/openjdk-11.yml diff --git a/roles/ubuntu-java/tasks/openjdk-17.yml b/roles/ubuntu/tasks/openjdk-17.yml similarity index 100% rename from roles/ubuntu-java/tasks/openjdk-17.yml rename to roles/ubuntu/tasks/openjdk-17.yml diff --git a/roles/ubuntu-java/tasks/openjdk-8.yml b/roles/ubuntu/tasks/openjdk-8.yml similarity index 100% rename from roles/ubuntu-java/tasks/openjdk-8.yml rename to roles/ubuntu/tasks/openjdk-8.yml diff --git a/roles/ubuntu-java/tasks/main.yml b/roles/ubuntu/tasks/openjdk.yml similarity index 100% rename from roles/ubuntu-java/tasks/main.yml rename to roles/ubuntu/tasks/openjdk.yml