Python script Cron scheduler – Troubleshooting sendmail example

CRON & SENDMAIL TROUBLESHOOTING STEPS Check cron status root@ee7467603704:/pynetauto# crontab -l #to list current cron job * * * * * echo “Hello world” >> /var/log/cron.log 2>&1 * * * * * /usr/bin/python3 /home/gday.py >> /var/log/cron.log 2>&1 52 1 * * * /usr/bin/python3 /var/log/time.py >> /var/log/cron.log 2>&153 1 * * * echo “Hello vPAN_updater10” >>… Read More Python script Cron scheduler – Troubleshooting sendmail example

Ansible – Running ansible-playbook against local loopback for testing

This is part of LinkedIn training from Anthony Sequeira’s “Learning Ansible” training videos. Added the adding loopbacks as he has not mentioned about it. Step 1: Create YAML file root@u20s0:~/an# nano orchestrate.yml name: “Orchestration example”hosts: logicservers #Server groupserial: 1 #sequential tasks: name: “Shutdown Server” #Task namedebug:msg: “Shutdown {{ inventory_hostname }}” #print message embedded with inventory_hostname… Read More Ansible – Running ansible-playbook against local loopback for testing

Ansible – Generate ssh key and add to controlled nodes

Step 1: Check .sshroot@u20s0 ls -l ~/.ssh/id_*.pub Step 2: Create assh keyssh-keygen -t rsa -b 1024 -C bchoi Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): /home/bchoi/.ssh/id_rsa/home/bchoi/.ssh/id_rsa already exists.Overwrite (y/n)? yEnter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in /home/bchoi/.ssh/id_rsaYour public key has been saved… Read More Ansible – Generate ssh key and add to controlled nodes

Python – assign multiple variables to items in a list or a range

To make a dictionary of the same values with unique keys. for x in range(1, 5):… d[“device{0}”.format(x)] = “router”…d{‘device1’: ‘router’, ‘device2’: ‘router’, ‘device3’: ‘router’, ‘device4’: ‘router’} =================================================== Use exec commmand and f string formatting (for Python 3.6+) for x in range(5):… exec(f’device{x} = “switch”‘)…print(device0)switchprint(device1)switchprint(device2)switchprint(device3)switchprint(device4)switch for x in range(5):… exec(“device” + str(x) + ” = ‘switch’”)…print(device0)switchprint(device1)switchprint(device2)switchprint(device3)switchprint(device4)… Read More Python – assign multiple variables to items in a list or a range

Linux – Get Default GW and DNS information

To get the Default Gateway IP address of Linux Using netstat method [bchoi@ubuntu20s1 ~]$ netstat -rnKernel IP routing tableDestination Gateway Genmask Flags MSS Window irtt Iface0.0.0.0 10.11.12.1 0.0.0.0 UG 0 0 0 ens19210.11.12.0 0.0.0.0 255.255.255.192 U 0 0 0 ens192172.172.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0172.182.0.0 172.192.71.1 255.255.0.0 UG 0 0 0 ens224172.192.71.0 0.0.0.0… Read More Linux – Get Default GW and DNS information

Ansible test drive – Create and delete files on multiple servers [Day 2]

Create inventory file Inventory file: root@u20s0:~/ansible# cat inventory[all]u20s1 ansible_ssh_host=192.168.30.191u20s2 ansible_ssh_host=192.168.30.192u20db1 ansible_ssh_host=192.168.30.193u20db2 ansible_ssh_host=192.168.30.194[web]u20s1u20s2[db]u20db1u20db2[backup]u20db2 2. To create files on servers, run the ansible-playbook root@u20s0:~/ansible# ansible-playbook -i /root/ansible/inventory 2-1-tasks.yml -e file_state=touch -i option = tells the ansible where the inventory file reside, otherwise it will default (use) to “/etc/ansible/hosts” -e option = environmental variable, in this case sets… Read More Ansible test drive – Create and delete files on multiple servers [Day 2]

QoS note

http://searchunifiedcommunications.techtarget.com/tip/DiffServ-QoS-model-works-wonders-for-VoIP-networks   QoS Models – Voice load and voice application data (traffic) tolerate minimal variation in delay, packet loass or jitter. The voice quality degradation is immediately felt by the users. QoS is a tool which can be impletmented to effectively transport voice traffice over IP, which gives voice traffic priority over other traffic. 1.… Read More QoS note