|
| 1 | +- block: |
| 2 | +# install libs needed for nuget package PuppeteerSharp |
| 3 | + - name: Define core packages |
| 4 | + set_fact: |
| 5 | + core_packages: |
| 6 | + - ca-certificates |
| 7 | + - fonts-liberation |
| 8 | + - libappindicator3-1 |
| 9 | + - libatk-bridge2.0-0 |
| 10 | + - libatk1.0-0 |
| 11 | + - libcups2 |
| 12 | + - libdbus-1-3 |
| 13 | + - libdrm2 |
| 14 | + - libgbm1 |
| 15 | + - libnspr4 |
| 16 | + - libnss3 |
| 17 | + - libx11-xcb1 |
| 18 | + - libxcomposite1 |
| 19 | + - libxdamage1 |
| 20 | + - libxrandr2 |
| 21 | + - xdg-utils |
| 22 | + |
| 23 | + - name: Define default platform-specific library names |
| 24 | + set_fact: |
| 25 | + glib_library: libglib2.0-0 |
| 26 | + sound_library: libasound2 |
| 27 | + |
| 28 | + - name: Define new library names based on newer OS versions |
| 29 | + set_fact: |
| 30 | + glib_library: libglib2.0-0t64 |
| 31 | + sound_library: libasound2t64 |
| 32 | + when: > |
| 33 | + ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_version'] | float >= 24.04 |
| 34 | + or ansible_facts['distribution'] == "Debian" and ansible_facts['distribution_version'] | float >= 13 |
| 35 | + or ansible_facts['distribution'] == "Debian" and ansible_lsb.codename == "trixie" |
| 36 | +
|
| 37 | + - block: # only use apparmor for ubuntu 24.04ff |
| 38 | + - name: Ensure the /etc/apparmor.d directory exists |
| 39 | + file: |
| 40 | + path: /etc/apparmor.d |
| 41 | + state: directory |
| 42 | + mode: '0755' |
| 43 | + |
| 44 | + - name: Create /etc/apparmor.d/chrome-dev-builds for Chrome |
| 45 | + copy: |
| 46 | + dest: /etc/apparmor.d/chrome-dev-builds |
| 47 | + content: | |
| 48 | + abi <abi/{{ abi_version }}>, |
| 49 | + include <tunables/global> |
| 50 | +
|
| 51 | + profile /usr/local/bin/**/chrome flags=(unconfined) { |
| 52 | + userns, |
| 53 | +
|
| 54 | + # Site-specific additions and overrides. See local/README for details. |
| 55 | + # Include the local overrides only if the file exists. |
| 56 | + # This is a common best practice to avoid parser errors. |
| 57 | + include if exists <local/chrome> |
| 58 | + } |
| 59 | + mode: '0644' |
| 60 | + notify: |
| 61 | + - Reload and Restart AppArmor |
| 62 | + |
| 63 | + when: ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_version'] | float >= 24.04 |
| 64 | + |
| 65 | + - name: Install additional libraries for old Debian 11 |
| 66 | + apt: |
| 67 | + name: |
| 68 | + - libpangocairo-1.0-0 |
| 69 | + - libpangoft2-1.0-0 |
| 70 | + state: present |
| 71 | + update_cache: yes |
| 72 | + when: ansible_facts['distribution'] == "Debian" and ansible_facts['distribution_version'] == "11" |
| 73 | + |
| 74 | + - name: Combine all packages |
| 75 | + set_fact: |
| 76 | + platform_packages: "{{ core_packages + [sound_library, glib_library] }}" |
| 77 | + |
| 78 | + - name: Install all combined dependencies |
| 79 | + apt: |
| 80 | + name: "{{ platform_packages }}" |
| 81 | + state: present |
| 82 | + update_cache: yes |
| 83 | + |
| 84 | + become: true |
| 85 | + environment: "{{ proxy_env }}" |
| 86 | + |
| 87 | +# get google chrome for pdf generation |
| 88 | +- name: get last known good versions of chrome to download |
| 89 | + uri: |
| 90 | + url: https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json |
| 91 | + register: chrome_versions |
| 92 | + |
| 93 | +- name: parse latest stable versions for chrome and headless shell |
| 94 | + set_fact: |
| 95 | + stable_chrome_versions: "{{ chrome_versions['json']['channels']['Stable']['downloads'] }}" |
| 96 | + chrome_dest: "/usr/local/bin/Chrome/Linux-{{ chrome_versions['json']['channels']['Stable']['version'] }}" |
| 97 | + headless_shell_dest: "/usr/local/bin/ChromeHeadlessShell/Linux-{{ chrome_versions['json']['channels']['Stable']['version'] }}" |
| 98 | + |
| 99 | +- block: |
| 100 | + - name: install unzip |
| 101 | + package: |
| 102 | + name: unzip |
| 103 | + state: present |
| 104 | + |
| 105 | + - name: create chrome install path |
| 106 | + file: |
| 107 | + path: "{{ chrome_dest }}" |
| 108 | + state: directory |
| 109 | + mode: '0755' |
| 110 | + |
| 111 | + - name: create chrome headless shell install path |
| 112 | + file: |
| 113 | + path: "{{ headless_shell_dest }}" |
| 114 | + state: directory |
| 115 | + mode: '0755' |
| 116 | + |
| 117 | + - name: download google chrome and unpack |
| 118 | + unarchive: |
| 119 | + src: "{{ stable_chrome_versions['chrome'] | selectattr('platform', 'match', 'linux64') | map(attribute='url') | first }}" |
| 120 | + dest: "{{ chrome_dest }}" |
| 121 | + remote_src: yes |
| 122 | + |
| 123 | + - name: download google chrome headless shell and unpack |
| 124 | + unarchive: |
| 125 | + src: "{{ stable_chrome_versions['chrome-headless-shell'] | selectattr('platform', 'match', 'linux64') | map(attribute='url') | first }}" |
| 126 | + dest: "{{ headless_shell_dest }}" |
| 127 | + remote_src: yes |
| 128 | + |
| 129 | + become: true |
| 130 | + environment: "{{ proxy_env }}" |
0 commit comments