Skip to content

Instantly share code, notes, and snippets.

View joelwking's full-sized avatar
🏠
Working from home

Joel W. King joelwking

🏠
Working from home
View GitHub Profile

Example of using using module csv_to_facts:

---

 - hosts: localhost
   gather_facts: no

   tasks:
     - name: Get facts from CSV file
       csv_to_facts:
@joelwking
joelwking / set_fact.md
Last active May 8, 2019 12:46
Example of dynamically creating scalar variables using the Ansible set_fact module.

This example illustrates that variables names can be created dynamically in an Ansible playbook.

Given we have a list of dictionaries representing DHCP Servers in our playbook. In this case, the list of DHCP servers was read from a spreadsheet and exposed as variables to the playbook.

ok: [localhost] => (item=dhcp_servers) => {
    "ansible_facts": {
        "dhcp_servers": [
            {
                "addr": "203.0.113.17",
                "label": "DHCP_DC1_PRD"
@joelwking
joelwking / sshport2222.md
Last active February 12, 2019 21:10
Verify Ansible connection method network_cli can use a non-standard SSH port to an IOS router

Using non-standard SSH port for IOS router

Verify Ansible playbook using non-standard SSH port to an IOS router.

Configure the router

csr1000v-1#config t

ip ssh port 2222 rotary 1

line vty 0 4