Skip to content

Instantly share code, notes, and snippets.

View ngschmidt's full-sized avatar

Nick Schmidt ngschmidt

View GitHub Profile
@ngschmidt
ngschmidt / draw_zones.yml
Created January 7, 2024 20:03
Ansible Build DNS Zones from SoT
---
- name: "Build DNS Zonefiles"
hosts: localhost
vars:
zones:
- name: "add_here.zone"
zonename: "add_here"
soa: "ns"
settings:
ttl: "2d"
@ngschmidt
ngschmidt / ansible_playbook.yml
Created December 25, 2023 18:19
Ansible Collect vSphere Inventory (for Automated Deployments)
---
- hosts: localhost
gather_facts: true
# Before executing ensure that the prerequisites are installed
# `ansible-galaxy collection install vmware.vmware_rest`
# `python3 -m pip install aiohttp`
tasks:
- name: "Get The Clusters"
vmware.vmware_rest.vcenter_cluster_info:
vcenter_hostname: '{{ lookup("env", "VHOSTNAME") }}'
@ngschmidt
ngschmidt / ansible_build_vm.yml
Last active December 25, 2023 20:18
GitHub Actions vSphere + Netbox VM Deployment
---
- hosts: localhost
gather_facts: true
# Before executing ensure that the prerequisites are installed
# `ansible-galaxy collection install vmware.vmware_rest netbox.netbox`
# `python3 -m pip install aiohttp pynetbox`
# We start with a pre-check playbook, if it fails, we don't want to
# make changes
any_errors_fatal: true
vars_files:
@ngschmidt
ngschmidt / build_vm.yml
Last active February 11, 2023 16:31
Ansible - Guest VM Customization
---
- hosts: localhost
gather_facts: true
# Before executing ensure that the prerequisites are installed
# `ansible-galaxy collection install vmware.vmware_rest`
# `python3 -m pip install aiohttp`
# We start with a pre-check playbook, if it fails, we don't want to
# make changes
any_errors_fatal: true
vars_files:
@ngschmidt
ngschmidt / build_vm.yml
Last active February 4, 2023 17:14
Ansible - Deploy vSphere VM via REST API
---
- hosts: localhost
gather_facts: true
# Before executing ensure that the prerequisites are installed
# `ansible-galaxy collection install vmware.vmware_rest`
# `python3 -m pip install aiohttp`
tasks:
- name: "Build the VM"
vmware.vmware_rest.vcenter_vmtemplate_libraryitems:
@ngschmidt
ngschmidt / get_info.yml
Last active January 28, 2023 17:36
Ansible - Get vSphere Facts
---
- hosts: localhost
gather_facts: true
# Before executing ensure that the prerequisites are installed
# `ansible-galaxy collection install vmware.vmware_rest`
# `python3 -m pip install aiohttp`
tasks:
- name: "Get The Clusters"
vmware.vmware_rest.vcenter_cluster_info:
vcenter_hostname: '{{ lookup("env", "VHOSTNAME") }}'
@ngschmidt
ngschmidt / check-certificates.py
Last active October 23, 2022 18:25
Certificate Expiration Tracker
#!/usr/bin/python3
# TLS Certificate Checker
# Ingest a list of hosts, and return a report (YAML) with expiration dates
# Nicholas Schmidt
# Imports
# Plaintext
from ruamel.yaml import YAML
import json
@ngschmidt
ngschmidt / debug_nxos_commands.yml
Created October 16, 2022 07:01
cisco nexus facts
---
- hosts: nxos_machines
tasks:
- name: "Gather facts via NXAPI"
cisco.nxos.nxos_command:
commands:
- 'show cfs status'
register: nxos_facts_gathered
- name: "Print it!"
when: 'nxos_facts_gathered.stdout is search("Distribution : Enabled")'
@ngschmidt
ngschmidt / disable_cloud_init_after_build.yml
Last active October 30, 2022 16:07
VMware Guest OS Provisioning and Customization
---
- hosts: "{{ lookup('env', 'EXEC_HOST') }}"
tasks:
- name: "Disable cloud-init!"
systemd:
name: "{{ item }}"
enabled: "no"
state: "stopped"
loop:
- "cloud-init"
@ngschmidt
ngschmidt / NetworkDiagram-CML-Closfabric.png
Last active June 5, 2022 23:39
NX-OS Clos Fabric (Base IP) Lab. Add Routing protocols to taste
NetworkDiagram-CML-Closfabric.png