The following commands have been tested on Ubuntu 16.04
uname -a
Linux ubuntu 4.4.0-145-generic #171-Ubuntu SMP Tue Mar 26 12:43:40 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
0 - Install the tool
sudo apt-get install isc-dhcp-server
BEFORE START WORKING | |
Git fetch origin # Origin is the place from where you cloned your repository. | |
Git merge origin/master # Merge origin/master into your current branch. | |
git pull # Same | |
AFTER FINISH WORKING | |
git add | |
git commit -m "Commit message" | |
Git fetch origin # In case the remote could be ahead of you. Origin is the place from where you cloned your repository. |
The purpose of this gist is to gather facts from a network device with Napalm and Nornir alike.
This will help us understand how to use tasks in Nornir.
optional_arguments
when instantiating the Napalm driver object.#!/bin/bash | |
# Function that will expect a list of arguments from the cli and will resolve them using the host command. | |
# It will return the dns records or Ips on stdout | |
# Example bash hosts_cmd.sh 10.176.148.12 10.176.148.193 10.176.152.63 10.176.152.64 10.176.152.65 10.176.152.66 10.176.152.67 10.176.152.68 10.176.152.69 10.176.152.70 10.176.152.71 10.176.152.72 | |
#USAGE | |
# bash hosts_cmd.sh 10.195.129.22 10.195.129.23 10.185.129.62 10.185.129.63 | |
light_green_bold="\033[1;92;49m" |
Method 1 - With basicCofig() (Logging to a file)
#!/usr/bin/env python3
import logging
def conf_logging(log_sev='WARNING'):
log_format = "[%(name)s]-[%(levelname)s]-%(asctime)s-[%(funcName)s]-%(message)s"
datefmt='[%d/%m/%y]-[%H:%M:%S]'
file='dotfiles.log'
#!/usr/bin/env python3 | |
import yaml | |
from jinja2 import Environment, FileSystemLoader, PackageLoader, StrictUndefined | |
# Docs: https://jinja.palletsprojects.com/en/2.11.x/api/#basics | |
# Functions | |
def render_yaml_template(yaml_file, jinja_template, output="files/sshd_config"): | |
""" | |
This takes a yam file with all yor vars, a Jinja template and renders an output file |
import logging | |
from json import dumps | |
from os import environ | |
from urllib3 import PoolManager | |
logging.getLogger().setLevel(logging.INFO) | |
def post_to_slack(event, context): | |
slack_channel = environ.get("SLACK_NET_CHANNEL") |
The following commands will help you to install Python 3.9.1 on a Centos 7 or Ubuntu 18.04 machine.
https://www.python.org/ftp/python/ - We'll select the latest version as of Dec 2020 (3.9.1)
sudo yum install gcc openssl-devel bzip2-devel libffi-devel