forked from openstack-k8s-operators/ci-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreproducer.yml
More file actions
155 lines (138 loc) · 5.73 KB
/
reproducer.yml
File metadata and controls
155 lines (138 loc) · 5.73 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
---
- name: Manage unique ID
ansible.builtin.import_playbook: playbooks/unique-id.yml
- name: Reproducer prepare play
hosts: "{{ cifmw_target_host | default('localhost') }}"
gather_facts: true
tasks:
- name: Run tasks - reproducer prepare
when:
- cifmw_deploy_reproducer_env | default(true) | bool
block:
- name: Inherit from parent scenarios if needed
ansible.builtin.include_tasks:
file: "ci/playbooks/tasks/inherit_parent_scenario.yml"
- name: Include common architecture parameter file
when:
- cifmw_architecture_scenario is defined
- cifmw_architecture_scenario | length > 0
ansible.builtin.include_vars:
file: "scenarios/reproducers/va-common.yml"
- name: Run reproducer validations
ansible.builtin.import_role:
name: reproducer
tasks_from: validations.yml
- name: Gather OS facts
ansible.builtin.setup:
gather_subset:
- "!all"
- "!min"
- "distribution"
- name: Tweak dnf configuration
become: true
community.general.ini_file:
no_extra_spaces: true
option: "{{ config.option }}"
path: "/etc/dnf/dnf.conf"
section: "{{ config.section | default('main') }}"
state: "{{ config.state | default(omit) }}"
value: "{{ config.value | default(omit) }}"
mode: "0644"
loop: "{{ cifmw_reproducer_dnf_tweaks }}"
loop_control:
label: "{{ config.option }}"
loop_var: 'config'
- name: Install custom CA if needed
ansible.builtin.import_role:
name: install_ca
- name: Setup repositories via rhos-release if needed
tags:
- packages
when:
- ansible_facts['distribution'] == 'RedHat'
- cifmw_reproducer_hp_rhos_release | bool
vars:
cifmw_repo_setup_output: /etc/yum.repos.d
cifmw_repo_setup_rhos_release_args: "rhel"
ansible.builtin.import_role:
name: repo_setup
tasks_from: rhos_release.yml
- name: Run ci_setup
ansible.builtin.import_role:
name: ci_setup
- name: Prepare switches
vars:
cifmw_configure_switches: "{{ 'switches' in groups }}"
ansible.builtin.import_playbook: playbooks/switches_config.yml
- name: Reproducer run
hosts: "{{ cifmw_target_host | default('localhost') }}"
gather_facts: false
tasks:
- name: Run reproducer role
when:
- cifmw_deploy_reproducer_env | default(true) | bool
ansible.builtin.import_role:
name: reproducer
- name: Finish playbook if prepare environment executed
when:
- cifmw_deploy_reproducer_env | default(false) | bool
ansible.builtin.meta: end_play
- name: Allow traffic from OSP VMs to OSP API (needed for shiftstack)
become: true
when: cifmw_allow_vms_to_reach_osp_api | default (false) | bool
block:
- name: Allow traffic from OSP VMs to OSP API for ipv4
ansible.builtin.command: # noqa: command-instead-of-module
cmd: iptables -I LIBVIRT_FWI 1 -o ocpbm -j ACCEPT
- name: Allow traffic from OSP VMs to OSP API for ipv6
ansible.builtin.lineinfile:
path: /etc/firewalld/firewalld.conf
regexp: '^IPv6_rpfilter='
line: 'IPv6_rpfilter=no'
- name: Restart firewalld.service
ansible.builtin.systemd_service:
name: firewalld
state: restarted
# NOTE(dpawlik): Synchronize current Zuul repositories stored in $HOME/src
# to controller-0 to make sure all projects are in state as they should.
- name: Synchronize src dir with controller-0
when:
- not cifmw_deploy_reproducer_env | default(true) | bool
vars:
sync_dir: "{{ ansible_user_dir }}/src"
ansible.posix.synchronize:
src: "{{ sync_dir }}/"
dest: "zuul@controller-0:{{ sync_dir }}"
archive: true
recursive: true
# NOTE(dpawlik): After calling reproducer role using ZIronic tool,
# when the bootstrap phase has been completed, it generates a file
# "reproducer-variables.yml" that contains all variables done in the
# CI job. The problem here is, that "testing" phase might have other
# variables than what was in the bootstrap phase. It means, that
# we need to overwrite the variables with current CI job vars.
- name: Overwrite reproducer-variables.yml when ZIronic bootstrap
when:
- not cifmw_deploy_reproducer_env | default(true) | bool
ansible.builtin.include_role:
name: reproducer
tasks_from: overwrite_zuul_vars.yml
- name: Run deployment if instructed to
when:
- cifmw_deploy_architecture | default(false) | bool
no_log: "{{ cifmw_nolog | default(true) | bool }}"
async: "{{ 7200 + cifmw_test_operator_timeout | default(3600) }}" # 2h should be enough to deploy EDPM and rest for tests.
poll: 20
delegate_to: controller-0
ansible.builtin.command:
cmd: "$HOME/deploy-architecture.sh {{ cifmw_deploy_architecture_args | default('') }}"
- name: Run post deployment if instructed to
when:
- cifmw_deploy_architecture | default(false) | bool
- cifmw_post_deployment | default(true) | bool
no_log: "{{ cifmw_nolog | default(true) | bool }}"
async: "{{ 7200 + cifmw_test_operator_timeout | default(3600) }}" # 2h should be enough to deploy EDPM and rest for tests.
poll: 20
delegate_to: controller-0
ansible.builtin.command:
cmd: "$HOME/post_deployment.sh {{ cifmw_post_deploy_args | default('') }}"