1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/yarn/tasks/install.yml

67 lines
2 KiB
YAML

- name: Record (initial) disk space used
shell: df -B1 --output=used / | tail -1
register: df1
- name: Yarn | Download apt key to /usr/share/keyrings/yarn.gpg
shell: curl https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/share/keyrings/yarn.gpg
- name: Yarn | Add signed Yarn PPA to /etc/apt/sources.list.d/dl_yarnpkg_com_debian.list
apt_repository:
repo: "deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main"
#filename: yarn # If legacy filename yarn.list is preferred
# 2023-04-01 above avoids DEPRECATED apt-key command & associated problems:
# https://github.com/iiab/iiab/wiki/IIAB-Platforms#etcapttrustedgpg-legacy-keyring-warnings
# - name: "Yarn | GPG"
# apt_key:
# url: https://dl.yarnpkg.com/debian/pubkey.gpg
# state: present
# - name: "Yarn | Ensure Debian sources list file exists"
# file:
# path: /etc/apt/sources.list.d/yarn.list
# owner: root
# mode: '0644'
# state: touch
# - name: "Yarn | Ensure Debian package is in sources list"
# lineinfile:
# dest: /etc/apt/sources.list.d/yarn.list
# regexp: 'deb https://dl.yarnpkg.com/debian/ stable main'
# line: 'deb https://dl.yarnpkg.com/debian/ stable main'
# state: present
- name: Yarn | Update APT cache
apt:
update_cache: yes
- name: Yarn | Install
package:
name: yarn
#state: latest # No need to mention it, with apt
# RECORD Yarn AS INSTALLED
- name: Record (final) disk space used
shell: df -B1 --output=used / | tail -1
register: df2
- name: Add 'yarn_disk_usage = {{ df2.stdout|int - df1.stdout|int }}' to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section: yarn
option: yarn_disk_usage
value: "{{ df2.stdout|int - df1.stdout|int }}"
- name: "Set 'yarn_installed: True'"
set_fact:
yarn_installed: True
- name: "Add 'yarn_installed: True' to {{ iiab_state_file }}"
lineinfile:
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^yarn_installed'
line: 'yarn_installed: True'