Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[reproducer] Call switches config if available #2175

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/usage/01_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ are shared among multiple roles:
- `cifmw_openshift_ingress_ip_address` (String) contains the OpenShift Ingress IP address. Note: it is computed internally and should not be user defined.
- `cifmw_nolog`: (Bool) Toggle `no_log` value for selected tasks. Defaults to `true` (hiding those logs by default).
- `cifmw_parent_scenario`: (String or List(String)) path to existing scenario/parameter file to inherit from.
- `cifmw_configure_switches`: (Bool) Specifies whether switches should be configured. Computes in `reproducer.yml` playbook. Defaults to `false`.

```{admonition} Words of caution
:class: danger
Expand Down
30 changes: 30 additions & 0 deletions playbooks/switches_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
- name: Switches configuration requirements
hosts: "{{ cifmw_target_host | default('localhost') }}"
gather_facts: false
pre_tasks:
# end_play will end this current playbook and go the the next
# imported play.
- name: Early playbook stop
when:
- not cifmw_configure_switches | default(true)
pablintino marked this conversation as resolved.
Show resolved Hide resolved
ansible.builtin.meta: end_play
tasks:
- name: Install required packages
delegate_to: localhost
ansible.builtin.pip:
name:
- paramiko
- ncclient
extra_args: --user

- name: Switches configuration
pablintino marked this conversation as resolved.
Show resolved Hide resolved
hosts: switches
gather_facts: false
pre_tasks:
- name: Early playbook stop
when:
- not cifmw_configure_switches | default(true)
ansible.builtin.meta: end_play
roles:
- switch_config
15 changes: 11 additions & 4 deletions reproducer.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---

- name: Reproducer Play
- name: Reproducer prepare play
hosts: "{{ cifmw_target_host | default('localhost') }}"
gather_facts: true
pre_tasks:
Expand Down Expand Up @@ -57,11 +56,19 @@
ansible.builtin.import_role:
name: repo_setup
tasks_from: rhos_release.yml

roles:
- role: ci_setup
- role: reproducer

- name: Prepare switches
vars:
cifmw_configure_switches: "{{ 'switches' in groups }}"
ansible.builtin.import_playbook: playbooks/switches_config.yml
cjeanner marked this conversation as resolved.
Show resolved Hide resolved

- name: Reproducer run
hosts: "{{ cifmw_target_host | default('localhost') }}"
gather_facts: false
roles:
- role: reproducer
post_tasks:
- name: Allow traffic from OSP VMs to OSP API (needed for shiftstack)
become: true
Expand Down
1 change: 1 addition & 0 deletions roles/ci_setup/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ cifmw_ci_setup_packages:
- bash-completion
- make
- tmux
- python3-pip

# openshift client
cifmw_ci_setup_openshift_client_download_uri: "https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp"
Expand Down
1 change: 1 addition & 0 deletions roles/ci_setup/vars/redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cifmw_ci_setup_packages:
- make
- tar
- tmux
- python3-pip

cifmw_ci_setup_rhel_rhsm_default_repos:
- 'rhel-*-baseos-rpms'
Expand Down
3 changes: 2 additions & 1 deletion roles/switch_config/tasks/junos_config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---

# Workaround since Ansible modules lock the database similar to `configure exclusive`
- name: "Random Duraion Pause"
- name: "Random duration pause"
delegate_to: localhost
ansible.builtin.pause:
seconds: "{{ 90 | random(step=6) }}"

Expand Down