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

Ansible8 fix #8

Merged
merged 4 commits into from
Oct 31, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
---
galaxy_info:
#role_name: mellanox_switch
# role_name: mellanox_switch
# namespace: stackhpc
author: Mark Goddard
description: >
Role to configure Mellanox switches runnning MLNX-OS
company: StackHPC Ltd
license: Apache2
min_ansible_version: 2.0
min_ansible_version: "2.0"
platforms:
- name: EL
versions:
- 7
- all
galaxy_tags:
- networking
- mellanox
- switch
- MLNX-OS
- mlnxos
17 changes: 7 additions & 10 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
# Need to use pip since the CentOS provided package is too old for Ansible.
- name: Ensure the pexpect Python package is installed
local_action:
module: pip
delegate_to: localhost
ansible.builtin.pip:
name: pexpect
state: present
become: true

- name: Ensure global switch configuration is applied
local_action:
module: expect
delegate_to: localhost
ansible.builtin.expect:
command: "ssh {{ ansible_ssh_common_args | default }} {{ mellanox_switch_provider.username }}@{{ mellanox_switch_provider.host }}"
responses: >-
{{ mellanox_auth_responses |
Expand All @@ -27,8 +27,8 @@
config_responses: "{{ {mellanox_config_prompt: mellanox_switch_config + ['exit']} }}"

- name: Ensure switch interface configuration is applied
local_action:
module: expect
delegate_to: localhost
ansible.builtin.expect:
command: "ssh {{ ansible_ssh_common_args | default }} {{ mellanox_switch_provider.username }}@{{ mellanox_switch_provider.host }}"
responses: >-
{{ mellanox_auth_responses |
Expand All @@ -53,7 +53,4 @@
item.value.config | default([]) +
['exit', 'exit']} }}
loop_control:
label:
interface: "{{ item.key }}"
description: "{{ item.value.description | default('<none>') }}"
config: "{{ item.value.config | default([]) }}"
label: "{interface: '{{ item.key }}', description: '{{ item.value.description | default('<none>') }}', config: '{{ item.value.config | default([]) }}'}"