1---
2# Example Playbook: cisco.ucs.ucs_lan_connectivity
3- hosts: ucs
4  connection: local
5  gather_facts: false
6
7  tasks:
8    - name: Test that we have a UCS hostname, UCS username, and UCS password
9      fail:
10        msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
11      when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
12      vars:
13        # use "<<: *login_info" to substite the information below in each task
14        # this is not required, however it makes the playbook shorter.
15        login_info: &login_info
16          hostname: "{{ ucs_hostname }}"
17          username: "{{ ucs_username }}"
18          password: "{{ ucs_password }}"
19
20    - name: Add UCS Organization
21      cisco.ucs.ucs_org:
22        <<: *login_info
23        org_name: level1
24        parent_org_path: root
25        description: level1 org
26        state: present
27        delegate_to: localhost
28
29    - name: Configure LAN Connectivity Policy
30      cisco.ucs.ucs_lan_connectivity:
31        <<: *login_info
32        name: Cntr-FC-Boot
33        org_dn: org-root/org-level1
34        vnic_list:
35        - name: eno1
36          vnic_template: Cntr-Template
37          adapter_policy: Linux
38        - name: eno2
39          vnic_template: Container-NFS-A
40          adapter_policy: Linux
41        - name: eno3
42          vnic_template: Container-NFS-B
43          adapter_policy: Linux
44        iscsi_vnic_list:
45        - name: iSCSIa
46          overlay_vnic: eno1
47          iscsi_adapter_policy: default
48          vlan_name: Container-MGMT-VLAN
49        - name: iSCSIb
50          overlay_vnic: eno3
51          iscsi_adapter_policy: default
52          vlan_name: Container-TNT-A-NFS
53
54    - name: Remove LAN Connectivity Policy
55      cisco.ucs.ucs_lan_connectivity:
56        <<: *login_info
57        name: Cntr-FC-Boot
58        org_dn: org-root/org-level1
59        state: absent
60
61    - name: Remove UCS Organization
62      cisco.ucs.ucs_org:
63        <<: *login_info
64        org_name: level1
65        parent_org_path: root
66        state: absent
67        delegate_to: localhost
68