Initial hyper-v demo skeleton
This commit is contained in:
39
playbooks/sync-cmdb.yml
Normal file
39
playbooks/sync-cmdb.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
- name: Synchronize VM information to ServiceNow CMDB
|
||||
hosts: windows_servers
|
||||
gather_facts: true
|
||||
|
||||
tasks:
|
||||
- name: Gather Windows facts
|
||||
ansible.builtin.setup:
|
||||
gather_subset:
|
||||
- hardware
|
||||
- network
|
||||
- virtual
|
||||
|
||||
- name: Prepare CMDB data
|
||||
ansible.builtin.set_fact:
|
||||
cmdb_data:
|
||||
name: "{{ inventory_hostname }}"
|
||||
ip_address: "{{ ansible_ip_addresses[0] | default('') }}"
|
||||
os: "{{ ansible_os_family }}"
|
||||
os_version: "{{ ansible_distribution_version }}"
|
||||
cpu_count: "{{ ansible_processor_vcpus }}"
|
||||
ram: "{{ ansible_memtotal_mb }}"
|
||||
managed_by: "{{ managed_by }}"
|
||||
environment: "{{ environment }}"
|
||||
|
||||
- name: Display CMDB data
|
||||
ansible.builtin.debug:
|
||||
var: cmdb_data
|
||||
|
||||
# TODO: Implement actual ServiceNow CMDB update using servicenow.itsm collection
|
||||
# - name: Update ServiceNow CMDB
|
||||
# servicenow.itsm.configuration_item:
|
||||
# instance:
|
||||
# host: "{{ servicenow_instance }}"
|
||||
# username: "{{ servicenow_username }}"
|
||||
# password: "{{ servicenow_password }}"
|
||||
# state: present
|
||||
# sys_class_name: "{{ servicenow_table }}"
|
||||
# data: "{{ cmdb_data }}"
|
||||
Reference in New Issue
Block a user