mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-10 06:34:16 +00:00
more ansible fixes
This commit is contained in:
parent
c55cd46ecb
commit
5c0aa6fe59
15 changed files with 63 additions and 617 deletions
|
@ -1,58 +0,0 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
|
||||||
---
|
|
||||||
# - name: "Install using apt/brew/pkg/yum/etc."
|
|
||||||
# hosts: localhost
|
|
||||||
# gather_facts: no
|
|
||||||
# vars:
|
|
||||||
# DATA_DIR: '/Volumes/NVME/Users/squash/Code/archiveboxes/archivebox7/data4'
|
|
||||||
# LIB_DIR: '{{DATA_DIR}}/lib'
|
|
||||||
# LIB_DIR_BIN: '{{LIB_DIR}}/bin'
|
|
||||||
# state: 'present'
|
|
||||||
# install_packages: {}
|
|
||||||
# # bash:
|
|
||||||
# # packages: ['bash']
|
|
||||||
# PACKAGE_BINPROVIDERS: {}
|
|
||||||
# PACKAGE_BINARIES: {}
|
|
||||||
# BINPROVIDERS: {}
|
|
||||||
# tasks:
|
|
||||||
# - package: update_cache=yes
|
|
||||||
# when: ansible_facts['os_family'] == "Debian"
|
|
||||||
|
|
||||||
- name: Make sure lib folders exist
|
|
||||||
file:
|
|
||||||
path: '{{LIB_DIR_BIN}}'
|
|
||||||
state: directory
|
|
||||||
recurse: true
|
|
||||||
when: BINPROVIDERS.ansible_package is not defined
|
|
||||||
|
|
||||||
- name: Get ansible binary abspath
|
|
||||||
command: 'which ansible'
|
|
||||||
register: ANSIBLE_INSTALLER_ABSPATH_FULL
|
|
||||||
changed_when: false
|
|
||||||
when: BINPROVIDERS.ansible_package is not defined
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
- name: "Install system packages: {{all_packages}}"
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: "{{item}}"
|
|
||||||
state: "{{state}}"
|
|
||||||
loop: "{{all_packages}}"
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
PACKAGE_BINPROVIDERS:
|
|
||||||
ansible_package:
|
|
||||||
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:
|
|
||||||
msg: "{{ {'BINPROVIDERS': BINPROVIDERS} }}"
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
DATA_DIR: '{{playbook_dir}}'
|
|
||||||
LIB_DIR: '{{DATA_DIR}}/lib'
|
|
||||||
LIB_DIR_BIN: '{{LIB_DIR}}/bin'
|
|
||||||
state: present
|
|
||||||
all_packages: []
|
|
|
@ -32,7 +32,8 @@
|
||||||
|
|
||||||
- name: 'Updating BINARIES with loaded abspaths & versions: {{name}}'
|
- name: 'Updating BINARIES with loaded abspaths & versions: {{name}}'
|
||||||
set_fact:
|
set_fact:
|
||||||
BINARIES: "{{ BINARIES
|
BINARIES: "{{
|
||||||
|
BINARIES
|
||||||
| default({})
|
| default({})
|
||||||
| combine({
|
| combine({
|
||||||
name: {
|
name: {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
when: BINPROVIDERS.pip is not defined
|
when: BINPROVIDERS.pip is not defined
|
||||||
|
|
||||||
- name: Load Python and Pip binaries
|
- name: Load Python and Pip binaries
|
||||||
import_role:
|
include_role:
|
||||||
name: load_binary
|
name: load_binary
|
||||||
vars:
|
vars:
|
||||||
name: '{{item}}'
|
name: '{{item}}'
|
||||||
|
@ -53,7 +53,17 @@
|
||||||
- set_fact:
|
- set_fact:
|
||||||
BINPROVIDERS: "{{ BINPROVIDERS | default({}) | combine(PIP_BINPROVIDERS) }}"
|
BINPROVIDERS: "{{ BINPROVIDERS | default({}) | combine(PIP_BINPROVIDERS) }}"
|
||||||
cacheable: true
|
cacheable: true
|
||||||
when: BINPROVIDERS.pip is not defined
|
changed_when: False
|
||||||
|
|
||||||
|
- name: Load Python and Pip binaries from venv
|
||||||
|
include_role:
|
||||||
|
name: load_binary
|
||||||
|
vars:
|
||||||
|
name: '{{item}}'
|
||||||
|
PATH: '{{BINPROVIDERS.pip.PATH}}'
|
||||||
|
loop:
|
||||||
|
- python
|
||||||
|
- pip
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
msg: "{{ {'BINARIES': BINARIES, 'BINPROVIDERS': BINPROVIDERS} }}"
|
msg: "{{ {'BINARIES': BINARIES, 'BINPROVIDERS': BINPROVIDERS} }}"
|
||||||
|
|
|
@ -107,12 +107,6 @@
|
||||||
symlink: "{{LIB_DIR_BIN}}/chrome"
|
symlink: "{{LIB_DIR_BIN}}/chrome"
|
||||||
version_cmd: "chrome --version"
|
version_cmd: "chrome --version"
|
||||||
binprovider: 'puppeteer'
|
binprovider: 'puppeteer'
|
||||||
PUPPETEER_BINPROVIDERS:
|
|
||||||
puppeteer:
|
|
||||||
installer_abspath: "{{BINARIES.puppeteer.abspath}}"
|
|
||||||
installer_version: "{{BINARIES.puppeteer.version}}"
|
|
||||||
PATH: "{{LIB_DIR_BIN}}"
|
|
||||||
lib_dir_browsers: "{{LIB_DIR_BROWSERS}}"
|
|
||||||
|
|
||||||
- name: Check that installed Chrome matches expected version
|
- name: Check that installed Chrome matches expected version
|
||||||
assert:
|
assert:
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
../../playbooks/install_singlefile.yml
|
|
40
archivebox/builtin_plugins/singlefile/install_singlefile.yml
Executable file
40
archivebox/builtin_plugins/singlefile/install_singlefile.yml
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/usr/bin/env ansible-playbook
|
||||||
|
---
|
||||||
|
|
||||||
|
- import_playbook: ../puppeteer/install_puppeteer.yml
|
||||||
|
when: not BINARIES.chrome.version|default('')
|
||||||
|
|
||||||
|
- name: "Install Singlefile"
|
||||||
|
hosts: localhost
|
||||||
|
gather_facts: no
|
||||||
|
vars:
|
||||||
|
SINGLEFILE_VERSION_EXACT: '1.1.54'
|
||||||
|
tasks:
|
||||||
|
- include_role:
|
||||||
|
name: setup_lib_npm
|
||||||
|
vars:
|
||||||
|
MIN_NODE_VERSION: '20.0.0'
|
||||||
|
MIN_NPM_VERSION: '10.0.0'
|
||||||
|
|
||||||
|
- name: "Install npm packages: [single-file-cli]"
|
||||||
|
community.general.npm:
|
||||||
|
name: 'single-file-cli@1.1.54'
|
||||||
|
state: "present"
|
||||||
|
path: '{{BINPROVIDERS.npm.root_path}}'
|
||||||
|
|
||||||
|
- name: Load single-file binary from installed NPM package
|
||||||
|
include_role:
|
||||||
|
name: load_binary
|
||||||
|
vars:
|
||||||
|
name: singlefile
|
||||||
|
bin_name: 'single-file'
|
||||||
|
version_cmd: 'single-file --version'
|
||||||
|
PATH: '{{BINPROVIDERS.npm.PATH}}'
|
||||||
|
|
||||||
|
- name: Check that installed Singlefile version matches expected version
|
||||||
|
assert:
|
||||||
|
that: SINGLEFILE_VERSION_EXACT is version(BINARIES.singlefile.version, '==')
|
||||||
|
quiet: true
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ {'BINARIES': BINARIES, 'BINPROVIDERS': BINPROVIDERS} }}"
|
|
@ -2,7 +2,7 @@
|
||||||
---
|
---
|
||||||
- name: "Install YT-DLP"
|
- name: "Install YT-DLP"
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
gather_facts: no
|
gather_facts: True
|
||||||
vars:
|
vars:
|
||||||
YTDLP_VERSION_MIN: '2024.8.6'
|
YTDLP_VERSION_MIN: '2024.8.6'
|
||||||
tasks:
|
tasks:
|
||||||
|
@ -12,26 +12,29 @@
|
||||||
MIN_PYTHON_VERSION: '3.10.0'
|
MIN_PYTHON_VERSION: '3.10.0'
|
||||||
MIN_PIP_VERSION: '22.0'
|
MIN_PIP_VERSION: '22.0'
|
||||||
|
|
||||||
- name: "Install pip packages: {{install_pip}}"
|
- name: "Install pip packages: yt-dlp"
|
||||||
ansible.builtin.pip:
|
ansible.builtin.pip:
|
||||||
name: 'yt-dlp'
|
name: 'yt-dlp'
|
||||||
state: "present"
|
state: 'latest'
|
||||||
virtualenv: '{{BINPROVIDERS.pip.virtualenv}}'
|
virtualenv: '{{BINPROVIDERS.pip.virtualenv}}'
|
||||||
virtualenv_python: "{{BINPROVIDERS.pip.virtualenv_python}}"
|
virtualenv_python: "{{BINPROVIDERS.pip.virtualenv_python}}"
|
||||||
virtualenv_site_packages: yes
|
virtualenv_site_packages: no
|
||||||
|
|
||||||
- name: Load YTDLP binary
|
- name: Load YTDLP binary
|
||||||
import_role:
|
include_role:
|
||||||
name: load_binary
|
name: load_binary
|
||||||
vars:
|
vars:
|
||||||
name: ytdlp
|
name: ytdlp
|
||||||
|
bin_name: yt-dlp
|
||||||
|
PATH: '{{BINPROVIDERS.pip.PATH}}'
|
||||||
|
|
||||||
- name: Load ffmpeg binary
|
- name: Load ffmpeg binary
|
||||||
import_role:
|
include_role:
|
||||||
name: load_binary
|
name: load_binary
|
||||||
vars:
|
vars:
|
||||||
name: ffmpeg
|
name: ffmpeg
|
||||||
version_cmd: 'ffmpeg -version'
|
version_cmd: 'ffmpeg -version'
|
||||||
|
PATH: '{{BINPROVIDERS.pip.PATH}}:{{ansible_env.PATH}}'
|
||||||
|
|
||||||
- name: Check that installed YT-DLP matches expected version
|
- name: Check that installed YT-DLP matches expected version
|
||||||
assert:
|
assert:
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
|
||||||
---
|
|
||||||
- import_playbook: install_ytdlp.yml
|
|
||||||
vars:
|
|
||||||
state: 'present'
|
|
||||||
|
|
||||||
- import_playbook: install_singlefile.yml
|
|
||||||
vars:
|
|
||||||
state: 'present'
|
|
||||||
|
|
||||||
- import_playbook: install_puppeteer.yml
|
|
||||||
vars:
|
|
||||||
state: 'present'
|
|
||||||
|
|
||||||
- import_playbook: install_package.yml
|
|
||||||
vars:
|
|
||||||
install_packages:
|
|
||||||
curl: {packages: ['curl']}
|
|
||||||
wget: {packages: ['wget']}
|
|
||||||
state: 'present'
|
|
|
@ -1,82 +0,0 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
|
||||||
---
|
|
||||||
|
|
||||||
- import_playbook: install_package.yml
|
|
||||||
vars:
|
|
||||||
state: 'latest'
|
|
||||||
install_packages:
|
|
||||||
node:
|
|
||||||
bin_name: 'node'
|
|
||||||
packages: ['node']
|
|
||||||
when: BINARIES.node is not defined
|
|
||||||
|
|
||||||
- import_playbook: load_binaries.yml
|
|
||||||
vars:
|
|
||||||
load_binaries:
|
|
||||||
node: {bin_name: 'node', version_cmd: 'node --version'}
|
|
||||||
npm: {bin_name: 'npm', version_cmd: 'npm --version'}
|
|
||||||
when: BINARIES.npm is not defined
|
|
||||||
|
|
||||||
- name: "Install node, npm, and npx"
|
|
||||||
hosts: localhost
|
|
||||||
gather_facts: no
|
|
||||||
vars:
|
|
||||||
DATA_DIR: '/Volumes/NVME/Users/squash/Code/archiveboxes/archivebox7/data4'
|
|
||||||
LIB_DIR: '{{DATA_DIR}}/lib'
|
|
||||||
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: '20.0.0'
|
|
||||||
MIN_NPM_VERSION: '10.0.0'
|
|
||||||
state: 'present'
|
|
||||||
install_npm: {}
|
|
||||||
tasks:
|
|
||||||
# - package: update_cache=yes
|
|
||||||
# when: ansible_facts['os_family'] == "Debian"
|
|
||||||
|
|
||||||
- name: Make sure lib folders exist
|
|
||||||
file:
|
|
||||||
path: '{{item}}'
|
|
||||||
state: directory
|
|
||||||
recurse: true
|
|
||||||
loop:
|
|
||||||
- '{{LIB_DIR_NPM_BIN}}'
|
|
||||||
- '{{LIB_DIR_BIN}}'
|
|
||||||
when: BINPROVIDERS.npm is not defined
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
|
|
||||||
- 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, '>=')
|
|
||||||
quiet: true
|
|
||||||
when: BINPROVIDERS.npm is not defined
|
|
||||||
|
|
||||||
- name: "Install npm packages: {{install_npm}}"
|
|
||||||
community.general.npm:
|
|
||||||
name: '{{item}}'
|
|
||||||
state: "{{state}}"
|
|
||||||
path: '{{LIB_DIR_NPM}}'
|
|
||||||
loop: "{{install_npm|dictsort|map(attribute='1')|map(attribute='packages')|flatten}}"
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
- set_fact:
|
|
||||||
NODE_BINPROVIDERS:
|
|
||||||
npm:
|
|
||||||
installer_abspath: "{{BINARIES.npm.abspath}}"
|
|
||||||
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:
|
|
||||||
msg: "{{ {'BINARIES': BINARIES, 'BINPROVIDERS': BINPROVIDERS} }}"
|
|
|
@ -1,70 +0,0 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
|
||||||
---
|
|
||||||
- name: "Install using apt/brew/pkg/yum/etc."
|
|
||||||
hosts: localhost
|
|
||||||
gather_facts: no
|
|
||||||
vars:
|
|
||||||
DATA_DIR: '/Volumes/NVME/Users/squash/Code/archiveboxes/archivebox7/data4'
|
|
||||||
LIB_DIR: '{{DATA_DIR}}/lib'
|
|
||||||
LIB_DIR_BIN: '{{LIB_DIR}}/bin'
|
|
||||||
state: 'present'
|
|
||||||
install_packages: {}
|
|
||||||
# bash:
|
|
||||||
# packages: ['bash']
|
|
||||||
PACKAGE_BINPROVIDERS: {}
|
|
||||||
PACKAGE_BINARIES: {}
|
|
||||||
BINPROVIDERS: {}
|
|
||||||
tasks:
|
|
||||||
# - package: update_cache=yes
|
|
||||||
# when: ansible_facts['os_family'] == "Debian"
|
|
||||||
|
|
||||||
- name: Make sure lib folders exist
|
|
||||||
file:
|
|
||||||
path: '{{LIB_DIR_BIN}}'
|
|
||||||
state: directory
|
|
||||||
recurse: true
|
|
||||||
when: BINPROVIDERS.ansible_package is not defined
|
|
||||||
|
|
||||||
- name: Get ansible binary abspath
|
|
||||||
command: 'which ansible'
|
|
||||||
register: ANSIBLE_INSTALLER_ABSPATH_FULL
|
|
||||||
changed_when: false
|
|
||||||
when: BINPROVIDERS.ansible_package is not defined
|
|
||||||
|
|
||||||
- name: Calculate flat list of all packages to install
|
|
||||||
set_fact:
|
|
||||||
all_packages: "{{install_packages|dictsort|map(attribute='1')|map(attribute='packages')|flatten|unique}}"
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
- name: "Install system packages: {{all_packages}}"
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: "{{item}}"
|
|
||||||
state: "{{state}}"
|
|
||||||
loop: "{{all_packages}}"
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
PACKAGE_BINPROVIDERS:
|
|
||||||
ansible_package:
|
|
||||||
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:
|
|
||||||
msg: "{{ {'BINPROVIDERS': BINPROVIDERS} }}"
|
|
||||||
|
|
||||||
|
|
||||||
- import_playbook: load_binaries.yml
|
|
||||||
vars:
|
|
||||||
load_binaries:
|
|
||||||
bash:
|
|
||||||
when: BINARIES.bash is not defined
|
|
|
@ -1,75 +0,0 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
|
||||||
---
|
|
||||||
|
|
||||||
- import_playbook: load_binaries.yml
|
|
||||||
vars:
|
|
||||||
load_binaries:
|
|
||||||
python: {bin_name: 'python3', version_cmd: 'python3 --version'}
|
|
||||||
pip: {bin_name: 'pip3', version_cmd: 'pip3 --version'}
|
|
||||||
|
|
||||||
- name: "Install python, pip, and pipx"
|
|
||||||
hosts: localhost
|
|
||||||
gather_facts: no
|
|
||||||
vars:
|
|
||||||
DATA_DIR: '/Volumes/NVME/Users/squash/Code/archiveboxes/archivebox7/data4'
|
|
||||||
LIB_DIR: '{{DATA_DIR}}/lib'
|
|
||||||
LIB_DIR_BIN: '{{LIB_DIR}}/bin'
|
|
||||||
LIB_DIR_PIP: '{{LIB_DIR}}/pip'
|
|
||||||
LIB_DIR_PIP_BIN: '{{LIB_DIR_PIP}}/venv/bin'
|
|
||||||
MIN_PYTHON_VERSION: '3.11.9'
|
|
||||||
MIN_PIP_VERSION: '24.2'
|
|
||||||
state: 'present'
|
|
||||||
install_pip:
|
|
||||||
pip:
|
|
||||||
bin_name: 'pip'
|
|
||||||
packages: ['pip', 'setuptools']
|
|
||||||
# ytdlp:
|
|
||||||
# bin_name: 'yt-dlp'
|
|
||||||
# packages: ['yt-dlp']
|
|
||||||
tasks:
|
|
||||||
|
|
||||||
- name: Make sure lib folders exist
|
|
||||||
file:
|
|
||||||
path: '{{item}}'
|
|
||||||
state: directory
|
|
||||||
recurse: true
|
|
||||||
loop:
|
|
||||||
- '{{LIB_DIR_PIP}}'
|
|
||||||
- '{{LIB_DIR_BIN}}'
|
|
||||||
when: BINPROVIDERS.pip is not defined
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- BINARIES.python.version is version(MIN_PYTHON_VERSION, '>=')
|
|
||||||
- BINARIES.pip.version is version(MIN_PIP_VERSION, '>=')
|
|
||||||
quiet: true
|
|
||||||
when: BINPROVIDERS.pip is not defined
|
|
||||||
|
|
||||||
- name: "Install pip packages: {{install_pip}}"
|
|
||||||
ansible.builtin.pip:
|
|
||||||
name: '{{item}}'
|
|
||||||
state: "{{state}}"
|
|
||||||
virtualenv: '{{LIB_DIR_PIP}}/venv'
|
|
||||||
virtualenv_python: "{{BINARIES.python.abspath}}"
|
|
||||||
virtualenv_site_packages: yes
|
|
||||||
loop: "{{install_pip|dictsort|map(attribute='1')|map(attribute='packages')|flatten}}"
|
|
||||||
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
- set_fact:
|
|
||||||
PIP_BINPROVIDERS:
|
|
||||||
pip:
|
|
||||||
installer_abspath: "{{BINARIES.pip.abspath}}"
|
|
||||||
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:
|
|
||||||
msg: "{{ {'BINARIES': BINARIES, 'BINPROVIDERS': BINPROVIDERS} }}"
|
|
|
@ -1,112 +0,0 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
|
||||||
---
|
|
||||||
- name: "Install puppeteer, puppeteer/browsers, and chrome"
|
|
||||||
hosts: localhost
|
|
||||||
gather_facts: no
|
|
||||||
vars:
|
|
||||||
DATA_DIR: '{{playbook_dir}}'
|
|
||||||
LIB_DIR: '{{DATA_DIR}}/lib'
|
|
||||||
LIB_DIR_BROWSERS: '{{LIB_DIR}}/browsers'
|
|
||||||
CHROME_RELEASE_CHANNEL: 'chrome@stable'
|
|
||||||
CHROME_VERSION_MIN: '128.0.6613.137'
|
|
||||||
tasks:
|
|
||||||
- include_role:
|
|
||||||
name: setup_lib_npm
|
|
||||||
vars:
|
|
||||||
MIN_NODE_VERSION: '20.0.0'
|
|
||||||
MIN_NPM_VERSION: '10.0.0'
|
|
||||||
|
|
||||||
- name: "Install npm packages: [puppeteer, @puppeteer/browsers]"
|
|
||||||
community.general.npm:
|
|
||||||
name: '{{item}}'
|
|
||||||
state: "present"
|
|
||||||
path: '{{BINPROVIDERS.npm.root_path}}'
|
|
||||||
loop:
|
|
||||||
- 'puppeteer'
|
|
||||||
- '@puppeteer/browsers'
|
|
||||||
|
|
||||||
- name: Make sure prerequisite folders exist
|
|
||||||
file:
|
|
||||||
path: '{{LIB_DIR_BROWSERS}}'
|
|
||||||
state: directory
|
|
||||||
recurse: true
|
|
||||||
|
|
||||||
- name: Load puppeteer binary from installed NPM package
|
|
||||||
include_role:
|
|
||||||
name: load_binaries
|
|
||||||
vars:
|
|
||||||
load_binaries:
|
|
||||||
- name: puppeteer
|
|
||||||
bin_name: 'puppeteer'
|
|
||||||
version_cmd: 'puppeteer --version'
|
|
||||||
PATH: '{{BINPROVIDERS.npm.PATH}}'
|
|
||||||
|
|
||||||
- name: Load chrome binary from environment PATH
|
|
||||||
include_role:
|
|
||||||
name: load_binaries
|
|
||||||
vars:
|
|
||||||
load_binaries:
|
|
||||||
- name: 'chrome'
|
|
||||||
bin_name: '{{item}}'
|
|
||||||
PATH: '{{ansible_env.PATH}}'
|
|
||||||
loop:
|
|
||||||
- chrome
|
|
||||||
- chrome-browser
|
|
||||||
- chromium
|
|
||||||
- chromium-browser
|
|
||||||
- google-chrome
|
|
||||||
- google-chrome-browser
|
|
||||||
- google-chrome-stable
|
|
||||||
- google-chrome-beta
|
|
||||||
- google-chrome-canary
|
|
||||||
- google-chrome-unstable
|
|
||||||
- google-chrome-dev
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
- name: Install Chrome browser using puppeteer/browsers
|
|
||||||
command: 'npx @puppeteer/browsers install {{CHROME_RELEASE_CHANNEL}} --path {{LIB_DIR_BROWSERS}}'
|
|
||||||
register: CHROME_VERSION_FULL
|
|
||||||
environment:
|
|
||||||
PATH: "{{BINPROVIDERS.npm.PATH}}:{{ ansible_env.PATH }}"
|
|
||||||
changed_when: CHROME_VERSION_MIN not in CHROME_VERSION_FULL.stdout
|
|
||||||
when: BINARIES.chrome is not defined
|
|
||||||
# -> 'chrome@128.0.6613.137 /data/lib/browsers/chrome/linux_arm-128.0.6613.138/chrome-linux-arm64/...'
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
- set_fact:
|
|
||||||
CHROME_ABSPATH: "{{ CHROME_VERSION_FULL.stdout_lines|last|split(' ', 1)|last }}"
|
|
||||||
CHROME_VERSION: "{{ CHROME_VERSION_FULL.stdout_lines|last|split('@', 1)|last|split(' ', 1)|first }}"
|
|
||||||
when: BINARIES.chrome is not defined
|
|
||||||
|
|
||||||
- name: Create ./bin/chrome symlink to ./browsers/chrome/... binary
|
|
||||||
copy:
|
|
||||||
content: |
|
|
||||||
#!/bin/bash
|
|
||||||
exec '{{CHROME_ABSPATH|default(BINARIES.chrome.abspath)}}' "$@"
|
|
||||||
dest: "{{LIB_DIR_BIN}}/chrome"
|
|
||||||
- file:
|
|
||||||
path: "{{LIB_DIR_BIN}}/chrome"
|
|
||||||
mode: u+rx,g-rx,o-rwx
|
|
||||||
state: 'file'
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
- set_fact:
|
|
||||||
PUPPETEER_BINARIES:
|
|
||||||
chrome:
|
|
||||||
bin_name: 'chrome'
|
|
||||||
abspath: "{{CHROME_ABSPATH|default(BINARIES.chrome.abspath)}}"
|
|
||||||
version: "{{CHROME_VERSION|default(BINARIES.chrome.version)}}"
|
|
||||||
symlink: "{{LIB_DIR_BIN}}/chrome"
|
|
||||||
version_cmd: "chrome --version"
|
|
||||||
|
|
||||||
- name: Check that installed Chrome matches expected version
|
|
||||||
assert:
|
|
||||||
that: PUPPETEER_BINARIES.chrome.version is version(CHROME_VERSION_MIN, '>=')
|
|
||||||
quiet: true
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
BINARIES: "{{ BINARIES | combine(PUPPETEER_BINARIES) }}"
|
|
||||||
cacheable: true
|
|
||||||
|
|
||||||
- debug:
|
|
||||||
msg: "{{ {'BINARIES': BINARIES, 'BINPROVIDERS': BINPROVIDERS} }}"
|
|
|
@ -1,40 +0,0 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
|
||||||
---
|
|
||||||
|
|
||||||
- import_playbook: ../puppeteer/install_puppeteer.yml
|
|
||||||
when: BINARIES.chrome is not defined
|
|
||||||
|
|
||||||
- name: "Install Singlefile"
|
|
||||||
hosts: localhost
|
|
||||||
gather_facts: no
|
|
||||||
vars:
|
|
||||||
SINGLEFILE_VERSION_EXACT: '1.1.54'
|
|
||||||
tasks:
|
|
||||||
- include_role:
|
|
||||||
name: setup_lib_npm
|
|
||||||
vars:
|
|
||||||
MIN_NODE_VERSION: '20.0.0'
|
|
||||||
MIN_NPM_VERSION: '10.0.0'
|
|
||||||
|
|
||||||
- name: "Install npm packages: [single-file-cli]"
|
|
||||||
community.general.npm:
|
|
||||||
name: 'single-file-cli@1.1.54'
|
|
||||||
state: "present"
|
|
||||||
path: '{{BINPROVIDERS.npm.root_path}}'
|
|
||||||
|
|
||||||
- name: Load single-file binary from installed NPM package
|
|
||||||
include_role:
|
|
||||||
name: load_binary
|
|
||||||
vars:
|
|
||||||
name: singlefile
|
|
||||||
bin_name: 'single-file'
|
|
||||||
version_cmd: 'single-file --version'
|
|
||||||
PATH: '{{BINPROVIDERS.npm.PATH}}'
|
|
||||||
|
|
||||||
- name: Check that installed Singlefile version matches expected version
|
|
||||||
assert:
|
|
||||||
that: SINGLEFILE_VERSION_EXACT is version(BINARIES.singlefile.version, '==')
|
|
||||||
quiet: true
|
|
||||||
|
|
||||||
- debug:
|
|
||||||
msg: "{{ {'BINARIES': BINARIES, 'BINPROVIDERS': BINPROVIDERS} }}"
|
|
|
@ -1,49 +0,0 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
|
||||||
---
|
|
||||||
- name: "Install YT-DLP"
|
|
||||||
hosts: localhost
|
|
||||||
gather_facts: no
|
|
||||||
vars:
|
|
||||||
YTDLP_VERSION_MIN: '2024.8.6'
|
|
||||||
tasks:
|
|
||||||
- include_role:
|
|
||||||
name: setup_lib_pip
|
|
||||||
vars:
|
|
||||||
MIN_PYTHON_VERSION: '3.10.0'
|
|
||||||
MIN_PIP_VERSION: '22.0'
|
|
||||||
|
|
||||||
- name: "Install pip packages: {{install_pip}}"
|
|
||||||
ansible.builtin.pip:
|
|
||||||
name: 'yt-dlp'
|
|
||||||
state: "present"
|
|
||||||
virtualenv: '{{LIB_DIR_PIP}}/venv'
|
|
||||||
virtualenv_python: "{{BINARIES.python.abspath}}"
|
|
||||||
virtualenv_site_packages: yes
|
|
||||||
|
|
||||||
- name: Check that installed YT-DLP matches expected version
|
|
||||||
assert:
|
|
||||||
that: BINARIES.ytdlp.version is version(YTDLP_VERSION_MIN, '>=')
|
|
||||||
quiet: true
|
|
||||||
|
|
||||||
- debug:
|
|
||||||
msg: "{{ {'BINARIES': BINARIES, 'BINPROVIDERS': BINPROVIDERS} }}"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# - import_playbook: install_package.yml
|
|
||||||
# vars:
|
|
||||||
# install_packages:
|
|
||||||
# ffmpeg: {packages: ['ffmpeg']}
|
|
||||||
# state: 'present'
|
|
||||||
|
|
||||||
# - import_playbook: install_pip.yml
|
|
||||||
# vars:
|
|
||||||
# install_pip:
|
|
||||||
# ytdlp: {packages: ['yt-dlp']}
|
|
||||||
# state: 'present'
|
|
||||||
|
|
||||||
# - import_playbook: load_binaries.yml
|
|
||||||
# vars:
|
|
||||||
# load_binaries:
|
|
||||||
# ffmpeg: {bin_name: 'ffmpeg', version_cmd: 'ffmpeg -version'}
|
|
||||||
# ytdlp: {bin_name: 'yt-dlp', version_cmd: 'yt-dlp --version'}
|
|
|
@ -1,90 +0,0 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
|
||||||
---
|
|
||||||
- name: Get binary abspaths and versions and add to BINARIES
|
|
||||||
hosts: localhost
|
|
||||||
gather_facts: false
|
|
||||||
vars:
|
|
||||||
DATA_DIR: '/Volumes/NVME/Users/squash/Code/archiveboxes/archivebox7/data4'
|
|
||||||
LIB_DIR: '{{DATA_DIR}}/lib'
|
|
||||||
LIB_DIR_BIN: '{{LIB_DIR}}/bin'
|
|
||||||
DEFAULT_PATH: '/bin'
|
|
||||||
load_binaries:
|
|
||||||
bash:
|
|
||||||
bin_name: bash
|
|
||||||
version_cmd: 'bash --version'
|
|
||||||
# ffmpeg:
|
|
||||||
# version_cmd: 'ffmpeg -version'
|
|
||||||
# PATH: '/opt/homebrew/bin:/usr/local/bin'
|
|
||||||
# ytdlp:
|
|
||||||
# bin_name: ytdlp
|
|
||||||
# curl:
|
|
||||||
# wget:
|
|
||||||
# bin_name: wget
|
|
||||||
# version_cmd: 'wget --version']
|
|
||||||
tasks:
|
|
||||||
- name: Make sure lib folders exist
|
|
||||||
file:
|
|
||||||
path: '{{LIB_DIR_BIN}}'
|
|
||||||
state: directory
|
|
||||||
recurse: true
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
- name: Get installed binary abspath
|
|
||||||
command: 'env PATH="{{item.1.PATH|default(DEFAULT_PATH)}}:$PATH" which {{item.1.bin_name|default(item.0)}}'
|
|
||||||
register: ABSPATHS_FULL
|
|
||||||
changed_when: false
|
|
||||||
ignore_errors: true
|
|
||||||
loop: "{{load_binaries|dictsort}}"
|
|
||||||
|
|
||||||
- name: Get installed binary version
|
|
||||||
command: 'env PATH="{{item.1.PATH|default(DEFAULT_PATH)}}:$PATH" {{item.1.version_cmd|default((item.1.bin_name|default(item.0)) + " --version")}}'
|
|
||||||
register: VERSIONS_FULL
|
|
||||||
changed_when: false
|
|
||||||
ignore_errors: true
|
|
||||||
loop: "{{load_binaries|dictsort}}"
|
|
||||||
|
|
||||||
- name: Symlink installed binary into lib bin folder
|
|
||||||
file:
|
|
||||||
src: "{{ item }}"
|
|
||||||
dest: "{{ LIB_DIR_BIN }}/{{ item|basename }}"
|
|
||||||
state: link
|
|
||||||
loop: "{{ABSPATHS_FULL.results|map(attribute='stdout_lines')|map('first')}}"
|
|
||||||
|
|
||||||
- name: Collecting abspath results
|
|
||||||
set_fact:
|
|
||||||
BINARY_ABSPATHS: "{{ BINARY_ABSPATHS | default({}) | combine({item.0: item.1}) }}"
|
|
||||||
loop: "{{ keys | zip(values) }}"
|
|
||||||
vars:
|
|
||||||
keys: "{{load_binaries|dictsort|map(attribute='0')}}"
|
|
||||||
values: "{{ABSPATHS_FULL.results|map(attribute='stdout_lines')|map('first')}}"
|
|
||||||
|
|
||||||
- name: Collecting version results
|
|
||||||
set_fact:
|
|
||||||
BINARY_VERSIONS: "{{ BINARY_VERSIONS | default({}) | combine({item.0: item.1}) }}"
|
|
||||||
loop: "{{ keys | zip(values) }}"
|
|
||||||
vars:
|
|
||||||
keys: "{{load_binaries|dictsort|map(attribute='0')}}"
|
|
||||||
values: "{{VERSIONS_FULL.results|map(attribute='stdout_lines')|map('first')|map('regex_replace', '^.*?v?([\\d\\.]+).*$', '\\1')}}"
|
|
||||||
|
|
||||||
- name: Updating BINARIES with loaded abspaths & versions
|
|
||||||
set_fact:
|
|
||||||
BINARIES: "{{
|
|
||||||
BINARIES
|
|
||||||
| default({})
|
|
||||||
| combine({
|
|
||||||
item: load_binaries[item]|combine({
|
|
||||||
'bin_name': BINARY_ABSPATHS[item]|basename,
|
|
||||||
'abspath': BINARY_ABSPATHS[item],
|
|
||||||
'version': BINARY_VERSIONS[item],
|
|
||||||
'symlink': LIB_DIR_BIN + '/' + BINARY_ABSPATHS[item]|basename,
|
|
||||||
'version_cmd': load_binaries[item]['version_cmd']|default(item + ' --version'),
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
}}"
|
|
||||||
cacheable: true
|
|
||||||
loop: "{{load_binaries|dictsort|map(attribute='0')}}"
|
|
||||||
|
|
||||||
###################################################################################
|
|
||||||
|
|
||||||
- debug:
|
|
||||||
msg: "{{ {'BINARIES': BINARIES} }}"
|
|
Loading…
Reference in a new issue