55 lines
1.8 KiB
YAML
55 lines
1.8 KiB
YAML
---
|
|
- name: "STRESS-SETUP: Install Python Dependencies"
|
|
hosts: all
|
|
gather_facts: yes
|
|
vars_files:
|
|
- "group_vars/all/vault.yml"
|
|
pre_tasks:
|
|
- name: Set inventory_env fact
|
|
ansible.builtin.set_fact:
|
|
inventory_env: "{{ inventory_file | basename | splitext | first | replace('inventory.', '') }}"
|
|
- name: Load environment-specific variables
|
|
ansible.builtin.include_vars: "{{ item }}"
|
|
with_fileglob:
|
|
- "group_vars/all/generated_vars{{ '.' + inventory_env if inventory_env else '' }}.yml"
|
|
- name: Ensure python3-pip is installed
|
|
block:
|
|
- name: Install prerequisites for managing repositories
|
|
ansible.builtin.apt:
|
|
name: software-properties-common
|
|
state: present
|
|
update_cache: yes
|
|
|
|
- name: Ensure universe repository is enabled
|
|
ansible.builtin.apt_repository:
|
|
repo: "deb http://archive.ubuntu.com/ubuntu {{ ansible_lsb.codename }} universe"
|
|
state: present
|
|
update_cache: yes
|
|
|
|
- name: Install python3-pip
|
|
ansible.builtin.apt:
|
|
name: python3-pip
|
|
state: present
|
|
become: yes
|
|
|
|
tasks:
|
|
- name: Define base directory for node
|
|
ansible.builtin.set_fact:
|
|
base_dir: "{{ airflow_master_dir if inventory_hostname in groups['master'] else airflow_worker_dir }}"
|
|
|
|
- name: Install required Python packages from requirements.txt
|
|
ansible.builtin.pip:
|
|
requirements: "{{ base_dir }}/ytops_client/requirements.txt"
|
|
extra_args: "--ignore-installed"
|
|
become: yes
|
|
environment:
|
|
PIP_BREAK_SYSTEM_PACKAGES: "1"
|
|
|
|
- name: Explicitly install the thrift package
|
|
ansible.builtin.pip:
|
|
name: thrift
|
|
extra_args: "--ignore-installed"
|
|
become: yes
|
|
environment:
|
|
PIP_BREAK_SYSTEM_PACKAGES: "1"
|