mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-19 17:35:09 -04:00
consolidate ansible setup into roles dir
This commit is contained in:
parent
25db6826ec
commit
c55cd46ecb
27 changed files with 763 additions and 91 deletions
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
argument_specs:
|
||||
main:
|
||||
short_description: Main entry point for the npm role
|
||||
|
||||
options:
|
||||
|
||||
state:
|
||||
type: "str"
|
||||
required: false
|
||||
default: 'present'
|
||||
description:
|
||||
- "The desired state: present | latest"
|
||||
|
||||
npm_packages:
|
||||
type: "list"
|
||||
elements: "dict"
|
||||
required: false
|
||||
default: []
|
||||
description: "A list of dicts with a defined structure and with default a value."
|
||||
options:
|
||||
key:
|
||||
type: "str"
|
||||
required: true
|
||||
description: "A string name for the dependency"
|
||||
|
||||
packages:
|
||||
type: "list"
|
||||
elements: "str"
|
||||
required: true
|
||||
description: "What npm packages to install for the given dependency."
|
59
archivebox/builtin_plugins/ansible/roles/setup_lib_pip/tasks/main.yml
Executable file
59
archivebox/builtin_plugins/ansible/roles/setup_lib_pip/tasks/main.yml
Executable file
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
- 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
|
||||
|
||||
- name: Load Python and Pip binaries
|
||||
import_role:
|
||||
name: load_binary
|
||||
vars:
|
||||
name: '{{item}}'
|
||||
loop:
|
||||
- python
|
||||
- pip
|
||||
when: BINARIES.python is not defined or BINARIES.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}}"
|
||||
virtualenv: "{{LIB_DIR_PIP}}/venv"
|
||||
virtualenv_python: "{{BINARIES.python.abspath}}"
|
||||
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} }}"
|
|
@ -0,0 +1,7 @@
|
|||
DATA_DIR: '{{playbook_dir}}'
|
||||
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.10.0'
|
||||
MIN_PIP_VERSION: '22.0'
|
Loading…
Add table
Add a link
Reference in a new issue