forked from redhat-cop/agnosticd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
workloads.yml
54 lines (50 loc) · 1.74 KB
/
workloads.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
- name: Step 003.3 Create a Python3 VirtualEnv for use in the k8s Ansible tasks
hosts: bastions
gather_facts: true
become: true
tasks:
- name: Setup k8s virtualenv (EL9)
when: ansible_distribution == "RedHat" and ansible_distribution_major_version == "9"
ansible.builtin.include_role:
name: host_virtualenv
vars:
host_virtualenv_path: /opt/virtualenvs/k8s
# Merge base k8s requirements with cloud provider specific requirements
host_virtualenv_requirements:
- requirements_k8s_el9.txt
- requirements_{{ cloud_provider }}_el9.txt
- name: Setup k8s virtualenv (EL8)
when: ansible_distribution != "RedHat" or ansible_distribution_major_version != "9"
ansible.builtin.include_role:
name: host_virtualenv
vars:
host_virtualenv_path: /opt/virtualenvs/k8s
# Merge base k8s requirements with cloud provider specific requirements
host_virtualenv_requirements:
- requirements_k8s.txt
- requirements_{{ cloud_provider }}.txt
# Workloads are being run on bastion.
# This enables using the k8s module in the workload.
# openshift python module is installed for Python3
- name: Install workloads
hosts: bastions
gather_facts: false
run_once: true
become: false
tasks:
- name: Set Ansible Python interpreter to k8s virtualenv
ansible.builtin.set_fact:
ansible_python_interpreter: /opt/virtualenvs/k8s/bin/python
- name: Install infra workloads
when: infra_workloads | default("") | length > 0
tags:
- infra_workloads
ansible.builtin.include_role:
name: "{{ workload_loop_var }}"
vars:
ocp_username: "system:admin"
ACTION: "provision"
loop: "{{ infra_workloads }}"
loop_control:
loop_var: workload_loop_var