Closed ghost closed 6 years ago
Just replied on the other issue as well - can you share the playbook you're using and version of UCSM (or UCSPE) being tested?
Playbook below. I'm using Cisco UCS Platform Emulator version 3.1(2ePE1). My production UCS managers do have an option for "Redundancy Type", so the module would most likely work, although I need to test all playbooks in the lab before I can move them into production.
---
- name: UCS VLANs
hosts: lab-tor-ucs
tasks:
- name: Configure VLANs
ucs_vlans:
hostname: 10.71.254.250
username: ucspe
password: ucspe
state: "{{ item.state }}"
name: "{{ item.name }}"
id: "{{ item.id }}"
with_items: "{{ vlans }}"
- name: Add VLAN to Fabric A vNIC Template
ucs_vnic_template:
hostname: 10.71.254.250
username: ucspe
password: ucspe
name: Fabric-A
fabric: A
mtu: 9000
target: adapter
template_type: updating-template
#redundancy_type: none
vlans_list:
- name: "{{ item.name }}"
with_items: "{{ vlans }}"
- name: Add VLAN to Fabric B vNIC Template
ucs_vnic_template:
hostname: 10.71.254.250
username: ucspe
password: ucspe
name: Fabric-B
fabric: B
mtu: 9000
target: adapter
template_type: updating-template
#redundancy_type: none
vlans_list:
- name: "{{ item.name }}"
with_items: "{{ vlans }}"
Vlans located in group_vars/lab-tor-ucs
---
vlans:
- id: 10
name: WEB
state: present
- id: 20
name: APP
state: present
- id: 30
name: SQL
state: present
- id: 100
name: TEST
state: present
Can you send ansible --version and verbose output (-vvv)? Redundancy templates look ok to me with UCSPE 3.1(2e) And the CiscoUcs.ucs Ansible role (available on Ansible Galaxy) is successfully configuring VNIC templates in UCSPE 3.1(2e). Here's verbose output: ansible-playbook 2.5.1 config file = /Users/dsoper/.ansible.cfg configured module search path = ['/Users/dsoper/Documents/ucsm-ansible-1/library', '/Users/dsoper/Documents/intersight-ansible', '/Users/dsoper/Documents/imc-ansible'] ansible python module location = /usr/local/lib/python3.6/site-packages/ansible executable location = /usr/local/bin/ansible-playbook python version = 3.6.5 (default, Apr 20 2018, 18:22:17) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] Using /Users/dsoper/.ansible.cfg as config file Parsed /Users/dsoper/Documents/ucsm-ansible-1/inventories/ucspe inventory source with ini plugin
PLAYBOOK: cvd_roles.yml **** 1 plays in playbooks/cvd_roles.yml
PLAY [ucspe_remote] **** META: ran handlers
TASK [Set ucs_hostname] **** task path: /Users/dsoper/Documents/ucsm-ansible-1/playbooks/cvd_roles.yml:17 skipping: [ucspe_3_1_2e:] => { "changed": false, "skip_reason": "Conditional result was False" }
TASK [include_role] **** task path: /Users/dsoper/Documents/ucsm-ansible-1/playbooks/cvd_roles.yml:21
TASK [CiscoUcs.ucs/lan/vnic_templates : Configure vNIC Templates] ** task path: /Users/dsoper/.ansible/roles/CiscoUcs.ucs/lan/vnic_templates/tasks/main.yml:13 Using module file /Users/dsoper/Documents/ucsm-ansible-1/library/ucs_vnic_template.py
One correction, I'm using UCS Platform Emulator version 3.1(1e), as I'm not able to get 3.1(2ePE1) talking on port 80/443.
Below is the playbook output. If I remove all references to redundancy_type in the module code the playbook works fine.
ansible-playbook 2.5.4
config file = /localservices/ansible/ansible.cfg
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2]
Using /localservices/ansible/ansible.cfg as config file
Parsed /localservices/ansible/inventory/lab inventory source with ini plugin
PLAYBOOK: lab-ucs-vlan-ucspe2.yml *** 1 plays in lab-ucs-vlan-ucspe2.yml
PLAY [UCS VLANs] **** META: ran handlers
TASK [Add VLAN to Fabric A vNIC Template] *** task path: /localservices/ansible/lab-ucs-vlan-ucspe2.yml:17 Using module file /usr/lib/python2.7/dist-packages/ansible/modules/remote_management/ucs/ucs_vnic_template.py <10.71.254.250> ESTABLISH LOCAL CONNECTION FOR USER: minimalz <10.71.254.250> EXEC /bin/sh -c '/usr/bin/python && sleep 0' The full traceback is: File "/tmp/ansible_TMWRg3/ansible_module_ucs_vnic_template.py", line 331, in main ucs.login_handle.commit() File "/usr/local/lib/python2.7/dist-packages/ucsmsdk/ucshandle.py", line 939, in commit response = self.post_elem(elem, timeout=timeout) File "/usr/local/lib/python2.7/dist-packages/ucsmsdk/ucssession.py", line 318, in post_elem response = xc.from_xml_str(response_str, self) File "/usr/local/lib/python2.7/dist-packages/ucsmsdk/ucsxmlcodec.py", line 94, in from_xml_str raise ex.UcsException(error_code, error_descr)
fatal: [lab-ucs]: FAILED! => changed=false invocation: module_args: cdn_name: '' cdn_source: vnic-name description: '' fabric: A hostname: 10.71.254.250 mac_pool: '' mtu: '9000' name: Fabric-A network_control_policy: '' org_dn: org-root password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER peer_redundancy_template: '' pin_group: '' port: null proxy: null qos_policy: '' redundancy_type: none state: present stats_policy: default target: adaptor template_type: updating-template use_proxy: true use_ssl: true username: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER vlans_list:
PLAY RECAP ** lab-ucs : ok=0 changed=0 unreachable=0 failed=1
We were able deploy a working 3.1(2ePE1) emulator at another site. This version does have a Redundancy Type option in the vNIC configuration, therefore the playbook works fine. Version 3.1(1e) of the emulator omits the Redundancy Type (https://imgur.com/hDGcd1F) therefore the playbook was failing whether the parameter was defined or not. We'll stop using 3.1(1e) in our labs.
The UCS platform emulator does not support configuring a "Redundancy Type". Screenshot linked below. The ucs_vnic_template module fails as a result. I've removed all references to redundancy type in the code for testing although is it possible to remove this option as mandatory, therefore the code wouldn't need to be modified in order for the module to work in a lab environment.
https://imgur.com/hDGcd1F