forked from redhat-cop/agnosticd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
workloads.yml
59 lines (56 loc) · 1.79 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
55
56
57
58
59
---
# 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
set_fact:
ansible_python_interpreter: /opt/virtualenvs/k8s/bin/python
- name: Install ocp-infra workloads
when:
- infra_workloads | default("") | length > 0
tags:
- infra_workloads
block:
- name: Install ocp-infra-workloads
when:
- infra_workloads | default("") | length >0
block:
- name: Deploy ocp-infra workloads
include_role:
name: "{{ workload_loop_var }}"
vars:
ocp_username: "system:admin"
ACTION: "provision"
loop: "{{ infra_workloads }}"
loop_control:
loop_var: workload_loop_var
- name: Install ocp-student-workloads
when:
- user_count | default(0) | int > 0
- student_workloads | default("") | length > 0
tags:
- student_workloads
block:
- name: Check if authentication mechanism is set to htpasswd
when: install_idm | default("") != "htpasswd"
fail:
msg: Authentication Mechanism must be htpasswd
- name: Generate list of User IDs
set_fact:
users: "{{ lookup('sequence', 'start=1 end={{ user_count|int }}', wantlist=true) | map('int') | list }}"
- name: Deploy ocp-student-workloads for each user ID
include_role:
name: "{{ workload_loop_var[1] }}"
vars:
ocp_username: "user{{ workload_loop_var[0] }}"
become_override: true
ACTION: "provision"
loop: "{{ users | product(student_workloads) | list }}"
loop_control:
loop_var: workload_loop_var