Init: mediaserver

This commit is contained in:
2023-02-08 12:13:28 +01:00
parent 848bc9739c
commit f7c23d4ba9
31914 changed files with 6175775 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
---
# Example Playbook: VLAN configuration using the [ucs] hosts group
- hosts: ucs
connection: local
collections:
- cisco.ucs
gather_facts: false
tasks:
- name: Configure VLAN
ucs_vlans:
hostname: "{{ inventory_hostname }}"
username: "{{ username | default(omit) }}"
password: "{{ password }}"
state: "{{ state | default(omit) }}"
name: vlan2
id: '2'
native: 'no'
delegate_to: localhost

View File

@@ -0,0 +1,83 @@
---
#
# Download firmware to the FI and configure Host Firmware Packages (HFP).
# Uses remote fileshare and scp for FW download (server, remote_path, etc. provided through variables):
# Example vars:
# [ucs:vars]
# remote_ip_address=172.28.224.77
# remote_fw_path=/mnt/SHARE/ISOS/UCS_Code/4.1
# remote_username=...
#
# The fw_bundles variable is a list that can be passed on the command line.
# Example:
# ansible-playbook ... -e '{"fw_bundles": ["ucs-k9-bundle-b-series.4.1.2b.B.bin"]}'
#
- hosts: ucs
connection: local
gather_facts: false
vars:
login_info: &login_info
hostname: "{{ inventory_hostname }}"
username: "{{ username | default(omit) }}"
password: "{{ password }}"
tasks:
- name: Download FW to FI
ucs_managed_objects:
<<: *login_info
objects:
- module: ucsmsdk.mometa.firmware.FirmwareCatalogue
class: FirmwareCatalogue
properties:
parent_mo_or_dn: sys
children:
- module: ucsmsdk.mometa.firmware.FirmwareDownloader
class: FirmwareDownloader
properties:
protocol: scp
server: "{{ remote_ip_address }}"
remote_path: "{{ remote_fw_path }}"
file_name: "{{ item }}"
user: "{{ remote_username }}"
pwd: "{{ remote_password }}"
loop: "{{ fw_bundles }}"
delegate_to: localhost
register: download_result
- name: Query and wait for download if needed
cisco.ucs.ucs_query:
<<: *login_info
distinguished_names: "{{ fw_download_dn }}"
loop: "{{ fw_bundles }}"
vars:
fw_download_dn: "sys/fw-catalogue/dnld-{{ item }}"
delegate_to: localhost
register: query_response
# works with warnings:
# until: query_response['objects']["{{ fw_download_dn }}"]['transfer_state'] == 'downloaded'
until: query_response.objects is search('downloaded')
# retry every 60 seconds for 20 minutes
delay: 60
retries: 20
# regular escapes in a set variable
- set_fact:
match_str: 'ucs-.*?\.(?P<rel>\d\.\d)\.(?P<patch>.*)\.'
# escape the escapes when used directly in strings
- set_fact:
blade_version: "{{ item | regex_replace(match_str + 'B\\.bin', '\\g<rel>(\\g<patch>)B') }}"
loop: "{{ fw_bundles }}"
when: item | regex_search(match_str + 'B\\.bin')
- set_fact:
rack_version: "{{ item | regex_replace(match_str + 'C\\.bin', '\\g<rel>(\\g<patch>)C') }}"
loop: "{{ fw_bundles }}"
when: item | regex_search(match_str + 'C\\.bin')
- name: Config Host FW Package
ucs_managed_objects:
<<: *login_info
objects:
- module: ucsmsdk.mometa.firmware.FirmwareComputeHostPack
class: FirmwareComputeHostPack
properties:
parent_mo_or_dn: org-root
name: ansible-latest
blade_bundle_version: "{{ blade_version | default(omit) }}"
rack_bundle_version: "{{ rack_version | default(omit) }}"
delegate_to: localhost

View File

@@ -0,0 +1,6 @@
[ucs]
13.58.22.56
[ucs:vars]
username=admin
password=password

View File

@@ -0,0 +1,136 @@
---
- name: "Configure default IP Pool"
vars:
# Create an anchor for login_info that can be used throughout the file
login_info: &login_info
hostname: "{{ hostname }}"
username: "{{ username | default(omit) }}"
password: "{{ password | default('password') }}"
state: "{{ state | default(omit) }}"
cisco.ucs.ucs_ip_pool:
<<: *login_info
name: ext-mgmt
ipv4_blocks:
- first_addr: 198.18.0.20
last_addr: 198.18.0.40
subnet_mask: 255.255.255.0
default_gw: 198.18.0.1
tags: ip_pool
- name: "Configure default MAC Pool"
cisco.ucs.ucs_mac_pool:
<<: *login_info
name: default
first_addr: 00:25:B5:DE:30:00
last_addr: 00:25:B5:DE:32:FF
tags: mac_pool
- name: "Configure default UUID Pool"
cisco.ucs.ucs_uuid_pool:
<<: *login_info
name: default
first_uuid: 0000-000000000001
last_uuid: 0000-000000000078
tags: uuid_pool
- name: "Configure default Virtual Media Policy"
cisco.ucs.ucs_managed_objects:
<<: *login_info
objects:
- module: ucsmsdk.mometa.cimcvmedia.CimcvmediaMountConfigPolicy
class: CimcvmediaMountConfigPolicy
properties:
parent_mo_or_dn: org-root
name: "{{ vmedia_policy }}"
children:
- module: ucsmsdk.mometa.cimcvmedia.CimcvmediaConfigMountEntry
class: CimcvmediaConfigMountEntry
properties:
device_type: cdd
image_file_name: "{{ image_file_name | default('centos7.2-boot-ks.iso') }}"
image_path: "{{ image_path | default('/home/public') }}"
mapping_name: cdd-nfs
mount_protocol: nfs
remote_ip_address: "{{ remote_ip_address | default('198.18.134.242') }}"
tags: virtual_media
- name: "Configure default Boot Order Policy"
cisco.ucs.ucs_managed_objects:
<<: *login_info
objects:
- module: ucsmsdk.mometa.lsboot.LsbootPolicy
class: LsbootPolicy
properties:
parent_mo_or_dn: org-root
boot_mode: legacy
enforce_vnic_name: 'yes'
name: vmedia-local
reboot_on_update: 'no'
children:
- module: ucsmsdk.mometa.lsboot.LsbootVirtualMedia
class: LsbootVirtualMedia
properties:
access: read-only-remote-cimc
lun_id: '0'
order: '1'
- module: ucsmsdk.mometa.lsboot.LsbootStorage
class: LsbootStorage
properties:
order: '2'
children:
- module: ucsmsdk.mometa.lsboot.LsbootLocalStorage
class: LsbootLocalStorage
properties: {}
children:
- module: ucsmsdk.mometa.lsboot.LsbootDefaultLocalImage
class: LsbootDefaultLocalImage
properties:
order: '2'
tags: boot_order
- name: "Configure default Server Pool"
cisco.ucs.ucs_managed_objects:
<<: *login_info
objects:
- module: ucsmsdk.mometa.compute.ComputePool
class: ComputePool
properties:
parent_mo_or_dn: org-root
name: default
children:
- module: ucsmsdk.mometa.compute.ComputePooledSlot
class: ComputePooledSlot
properties:
chassis_id: '1'
slot_id: '1'
- module: ucsmsdk.mometa.compute.ComputePooledSlot
class: ComputePooledSlot
properties:
chassis_id: '1'
slot_id: '2'
- module: ucsmsdk.mometa.compute.ComputePooledSlot
class: ComputePooledSlot
properties:
chassis_id: '1'
slot_id: '3'
- module: ucsmsdk.mometa.compute.ComputePooledSlot
class: ComputePooledSlot
properties:
chassis_id: '1'
slot_id: '4'
- module: ucsmsdk.mometa.compute.ComputePooledSlot
class: ComputePooledSlot
properties:
chassis_id: '1'
slot_id: '5'
- module: ucsmsdk.mometa.compute.ComputePooledSlot
class: ComputePooledSlot
properties:
chassis_id: '1'
slot_id: '6'
- module: ucsmsdk.mometa.compute.ComputePooledSlot
class: ComputePooledSlot
properties:
chassis_id: '1'
slot_id: '7'
- module: ucsmsdk.mometa.compute.ComputePooledSlot
class: ComputePooledSlot
properties:
chassis_id: '1'
slot_id: '8'
tags: server_pool

View File

@@ -0,0 +1,18 @@
---
- name: "Configure {{ template_name }} Service Profile Template"
vars:
# Create an anchor for login_info that can be used throughout the file
login_info: &login_info
hostname: "{{ hostname }}"
username: "{{ username | default(omit) }}"
password: "{{ password | default('password') }}"
state: "{{ state | default(omit) }}"
cisco.ucs.ucs_service_profile_template:
<<: *login_info
name: "{{ template_name }}"
template_type: "{{ template_type }}"
host_firmware_package: "{{ host_firmware_package }}"
server_pool: default
vmedia_policy: "{{ vmedia_policy }}"
boot_policy: vmedia-local
maintenance_policy: "{{ maintenance_policy }}"

View File

@@ -0,0 +1,14 @@
---
- name: "Configure {{ profile_name }} Service Profiles from template {{ template_name }}"
vars:
# Create an anchor for login_info that can be used throughout the file
login_info: &login_info
hostname: "{{ hostname }}"
username: "{{ username | default(omit) }}"
password: "{{ password | default('password') }}"
state: "{{ state | default(omit) }}"
cisco.ucs.ucs_service_profile_from_template:
<<: *login_info
name: "{{ profile_name }}-{{ '%d' | format(item) }}"
source_template: "{{ template_name }}"
loop: "{{ range(1, num_profiles|int + 1) | list }}"

View File

@@ -0,0 +1,6 @@
[ucs]
ucs1 ucs_hostname=sandbox-ucsm1.cisco.com
[ucs:vars]
ucs_username=admin
ucs_password=C1sco12345

View File

@@ -0,0 +1,39 @@
---
#
# Configure UCS, Associate Service Profiles, and Install OS
#
# The hosts group used is provided by the group variable or defaulted to 'ucs'.
# You can specify a specific host (or host group) on the command line:
# ansible-playbook ... -e group=<your host group>
# e.g., ansible-playbook server_profiles.yml -e group=TME_Demo
#
- hosts: "{{ group | default('ucs') }}"
connection: local
gather_facts: false
vars:
# The UCS domain hostname can be set in the inventory or on the command line as needed
hostname: "{{ inventory_hostname }}"
# Names for Service Profiles, Policies, and number of Profiles
template_name: auto-template
template_type: updating-template
host_firmware_package: ansible-latest
maintenance_policy: user-ack
vmedia_policy: cdd-nfs
profile_name: auto-profile
num_profiles: 2
tasks:
- block:
# Configure default pools and other settings
- import_role:
name: servers/defaults
tags: defaults
# Configure Service Profile Template with default settings
- import_role:
name: servers/service_profile_templates
tags: templates
# Create Service Profiles from template and associate
- import_role:
name: servers/service_profiles
tags: profiles
# Use the localhost's environment and Python
delegate_to: localhost

View File

@@ -0,0 +1,74 @@
---
# Example Playbook: cisco.ucs.ucs_disk_group_policy
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Configure Disk Group Policy
cisco.ucs.ucs_disk_group_policy:
<<: *login_info
name: DEE-DG
raid_level: mirror
configuration_mode: manual
manual_disks:
- slot_num: '1'
role: normal
- slot_num: '2'
role: normal
org_dn: org-root/org-level1
- name: Remove Disk from Policy
cisco.ucs.ucs_disk_group_policy:
<<: *login_info
name: DEE-DG
description: Testing Ansible
raid_level: stripe
configuration_mode: manual
manual_disks:
- slot_num: '1'
role: normal
- slot_num: '2'
role: normal
state: absent
virtual_drive:
access_policy: platform-default
io_policy: direct
strip_size: 64KB
org_dn: org-root/org-level1
- name: Remove Disk Group Policy
cisco.ucs.ucs_disk_group_policy:
<<: *login_info
name: DEE-DG
state: absent
org_dn: org-root/org-level1
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,33 @@
---
# Example Playbook: cisco.ucs.ucs_dns_server
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Configure DNS server
cisco.ucs.ucs_dns_server:
<<: *login_info
dns_server: 10.10.10.10
description: DNS Server IP address
state: present
delegate_to: localhost
- name: Remove DNS server
cisco.ucs.ucs_dns_server:
<<: *login_info
dns_server: 10.10.10.10
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,105 @@
---
# Example Playbook: cisco.ucs_graphics_card_policy
- hosts: ucs
connection: local
gather_facts: false
vars:
org: AnsibleOrg
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: "{{ org }}"
parent_org_path: root
description: "Org {{ org }}"
state: present
delegate_to: localhost
- name: Add Graphics Card Policy
cisco.ucs.ucs_graphics_card_policy:
<<: *login_info
state: present
org_dn: "org-root/org-{{ org }}"
description: Any Graphics Mode Policy
name: prod_graphics
graphics_card_mode: any-configuration
delegate_to: localhost
- name: Check Graphics Card Policy
cisco.ucs.ucs_graphics_card_policy:
<<: *login_info
state: present
org_dn: "org-root/org-{{ org }}"
description: Any Graphics Mode Policy
name: prod_graphics
graphics_card_mode: any-configuration
delegate_to: localhost
check_mode: True
- name: Add Graphics Card Policy
cisco.ucs.ucs_graphics_card_policy:
<<: *login_info
state: present
description: Any Graphics Mode Policy
name: any_graphics
graphics_card_mode: any-configuration
delegate_to: localhost
- name: Idempotent Graphics Card Policy
cisco.ucs.ucs_graphics_card_policy:
<<: *login_info
state: present
description: Any Graphics Mode Policy
name: any_graphics
graphics_card_mode: any-configuration
delegate_to: localhost
- name: Check Create/Update Graphics Card Policy
cisco.ucs.ucs_graphics_card_policy:
<<: *login_info
state: present
org_dn: "org-root/org-{{ org }}"
description: Compute Graphics Mode Policy
name: prod_graphics
graphics_card_mode: compute
delegate_to: localhost
check_mode: true
- name: Create/Update Graphics Card Policy
cisco.ucs.ucs_graphics_card_policy:
<<: *login_info
state: present
org_dn: "org-root/org-{{ org }}"
description: Compute Graphics Mode Policy
name: prod_graphics
graphics_card_mode: compute
delegate_to: localhost
- name: Delete Graphics Card Policy
cisco.ucs.ucs_graphics_card_policy:
<<: *login_info
state: absent
name: any_graphics
delegate_to: localhost
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: "{{ org }}"
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,78 @@
---
# Example Playbook: cisco.ucs.ucs_ip_pool
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Configure IPv4 and IPv6 address pool
cisco.ucs.ucs_ip_pool:
<<: *login_info
name: ip-pool-01
org_dn: org-root/org-level1
ipv4_blocks:
- first_addr: 192.168.10.1
last_addr: 192.168.10.20
subnet_mask: 255.255.255.128
default_gw: 192.168.10.2
- first_addr: 192.168.11.1
last_addr: 192.168.11.20
subnet_mask: 255.255.255.128
default_gw: 192.168.11.2
ipv6_blocks:
- ipv6_first_addr: fe80::1cae:7992:d7a1:ed07
ipv6_last_addr: fe80::1cae:7992:d7a1:edfe
ipv6_default_gw: fe80::1cae:7992:d7a1:ecff
- ipv6_first_addr: fe80::1cae:7992:d7a1:ec07
ipv6_last_addr: fe80::1cae:7992:d7a1:ecfe
ipv6_default_gw: fe80::1cae:7992:d7a1:ecff
- name: Remove IPv4 and IPv6 address pool blocks
cisco.ucs.ucs_ip_pool:
<<: *login_info
name: ip-pool-01
org_dn: org-root/org-level1
ipv4_blocks:
- first_addr: 192.168.10.1
last_addr: 192.168.10.20
state: absent
ipv6_blocks:
- ipv6_first_addr: fe80::1cae:7992:d7a1:ec07
ipv6_last_addr: fe80::1cae:7992:d7a1:ecfe
state: absent
- name: Remove IPv4 and IPv6 address pool
cisco.ucs.ucs_ip_pool:
<<: *login_info
name: ip-pool-01
org_dn: org-root/org-level1
state: absent
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,67 @@
---
# Example Playbook: cisco.ucs.ucs_lan_connectivity
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Configure LAN Connectivity Policy
cisco.ucs.ucs_lan_connectivity:
<<: *login_info
name: Cntr-FC-Boot
org_dn: org-root/org-level1
vnic_list:
- name: eno1
vnic_template: Cntr-Template
adapter_policy: Linux
- name: eno2
vnic_template: Container-NFS-A
adapter_policy: Linux
- name: eno3
vnic_template: Container-NFS-B
adapter_policy: Linux
iscsi_vnic_list:
- name: iSCSIa
overlay_vnic: eno1
iscsi_adapter_policy: default
vlan_name: Container-MGMT-VLAN
- name: iSCSIb
overlay_vnic: eno3
iscsi_adapter_policy: default
vlan_name: Container-TNT-A-NFS
- name: Remove LAN Connectivity Policy
cisco.ucs.ucs_lan_connectivity:
<<: *login_info
name: Cntr-FC-Boot
org_dn: org-root/org-level1
state: absent
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,51 @@
---
# Example Playbook: cisco.ucs.ucs_mac_pool
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Configure MAC address pool
cisco.ucs.ucs_mac_pool:
<<: *login_info
name: mac-A
org_dn: org-root/org-level1
first_addr: 00:25:B5:00:66:00
last_addr: 00:25:B5:00:67:F3
order: sequential
- name: Remove MAC address pool
cisco.ucs.ucs_mac_pool:
<<: *login_info
name: mac-A
org_dn: org-root/org-level1
state: absent
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,124 @@
---
# Example Playbook: cisco.ucs.ucs_managed_objects
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Configure Network Control Policy
cisco.ucs.ucs_managed_objects:
<<: *login_info
objects:
- module: ucsmsdk.mometa.nwctrl.NwctrlDefinition
class: NwctrlDefinition
properties:
parent_mo_or_dn: org-root/org-level1
cdp: enabled
descr: ''
lldp_receive: enabled
lldp_transmit: enabled
name: Enable-CDP-LLDP
- name: Remove Network Control Policy
cisco.ucs.ucs_managed_objects:
<<: *login_info
objects:
- module: ucsmsdk.mometa.nwctrl.NwctrlDefinition
class: NwctrlDefinition
properties:
parent_mo_or_dn: org-root/org-level1
name: Enable-CDP-LLDP
state: absent
- name: Configure Boot Policy Using JSON objects list with children
cisco.ucs.ucs_managed_objects:
<<: *login_info
objects:
- {
"module": "ucsmsdk.mometa.lsboot.LsbootPolicy",
"class": "LsbootPolicy",
"properties": {
"parent_mo_or_dn": "org-root/org-level1",
"name": "Python_SDS",
"enforce_vnic_name": "yes",
"boot_mode": "legacy",
"reboot_on_update": "no"
},
"children": [
{
"module": "ucsmsdk.mometa.lsboot.LsbootVirtualMedia",
"class": "LsbootVirtualMedia",
"properties": {
"access": "read-only-local",
"lun_id": "0",
"order": "2"
}
},
{
"module": "ucsmsdk.mometa.lsboot.LsbootStorage",
"class": "LsbootStorage",
"properties": {
"order": "1"
},
"children": [
{
"module": "ucsmsdk.mometa.lsboot.LsbootLocalStorage",
"class": "LsbootLocalStorage",
"properties": {},
"children": [
{
"module": "ucsmsdk.mometa.lsboot.LsbootDefaultLocalImage",
"class": "LsbootDefaultLocalImage",
"properties": {
"order": "1"
}
}
]
}
]
}
]
}
- name: Remove Boot Policy Using JSON objects list
cisco.ucs.ucs_managed_objects:
<<: *login_info
objects:
- {
"module": "ucsmsdk.mometa.lsboot.LsbootPolicy",
"class": "LsbootPolicy",
"properties": {
"parent_mo_or_dn": "org-root/org-level1",
"name": "Python_SDS"
}
}
state: absent
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,44 @@
---
# Example Playbook: cisco.ucs.ucs_dns_server
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Configure NTP server
cisco.ucs.ucs_ntp_server:
<<: *login_info
ntp_server: 10.10.10.10
description: Internal NTP Server by IP address
state: present
- name: Configure NTP server
cisco.ucs.ucs_ntp_server:
<<: *login_info
ntp_server: pool.ntp.org
description: External NTP Server by hostname
state: present
- name: Remove NTP server
cisco.ucs.ucs_ntp_server:
<<: *login_info
ntp_server: 10.10.10.10
state: absent
- name: Remove NTP server
cisco.ucs.ucs_ntp_server:
<<: *login_info
ntp_server: pool.ntp.org
state: absent

View File

@@ -0,0 +1,73 @@
---
# Example Playbook: cisco.ucs.ucs_org
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: test
description: testing org
state: present
delegate_to: localhost
- name: Update UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: test
description: Testing org
state: present
delegate_to: localhost
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: test
state: absent
delegate_to: localhost
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level2
parent_org_path: root/level1
description: level2 org
state: present
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level3
parent_org_path: root/level1/level2
description: level3 org
state: present
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level2
parent_org_path: root/level1
state: absent

View File

@@ -0,0 +1,62 @@
---
# Example Playbook: cisco.ucs.ucs_query
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Query UCS Class ID
cisco.ucs.ucs_query:
<<: *login_info
class_ids: computeBlade
delegate_to: localhost
register: response
- name: show response
debug:
msg: "{{ response }}"
- name: Query UCS Class IDs
cisco.ucs.ucs_query:
<<: *login_info
class_ids: computeBlade, fabricVlan
delegate_to: localhost
register: response
- name: show response
debug:
msg: "{{ response }}"
- name: Query UCS Distinguished Name
cisco.ucs.ucs_query:
<<: *login_info
distinguished_names: org-root
delegate_to: localhost
register: response
- name: show response
debug:
msg: "{{ response }}"
- name: Query UCS Distinguished Names
cisco.ucs.ucs_query:
<<: *login_info
distinguished_names: org-root, sys/rack-unit-1, sys/chassis-1/blade-2
delegate_to: localhost
register: response
- name: show response
debug:
msg: "{{ response }}"

View File

@@ -0,0 +1,56 @@
---
# Example Playbook: cisco.ucs.ucs_san_connectivity
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Configure SAN Connectivity Policy
cisco.ucs.ucs_san_connectivity:
<<: *login_info
name: Cntr-FC-Boot
org_dn: org-root/org-level1
wwnn_pool: WWNN-Pool
vhba_list:
- name: Fabric-A
vhba_template: vHBA-Template-A
adapter_policy: Linux
- name: Fabric-B
vhba_template: vHBA-Template-B
adapter_policy: Linux
- name: Remove SAN Connectivity Policy
cisco.ucs.ucs_san_connectivity:
<<: *login_info
name: Cntr-FC-Boot
org_dn: org-root/org-level1
state: absent
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,123 @@
---
# Example Playbook: cisco.ucs.ucs_scrub_policy
- hosts: ucs
connection: local
gather_facts: false
vars:
org: AnsibleOrg
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: "{{ org }}"
parent_org_path: root
description: "Org {{ org }}"
state: present
delegate_to: localhost
- name: Add Scrub Policy
cisco.ucs.ucs_scrub_policy:
<<: *login_info
state: present
org_dn: "org-root/org-{{ org }}"
description: Scrub All Policy
name: all_scrub
bios_settings_scrub: "yes"
disk_scrub: "yes"
flex_flash_scrub: "yes"
persistent_memory_scrub: "yes"
delegate_to: localhost
- name: Check Scrub Policy
cisco.ucs.ucs_scrub_policy:
<<: *login_info
state: present
org_dn: "org-root/org-{{ org }}"
description: Scrub All Policy
name: all_scrub
bios_settings_scrub: "yes"
disk_scrub: "yes"
flex_flash_scrub: "yes"
persistent_memory_scrub: "yes"
delegate_to: localhost
check_mode: True
- name: Add Scrub Policy
cisco.ucs.ucs_scrub_policy:
<<: *login_info
state: present
description: Scrub All Policy
name: all_scrub
bios_settings_scrub: "yes"
disk_scrub: "yes"
flex_flash_scrub: "yes"
persistent_memory_scrub: "yes"
delegate_to: localhost
- name: Idempotent Scrub Policy
cisco.ucs.ucs_scrub_policy:
<<: *login_info
state: present
description: Scrub All Policy
name: all_scrub
bios_settings_scrub: "yes"
disk_scrub: "yes"
flex_flash_scrub: "yes"
persistent_memory_scrub: "yes"
delegate_to: localhost
- name: Check Create/Update Scrub Policy
cisco.ucs.ucs_scrub_policy:
<<: *login_info
state: present
org_dn: "org-root/org-{{ org }}"
name: BD_scrub
description: Scrub BIOS and Disk Policy
bios_settings_scrub: "yes"
disk_scrub: "yes"
flex_flash_scrub: "no"
persistent_memory_scrub: "no"
delegate_to: localhost
check_mode: true
- name: Create/Update Scrub Policy
cisco.ucs.ucs_scrub_policy:
<<: *login_info
state: present
org_dn: "org-root/org-{{ org }}"
name: BD_scrub
description: Scrub BIOS and Disk Policy
bios_settings_scrub: "yes"
disk_scrub: "yes"
flex_flash_scrub: "no"
persistent_memory_scrub: "no"
delegate_to: localhost
- name: Delete Scrub Policy
cisco.ucs.ucs_scrub_policy:
<<: *login_info
state: absent
name: all_scrub
delegate_to: localhost
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: "{{ org }}"
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,109 @@
---
# Example Playbook: cisco.ucs.ucs_serial_over_lan_policy
- hosts: ucs
connection: local
gather_facts: false
vars:
org: AnsibleOrg
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: "{{ org }}"
parent_org_path: root
description: "Org {{ org }}"
state: present
delegate_to: localhost
- name: Add UCS Serial Over Lan Policy
cisco.ucs.ucs_serial_over_lan_policy:
<<: *login_info
state: present
org_dn: "org-root/org-{{ org }}"
name: sol_pol
description: "Serial Over Lan for Org {{ org }} servers"
admin_state: enable
speed: "38400"
delegate_to: localhost
- name: Check Serial Over Lan
cisco.ucs.ucs_serial_over_lan_policy:
<<: *login_info
state: present
org_dn: "org-root/org-{{ org }}"
name: sol_pol
description: "Serial Over Lan for Org {{ org }} servers"
admin_state: enable
speed: "38400"
delegate_to: localhost
check_mode: True
- name: Add Serial Over Lan
cisco.ucs.ucs_serial_over_lan_policy:
<<: *login_info
state: present
name: sol_pol
description: Serial Over Lan for Org Root servers
admin_state: enable
speed: "57600"
delegate_to: localhost
- name: Idempotent Serial Over Lan
cisco.ucs.ucs_serial_over_lan_policy:
<<: *login_info
state: present
name: sol_pol
description: Serial Over Lan for Org Root servers
admin_state: enable
speed: "57600"
delegate_to: localhost
- name: Check Update Serial Over Lan
cisco.ucs.ucs_serial_over_lan_policy:
<<: *login_info
state: present
name: sol_pol
description: Serial Over Lan for Org Root servers
admin_state: enable
speed: "57600"
delegate_to: localhost
check_mode: true
- name: Update Serial Over Lan
cisco.ucs.ucs_serial_over_lan_policy:
<<: *login_info
state: present
name: sol_pol
description: Serial Over Lan for Org Root servers
admin_state: enable
speed: "57600"
delegate_to: localhost
- name: Delete Serial Over Lan
cisco.ucs.ucs_serial_over_lan_policy:
<<: *login_info
state: absent
name: sol_pol
delegate_to: localhost
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: "{{ org }}"
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,43 @@
---
# Example Playbook: cisco.ucs.ucs_server_maintenance
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add Server Maintenance Policy (check_mode)
cisco.ucs.ucs_server_maintenance:
<<: *login_info
name: user-ack
uptime_disr: user-ack
trigger_config: on-next-boot
delegate_to: localhost
check_mode: true
- name: Add Server Maintenance Policy
cisco.ucs.ucs_server_maintenance:
<<: *login_info
name: user-ack
uptime_disr: user-ack
trigger_config: on-next-boot
delegate_to: localhost
- name: Idempotent Add Server Maintenance Policy
cisco.ucs.ucs_server_maintenance:
<<: *login_info
name: user-ack
uptime_disr: user-ack
trigger_config: on-next-boot
delegate_to: localhost

View File

@@ -0,0 +1,53 @@
---
# Example Playbook: cisco.ucs.ucs_ucs_service_profile_association
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Change Service Profile Association to Existing Server
cisco.ucs.ucs_service_profile_association:
<<: *login_info
service_profile_name: auto-profile-2
server_assignment: server
server_dn: sys/chassis-6/blade-1
delegate_to: localhost
register: result
until: result.assign_state == 'assigned' and result.assoc_state == 'associated'
retries: 10
delay: 60
- name: Change Service Profile Association to Pool
cisco.ucs.ucs_service_profile_association:
<<: *login_info
service_profile_name: auto-profile-2
server_assignment: pool
server_pool_name: default
delegate_to: localhost
register: result
until: result.assign_state == 'assigned' and result.assoc_state == 'associated'
retries: 10
delay: 60
- name: Disassociate Service Profile
cisco.ucs.ucs_service_profile_association:
<<: *login_info
service_profile_name: auto-profile-2
state: absent
delegate_to: localhost
register: result
until: result.assign_state == 'unassigned' and result.assoc_state == 'unassociated'
retries: 10
delay: 60

View File

@@ -0,0 +1,68 @@
---
# Example Playbook: cisco.ucs.ucs_service_profile_from_template
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Configure Service Profile Template with LAN/SAN Connectivity and all other options defaulted
cisco.ucs.ucs_service_profile_template:
<<: *login_info
name: sp-template
org_dn: org-root/org-level1
template_type: updating-template
uuid_pool: UUID-Pool
storage_profile: DEE-StgProf
lan_connectivity_policy: Cntr-FC-Boot
iqn_pool: iSCSI-Boot-A
san_connectivity_policy: Cntr-FC-Boot
boot_policy: DEE-vMedia
maintenance_policy: default
server_pool: Container-Pool
host_firmware_package: 3.1.2b
bios_policy: Docker
- name: Configure Service Profile from Template
cisco.ucs.ucs_service_profile_from_template:
<<: *login_info
name: sp-instance-1
org_dn: org-root/org-level1
user_label: SP Instance
power_state: down
source_template: sp-template
- name: Remove Service Profile Template
cisco.ucs.ucs_service_profile_template:
<<: *login_info
name: sp-template
org_dn: org-root/org-level1
state: absent
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,59 @@
---
# Example Playbook: cisco.ucs.ucs_service_profile_template
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Configure Service Profile Template with LAN/SAN Connectivity and all other options defaulted
cisco.ucs.ucs_service_profile_template:
<<: *login_info
name: sp-template
org_dn: org-root/org-level1
template_type: updating-template
uuid_pool: UUID-Pool
storage_profile: DEE-StgProf
lan_connectivity_policy: Cntr-FC-Boot
iqn_pool: iSCSI-Boot-A
san_connectivity_policy: Cntr-FC-Boot
boot_policy: DEE-vMedia
maintenance_policy: default
server_pool: Container-Pool
host_firmware_package: 3.1.2b
bios_policy: Docker
- name: Remove Service Profile Template
cisco.ucs.ucs_service_profile_template:
<<: *login_info
name: sp-template
org_dn: org-root/org-level1
state: absent
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,29 @@
---
# Example Playbook: cisco.ucs.ucs_sp_vnic_order
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Configure vnic order
cisco.ucs.ucs_sp_vnic_order:
<<: *login_info
sp_name: DEE-Ctrl-02
vnics:
- name: eno1
admin_vcon: '1'
order: '1'
transport: ethernet
delegate_to: localhost

View File

@@ -0,0 +1,64 @@
---
# Example Playbook: cisco.ucs.ucs_storage_profile
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Configure Storage Profile
cisco.ucs.ucs_storage_profile:
<<: *login_info
name: DEE-StgProf
org_dn: org-root/org-level1
local_luns:
- name: Boot-LUN
size: '60'
disk_policy_name: DEE-DG
- name: Data-LUN
size: '200'
disk_policy_name: DEE-DG
- name: Remove Local LUN from Storage Profile
cisco.ucs.ucs_storage_profile:
<<: *login_info
name: DEE-StgProf
org_dn: org-root/org-level1
local_luns:
- name: Data-LUN
state: absent
- name: Remove Storage Profile
cisco.ucs.ucs_storage_profile:
<<: *login_info
name: DEE-StgProf
org_dn: org-root/org-level1
state: absent
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,71 @@
---
# Example Playbook: cisco.ucs.ucs_system_qos
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Check QoS System Class
cisco.ucs.ucs_system_qos:
<<: *login_info
priority: platinum
cos: '5'
weight: '10'
delegate_to: localhost
check_mode: true
- name: Add QoS System Class
cisco.ucs.ucs_system_qos:
<<: *login_info
priority: platinum
cos: '5'
weight: '10'
delegate_to: localhost
- name: Idempotent Add QoS System Class
cisco.ucs.ucs_system_qos:
<<: *login_info
priority: platinum
cos: '5'
weight: '10'
delegate_to: localhost
- name: Check Update QoS System Class
cisco.ucs.ucs_system_qos:
<<: *login_info
priority: platinum
cos: '5'
weight: '10'
mtu: '9216'
delegate_to: localhost
check_mode: true
- name: Update QoS System Class
cisco.ucs.ucs_system_qos:
<<: *login_info
priority: platinum
cos: '5'
weight: '10'
mtu: '9216'
delegate_to: localhost
- name: Idempotent Update QoS System Class
cisco.ucs.ucs_system_qos:
<<: *login_info
priority: platinum
cos: '5'
weight: '10'
mtu: '9216'
delegate_to: localhost

View File

@@ -0,0 +1,31 @@
---
# Example Playbook: cisco.ucs.ucs_timezone
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Configure Time Zone
cisco.ucs.ucs_timezone:
<<: *login_info
state: present
admin_state: enabled
timezone: America/Phoenix
- name: Unconfigure Time Zone
cisco.ucs.ucs_timezone:
<<: *login_info
state: absent
admin_state: disabled

View File

@@ -0,0 +1,51 @@
---
# Example Playbook: cisco.ucs.ucs_uuid_pool
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Configure UUID address pool
cisco.ucs.ucs_uuid_pool:
<<: *login_info
name: UUID-Pool
org_dn: org-root/org-level1
order: sequential
first_uuid: 0000-000000000001
last_uuid: 0000-000000000078
- name: Remove UUID address pool
cisco.ucs.ucs_uuid_pool:
<<: *login_info
name: UUID-Pool
org_dn: org-root/org-level1
state: absent
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,51 @@
---
# Example Playbook: cisco.ucs.ucs_vhba_template
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Configure vHBA template
cisco.ucs.ucs_vhba_template:
<<: *login_info
name: vHBA-A
org_dn: org-root/org-level1
fabric: A
vsan: VSAN-A
wwpn_pool: WWPN-Pool-A
- name: Remote vHBA template
cisco.ucs.ucs_vhba_template:
<<: *login_info
name: vHBA-A
org_dn: org-root/org-level1
state: absent
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
state: absent
delegate_to: localhost

View File

@@ -0,0 +1,39 @@
---
# Example Playbook: cisco.ucs.ucs_vlan_find
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Get all vlans in fabric A
cisco.ucs.ucs_vlan_find:
<<: *login_info
fabric: 'common'
pattern: '.'
register: response
- name: show response
debug:
msg: "{{ response }}"
- name: Confirm if vlan 15 is present
cisco.ucs.ucs_vlan_find:
<<: *login_info
vlanid: '200'
register: response
- name: show response
debug:
msg: "{{ response }}"

View File

@@ -0,0 +1,25 @@
---
# Example Playbook: cisco.ucs.ucs_vlan_to_group
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add VLAN to existing VLAN group
cisco.ucs.ucs_vlan_to_group:
<<: *login_info
vlangroup: inband
vlanname: vlan244
delegate_to: localhost

View File

@@ -0,0 +1,31 @@
---
# Example Playbook: cisco.ucs.ucs_vlans
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Configure VLAN
cisco.ucs.ucs_vlans:
<<: *login_info
name: vlan300
id: '300'
native: 'no'
- name: Remove VLAN
cisco.ucs.ucs_vlans:
<<: *login_info
name: vlan300
state: absent

View File

@@ -0,0 +1,98 @@
---
# Example Playbook: cisco.ucs.ucs_vnic_template
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Configure vNIC template
cisco.ucs.ucs_vnic_template:
<<: *login_info
name: vNIC-A
org_dn: org-root/org-level1
fabric: A
vlans_list:
- name: default
native: 'yes'
- name: vlan200
native: 'no'
- name: Remove VLAN from template
cisco.ucs.ucs_vnic_template:
<<: *login_info
name: vNIC-A
org_dn: org-root/org-level1
fabric: A
vlans_list:
- name: vlan200
state: absent
- name: Configure vNIC template for failover
cisco.ucs.ucs_vnic_template:
<<: *login_info
name: vNIC-A-B
org_dn: org-root/org-level1
fabric: A-B
redundancy_type: primary
vlans_list:
- name: default
native: 'yes'
- name: vlan200
native: 'no'
- name: Configure vNIC template for failover
cisco.ucs.ucs_vnic_template:
<<: *login_info
name: vNIC-B-A
org_dn: org-root/org-level1
fabric: B-A
redundancy_type: secondary
vlans_list:
- name: default
native: 'yes'
- name: vlan200
native: 'no'
- name: Remove vNIC template
cisco.ucs.ucs_vnic_template:
<<: *login_info
name: vNIC-A-B
org_dn: org-root/org-level1
# state: absent
- name: Remove vNIC template
cisco.ucs.ucs_vnic_template:
<<: *login_info
name: vNIC-B-A
org_dn: org-root/org-level1
# state: absent
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
# state: absent
delegate_to: localhost

View File

@@ -0,0 +1,32 @@
---
# Example Playbook: cisco.ucs.ucs_vsans
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Configure VSAN
cisco.ucs.ucs_vsans:
<<: *login_info
name: vsan110
fabric: common
vsan_id: '110'
vlan_id: '110'
- name: Remove VSAN
cisco.ucs.ucs_vsans:
<<: *login_info
name: vsan110
state: absent

View File

@@ -0,0 +1,85 @@
---
# Example Playbook: cisco.ucs.ucs_wwn_pool
- hosts: ucs
connection: local
gather_facts: false
tasks:
- name: Test that we have a UCS hostname, UCS username, and UCS password
fail:
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
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 }}"
- name: Add UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Configure WWNN pool
cisco.ucs.ucs_wwn_pool:
<<: *login_info
name: WWNN-Pool
org_dn: org-root/org-level1
purpose: node
first_addr: 20:00:00:25:B5:48:00:00
last_addr: 20:00:00:25:B5:48:00:0F
- name: Configure WWPN A pool
cisco.ucs.ucs_wwn_pool:
<<: *login_info
name: WWPN-Pool-A
org_dn: org-root/org-level1
purpose: port
order: sequential
first_addr: 20:00:00:25:B5:48:0A:00
last_addr: 20:00:00:25:B5:48:0A:0F
- name: Configure WWPN Bpool
cisco.ucs.ucs_wwn_pool:
<<: *login_info
name: WWPN-Pool-B
org_dn: org-root/org-level1
purpose: port
order: sequential
first_addr: 20:00:00:25:B5:48:0B:00
last_addr: 20:00:00:25:B5:48:0B:0F
- name: Remove WWNN pool
cisco.ucs.ucs_wwn_pool:
<<: *login_info
org_dn: org-root/org-level1
name: WWNN-Pool
state: absent
- name: Remove WWPN pool
cisco.ucs.ucs_wwn_pool:
<<: *login_info
name: WWPN-Pool-A
org_dn: org-root/org-level1
state: absent
- name: Remove WWPN pool
cisco.ucs.ucs_wwn_pool:
<<: *login_info
name: WWPN-Pool-B
org_dn: org-root/org-level1
state: absent
- name: Remove UCS Organization
cisco.ucs.ucs_org:
<<: *login_info
org_name: level1
parent_org_path: root
state: absent
delegate_to: localhost