Made inventories config and scripts
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
ansible-inventory -i ~/.secret/.ansible/inventories/vmware_vm_inventory/vmware_vm_inventory.yml --list -y --output ~/.secret/.ansible/inventories/hosts.yml
|
@ -0,0 +1,98 @@
|
||||
---
|
||||
#
|
||||
# For use:
|
||||
# ansible-inventory -i ~/.secret/.ansible/inventories/vmware_vm_inventory/vmware_vm_inventory.yml --list -y --output ~/.secret/.ansible/inventories/hosts_.yml
|
||||
# cat zzz.yml | grep -i "guestid" | sed 's/^ config.guestId: //' | sed 's/$.*//' | sort | uniq
|
||||
#
|
||||
plugin: community.vmware.vmware_vm_inventory
|
||||
strict: true
|
||||
hostname: "vcsrv01.XXXXXXX.XXX"
|
||||
username: "ansb-autotools-it@vsphere.local"
|
||||
password: "XXXXXXXXXXXXXXXX"
|
||||
validate_certs: false
|
||||
with_tags: true
|
||||
with_folders: true
|
||||
with_nested_properties: true
|
||||
|
||||
resources:
|
||||
- datacenter:
|
||||
- 'DC01'
|
||||
resources:
|
||||
- compute_resource:
|
||||
- Cluster01
|
||||
# - folder:
|
||||
# - VLAN-0222
|
||||
|
||||
|
||||
hostnames:
|
||||
- config.name
|
||||
|
||||
properties:
|
||||
- 'name'
|
||||
- 'config.name'
|
||||
- 'guest.guestFamily'
|
||||
- 'guest.guestFullName'
|
||||
# - 'config'
|
||||
# - 'guest'
|
||||
- 'guest.ipAddress'
|
||||
- 'config.guestId'
|
||||
- 'summary.runtime.powerState'
|
||||
- 'config.template'
|
||||
|
||||
## - availableField
|
||||
## - configIssue
|
||||
## - configStatus
|
||||
## - customValue
|
||||
## - datastore
|
||||
## - effectiveRole
|
||||
## - guestHeartbeatStatus
|
||||
## - layout
|
||||
## - layoutEx
|
||||
## - parent
|
||||
## - name
|
||||
## - network
|
||||
## - overallStatus
|
||||
## - parentVApp
|
||||
## - permission
|
||||
## - recentTask
|
||||
## - resourcePool
|
||||
## - rootSnapshot
|
||||
## - snapshot
|
||||
## - triggeredAlarmState
|
||||
## - value
|
||||
## - capability
|
||||
## - config
|
||||
## - guest
|
||||
## - runtime
|
||||
## - storage
|
||||
## - summary
|
||||
|
||||
filters:
|
||||
- config.template == false
|
||||
- summary.runtime.powerState == 'poweredOn'
|
||||
- '"vCLS" not in config.name'
|
||||
- '"vcsrv01.lab.loc" not in config.name'
|
||||
|
||||
#"'Nas01' in config.datastoreUrl[0].name"
|
||||
# or guest.ipAddress is match('192.169.*'))
|
||||
#- config.guestId == 'debian12_64Guest'
|
||||
|
||||
compose:
|
||||
ansible_host: 'guest.ipAddress'
|
||||
# composed_var: 'config.name'
|
||||
# ansible_user: "'root'"
|
||||
# ansible_connection: "'ssh'"
|
||||
# ansible_ssh_private_key_file: "'~/.ssh/id_rsa_XXXXXX'"
|
||||
# ansible_ssh_port: "'22'"
|
||||
# ansible_python_interpreter: "'/usr/bin/python3'"
|
||||
|
||||
groups:
|
||||
VMs: true
|
||||
|
||||
keyed_groups:
|
||||
- key: config.guestId
|
||||
separator: ''
|
||||
- key: guest.guestFullName
|
||||
separator: ''
|
||||
- key: guest.guestFamily
|
||||
separator: ''
|
Reference in New Issue
Block a user