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

View file

@ -6,7 +6,7 @@
DATA_DIR: '/Volumes/NVME/Users/squash/Code/archiveboxes/archivebox7/data4' DATA_DIR: '/Volumes/NVME/Users/squash/Code/archiveboxes/archivebox7/data4'
LIB_DIR: '{{DATA_DIR}}/lib' LIB_DIR: '{{DATA_DIR}}/lib'
LIB_DIR_BIN: '{{LIB_DIR}}/bin' LIB_DIR_BIN: '{{LIB_DIR}}/bin'
state: 'latest' state: 'present'
install_packages: {} install_packages: {}
# bash: # bash:
# packages: ['bash'] # packages: ['bash']
@ -50,10 +50,12 @@
installer_abspath: "{{ANSIBLE_INSTALLER_ABSPATH_FULL.stdout}}" installer_abspath: "{{ANSIBLE_INSTALLER_ABSPATH_FULL.stdout}}"
installer_version: "{{ansible_version.full}}" installer_version: "{{ansible_version.full}}"
PATH: "/opt/homebrew/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" PATH: "/opt/homebrew/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
when: BINPROVIDERS.ansible_package is not defined when: BINPROVIDERS.ansible_package is not defined
- set_fact: - set_fact:
BINPROVIDERS: "{{ BINPROVIDERS | default({}) | combine(PACKAGE_BINPROVIDERS) }}" BINPROVIDERS: "{{ BINPROVIDERS | default({}) | combine(PACKAGE_BINPROVIDERS) }}"
cacheable: true
when: BINPROVIDERS.ansible_package is not defined when: BINPROVIDERS.ansible_package is not defined
- debug: - 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 - import_playbook: load_binaries.yml
vars: vars:
load_binaries: load_binaries:
@ -23,7 +17,7 @@
LIB_DIR_PIP_BIN: '{{LIB_DIR_PIP}}/venv/bin' LIB_DIR_PIP_BIN: '{{LIB_DIR_PIP}}/venv/bin'
MIN_PYTHON_VERSION: '3.11.9' MIN_PYTHON_VERSION: '3.11.9'
MIN_PIP_VERSION: '24.2' MIN_PIP_VERSION: '24.2'
state: 'latest' state: 'present'
install_pip: install_pip:
pip: pip:
bin_name: 'pip' bin_name: 'pip'
@ -47,8 +41,8 @@
- assert: - assert:
that: that:
- BINARIES.python.version is version(MIN_PYTHON_VERSION, '<=') - BINARIES.python.version is version(MIN_PYTHON_VERSION, '>=')
- BINARIES.pip.version is version(MIN_PIP_VERSION, '<=') - BINARIES.pip.version is version(MIN_PIP_VERSION, '>=')
quiet: true quiet: true
when: BINPROVIDERS.pip is not defined when: BINPROVIDERS.pip is not defined
@ -70,8 +64,10 @@
installer_version: "{{BINARIES.pip.version}}" installer_version: "{{BINARIES.pip.version}}"
PATH: "{{LIB_DIR_PIP_BIN}}" PATH: "{{LIB_DIR_PIP_BIN}}"
when: BINPROVIDERS.pip is not defined when: BINPROVIDERS.pip is not defined
- set_fact: - set_fact:
BINPROVIDERS: "{{ BINPROVIDERS | default({}) | combine(PIP_BINPROVIDERS) }}" BINPROVIDERS: "{{ BINPROVIDERS | default({}) | combine(PIP_BINPROVIDERS) }}"
cacheable: true
when: BINPROVIDERS.pip is not defined when: BINPROVIDERS.pip is not defined
- debug: - debug:

View file

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

View file

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