From 259ff6ba243b7af30a25db26d6cc9262822d79df Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Mon, 3 Jul 2023 23:57:07 +0200 Subject: [PATCH] Install chromium only on Ubuntu 22.04 --- roles/chromium/tasks/install.yml | 44 ++++++++++++++++++++++++++++++ roles/chromium/tasks/main.yml | 46 ++------------------------------ 2 files changed, 46 insertions(+), 44 deletions(-) create mode 100644 roles/chromium/tasks/install.yml diff --git a/roles/chromium/tasks/install.yml b/roles/chromium/tasks/install.yml new file mode 100644 index 0000000..81efe5f --- /dev/null +++ b/roles/chromium/tasks/install.yml @@ -0,0 +1,44 @@ +--- +- 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: + - "'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/chromium/tasks/main.yml b/roles/chromium/tasks/main.yml index 81efe5f..64cb424 100644 --- a/roles/chromium/tasks/main.yml +++ b/roles/chromium/tasks/main.yml @@ -1,44 +1,2 @@ ---- -- 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: - - "'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 +- import_tasks: install.yml + when: ansible_distribution == "Ubuntu" and ansible_distribution_version == "22.04"