Begin Switch Infrastructure config

This commit is contained in:
Patrick Toal
2019-06-20 11:24:53 -04:00
parent 6e2205a046
commit 11b9c3071d
10 changed files with 159 additions and 1 deletions

2
.gitignore vendored
View File

@@ -107,3 +107,5 @@ venv.bak/
# Ansible
*.retry
roles/toallab.infrastructure/backup/

View File

@@ -0,0 +1,40 @@
Role Name
=========
Provisions home lab infrastructure.
Requirements
------------
Really, you need my home lab setup. This role isn't really reusable in that regard.
Role Variables
--------------
TBD
Dependencies
------------
My Home Lab
Example Playbook
----------------
TODO
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
MIT
Author Information
------------------
Patrick Toal - ptoal@takeflight.ca - https://toal.ca

View File

@@ -0,0 +1,2 @@
---
# defaults file for toallab.infrastructure

View File

@@ -0,0 +1,2 @@
---
# handlers file for toallab.infrastructure

View File

@@ -0,0 +1,53 @@
galaxy_info:
author: your name
description: your description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.4
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@@ -0,0 +1,33 @@
---
# tasks file for toallab.infrastructure
- name: Backup IOS Config
connection: network_cli
become: yes
ios_config:
backup: yes
- name: Install base configuration
connection: network_cli
become: yes
ios_config:
lines:
- enable secret 5 $1$7h96$Q7sso70QqSgFIpY91SuQC0
- username ptoal privilege 15 secret 5 $1$j4aN$xbLbABGihOTnnHl5PFm4g1
- aaa new-model
- ip domain-name lan.toal.ca
- ip name-server 192.168.1.1
- no cdp run
- lldp run
- ip ssh authentication-retries 2
- ip ssh rsa keypair-name ssh2
- ip ssh version 2
- ntp server 0.ca.pool.ntp.org
- ntp server 0.pool.ntp.org
- ntp server ip 1.pool.ntp.org
- name: Save changes
become: yes
connection: network_cli
ios_config:
save_when: changed

View File

@@ -0,0 +1,2 @@
localhost

View File

@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- toallab.infrastructure

View File

@@ -0,0 +1,2 @@
---
# vars file for toallab.infrastructure

View File

@@ -1,10 +1,27 @@
# Toal Lab Site Playbook
- name: Common Lab Machine Setup
hosts: all
hosts: all,!switch01
become: true
roles:
- toal-common
- name: Set Network OS from Netbox info.
gather_facts: no
hosts: switch01
tasks:
- name: Set network os type for Cisco
set_fact: ansible_network_os="ios"
when: "'Cisco IOS' in platforms"
- name: Configure infrastructure
hosts: switch01
become_method: enable
connection: network_cli
gather_facts: no
roles:
- toallab.infrastructure
- name: Ansible Red Demo Environment
hosts: ansible-red
become: false