Skip to content

error handling for a ucs_vnic_template module playbook #132

@vivekanand552

Description

@vivekanand552

Hello All,

I am currently trying to automate my ucs environment using ucs modules and playbooks.

I am trying to add an error handling section while adding vlans to vnic template section, I am using failed module and failed when module but somehow its not working as expected, can you guys kindly help

playbook as given below

  • name: Conigure the vnic template
    ucs_vnic_template:
    hostname: "{{ ucs_hostname }}"
    username: "{{ ucs_username }}"
    password: "{{ ucs_password }}"
    state: "{{ ucs_state }}"
    name: test
    fabric: A-B

    mac_pool: mac-b

    pin_group: lan-fab-14

    template_type: updating-template
    vlans_list:
    - name: vlan_241_vivek
      native: 'no'
    - name: vlan_viv
      native: 'no'
    - name: Container-MGMT-VLAN
      native: 'no'
    
    register: find_output

failed_when: find_output.changed

failed_when: "'Configuration Failure' in find_output.stdout"

- debug:

var: "{{find_output.stdout}}"

  • name: warning for any potential failure scenario
    fail:
    msg: 'Multiple Uplink ports carrying overlapping disjoint vlans which may cause traffic disruption.'
    ignore_errors: yes
    with_items: '{{ service_profiles }}'
    when: item is not in service_profiles
    vars:
    # use "<<: *login_info" to substite the information below in each task
    # # this is not required, however it makes the playbook shorter.
    # login_info: &login_info
    # hostname: "{{ ucs_hostname }}"
    # username: "{{ ucs_username }}"
    # password: "{{ ucs_password }}"
    allowed_SP:
    • Service Profile c4-blade1
      service_profiles:
    • Service Profile test-SP1
    • Service Profile test-SP2
    • Service Profile c4-blade1

I have also attached the warning message which i am trying to integrate to the playbook.

maybe i am doing something wrong, if somebody can kindly help me it would great.

Regards
Vivekanand
cisco ucs warning while adding vlan to vnic template

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions