Skip to content

Instantly share code, notes, and snippets.

View IPvSean's full-sized avatar

Sean Cavanaugh IPvSean

View GitHub Profile
---
plugin: aws_ec2
regions:
- "{{ec2_region}}"
filters:
tag:Workshop: "{{ec2_name_prefix}}"
groups:
# all workshop types
control_nodes: "'ansible' in tags.short_name"
# rhel, rhel_90, f5
ok: [804d-student2-ansible] =>
msg: |-
{
"admin_password": "ansible1234",
"ami_launch_index": 0,
"ansible_check_mode": false,
"ansible_diff_mode": false,
"ansible_facts": {},
"ansible_forks": 5,
"ansible_host": "3.226.22.126",
@IPvSean
IPvSean / license_playbook.yml
Created April 17, 2020 14:20
automate tower license
---
- hosts: localcost
connection: local
gather_facts: false
tasks:
- name: Post license key
uri:
url: https://localhost/api/v2/config/
method: POST
user: admin
@IPvSean
IPvSean / my_module.py
Last active April 15, 2020 22:21
this is a really basic fake module based of the Ansible ping module to help demonstrate how Ansible Collections can work
#!/usr/bin/python
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils.basic import AnsibleModule
def main():
module = AnsibleModule(
@IPvSean
IPvSean / output.txt
Created April 1, 2020 01:10
problem with failed_when: false
TASK [gitlab-client : Configure workshop repository] *******************************************************************************************************************************************************
ok: [sean-march31-student1-ansible]
TASK [gitlab-client : print this bad boy] ******************************************************************************************************************************************************************
ok: [sean-march31-student1-ansible] =>
msg:
changed: false
failed: false
failed_when_result: false
msg: Destination /home/student1/windows-workshop/workshop_project/.git/config does not exist !
@IPvSean
IPvSean / output.md
Created February 11, 2020 18:11
problems with eos_vlans

on_box:->

        - name: desktops
          vlan_id: 20
        - name: servers
          vlan_id: 30
        - name: printers
          vlan_id: 40
        - name: DMZ
 vlan_id: 50
[student1@ansible ~]$ cat netconf.yml
---
- name: RUN A NETCONF COMMAND
hosts: cisco
gather_facts: no
tasks:
- name: make sure jxmlease is installed locally
pip:
name: jxmlease
[student1@ansible ~]$ cat ~/.ansible.cfg
[defaults]
stdout_callback = yaml
connection = smart
timeout = 60
deprecation_warnings = False
host_key_checking = False
retry_files_enabled = False
inventory = /home/student1/networking-workshop/lab_inventory/hosts
[persistent_connection]
@IPvSean
IPvSean / reboot.yml
Last active July 31, 2023 18:46
Reboot Ansible Playbook for an Arista vEOS machine
# Reboot an Arista EOS switch
---
- name: Reboot arista eos switch
hosts: routers
gather_facts: false
tasks:
- name: Reboot device
ansible.netcommon.cli_command:
command: reload now
- name: Perform Checks to make sure this Playbook will complete successfully
hosts: localhost
connection: local
become: no
gather_facts: no
vars:
ec2_region: us-east-1
tasks:
- name: find ami for node1
ec2_ami_facts: