fix ansible installed_packages and cacheable facts

This commit is contained in:
Nick Sweeting 2024-09-15 20:28:35 -07:00
parent 56b851ea1b
commit e9ddac0219
No known key found for this signature in database
6 changed files with 30 additions and 21 deletions

View file

@ -1,8 +1,16 @@
---
- import_playbook: install_ytdlp.yml
vars:
state: 'latest'
state: 'present'
- import_playbook: install_singlefile.yml
vars:
state: 'latest'
state: 'present'
- import_playbook: install_package.yml
vars:
install_packages:
curl: {packages: ['curl']}
wget: {packages: ['wget']}
state: 'present'

View file

@ -25,9 +25,9 @@
LIB_DIR_BIN: '{{LIB_DIR}}/bin'
LIB_DIR_NPM: '{{LIB_DIR}}/npm'
LIB_DIR_NPM_BIN: '{{LIB_DIR_NPM}}/node_modules/.bin'
MIN_NODE_VERSION: '22.7.0'
MIN_NPM_VERSION: '10.8.3'
state: 'latest'
MIN_NODE_VERSION: '20.0.0'
MIN_NPM_VERSION: '10.0.0'
state: 'present'
install_npm: {}
tasks:
# - package: update_cache=yes
@ -48,8 +48,8 @@
- name: Check that installed Node version matches expected version
assert:
that:
- BINARIES.node.version is version(MIN_NODE_VERSION, '<=')
- BINARIES.npm.version is version(MIN_NPM_VERSION, '<=')
- BINARIES.node.version is version(MIN_NODE_VERSION, '>=')
- BINARIES.npm.version is version(MIN_NPM_VERSION, '>=')
quiet: true
when: BINPROVIDERS.npm is not defined
@ -71,8 +71,10 @@
installer_version: "{{BINARIES.npm.version}}"
PATH: "{{LIB_DIR_NPM_BIN}}"
when: BINPROVIDERS.npm is not defined
- set_fact:
BINPROVIDERS: "{{ BINPROVIDERS | default({}) | combine(NODE_BINPROVIDERS) }}"
cacheable: true
when: BINPROVIDERS.npm is not defined
- debug:

View file

@ -6,7 +6,7 @@
DATA_DIR: '/Volumes/NVME/Users/squash/Code/archiveboxes/archivebox7/data4'
LIB_DIR: '{{DATA_DIR}}/lib'
LIB_DIR_BIN: '{{LIB_DIR}}/bin'
state: 'latest'
state: 'present'
install_packages: {}
# bash:
# packages: ['bash']
@ -50,10 +50,12 @@
installer_abspath: "{{ANSIBLE_INSTALLER_ABSPATH_FULL.stdout}}"
installer_version: "{{ansible_version.full}}"
PATH: "/opt/homebrew/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
when: BINPROVIDERS.ansible_package is not defined
- set_fact:
BINPROVIDERS: "{{ BINPROVIDERS | default({}) | combine(PACKAGE_BINPROVIDERS) }}"
cacheable: true
when: BINPROVIDERS.ansible_package is not defined
- debug:

View file

@ -1,11 +1,5 @@
---
- import_playbook: install_package.yml
vars:
install_packages:
python: {packages: ['python3']}
state: 'latest'
- import_playbook: load_binaries.yml
vars:
load_binaries:
@ -23,7 +17,7 @@
LIB_DIR_PIP_BIN: '{{LIB_DIR_PIP}}/venv/bin'
MIN_PYTHON_VERSION: '3.11.9'
MIN_PIP_VERSION: '24.2'
state: 'latest'
state: 'present'
install_pip:
pip:
bin_name: 'pip'
@ -47,8 +41,8 @@
- assert:
that:
- BINARIES.python.version is version(MIN_PYTHON_VERSION, '<=')
- BINARIES.pip.version is version(MIN_PIP_VERSION, '<=')
- BINARIES.python.version is version(MIN_PYTHON_VERSION, '>=')
- BINARIES.pip.version is version(MIN_PIP_VERSION, '>=')
quiet: true
when: BINPROVIDERS.pip is not defined
@ -70,8 +64,10 @@
installer_version: "{{BINARIES.pip.version}}"
PATH: "{{LIB_DIR_PIP_BIN}}"
when: BINPROVIDERS.pip is not defined
- set_fact:
BINPROVIDERS: "{{ BINPROVIDERS | default({}) | combine(PIP_BINPROVIDERS) }}"
cacheable: true
when: BINPROVIDERS.pip is not defined
- debug:

View file

@ -1,15 +1,15 @@
---
- import_playbook: install_package.yml
vars:
install_package:
install_packages:
ffmpeg: {packages: ['ffmpeg']}
state: 'latest'
state: 'present'
- import_playbook: install_pip.yml
vars:
install_pip:
ytdlp: {packages: ['yt-dlp']}
state: 'latest'
state: 'present'
- import_playbook: load_binaries.yml
vars:
@ -35,7 +35,7 @@
- name: Check that installed YT-DLP matches expected version
assert:
that: YTDLP_VERSION_MIN is version(BINARIES.ytdlp.version, '>=')
that: BINARIES.ytdlp.version is version(YTDLP_VERSION_MIN, '>=')
quiet: true
- debug:

View file

@ -80,6 +80,7 @@
}),
})
}}"
cacheable: true
loop: "{{load_binaries|dictsort|map(attribute='0')}}"
###################################################################################