Nice ansible playbook and supplemental Makefile for bulk change of default username on raspberry pi running on raspbian distribution. It can be easily modified for mass changing passwords on any templated virtual machines or devices.
For use just run:
make rename_pi_user i=10.0.0.1,10.0.0.2,10.0.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import paramiko | |
import os.path | |
parser = argparse.ArgumentParser() | |
parser.add_argument('host', action='store', help='host to connect to') | |
parser.add_argument('-p', '--port', action='store', dest='port', default='22', help='port to connect to') | |
parser.add_argument('--known_hosts', action='store', dest='known_hosts', default='~/.ssh/known_hosts', help='known_hosts file') | |
args = parser.parse_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export MAIN_CONN=enp5s0f0 | |
bash -x <<EOS | |
systemctl stop libvirtd | |
nmcli c delete "$MAIN_CONN" | |
nmcli c delete "Wired connection 1" | |
nmcli c add type bridge ifname br0 autoconnect yes con-name br0 stp off | |
#nmcli c modify br0 ipv4.addresses 192.168.1.99/24 ipv4.method manual | |
#nmcli c modify br0 ipv4.gateway 192.168.1.1 | |
#nmcli c modify br0 ipv4.dns 192.168.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# 1. Place this file to /etc/grub.d/05_Windows | |
# 2. Update Windows patrtition setting. In this example Winodws will be booted from hd0,1 - sda2 partition ("hd0" is sda, and ",1" is second partition on disk) | |
# 3. Add "GRUB_DEFAULT=saved" and "GRUB_SAVEDEFAULT=true" lines to /etc/default/grub for save last booted OS | |
# 4. Run "chmod +x /etc/grub.d/41_Windows && grub2-mkconfig --output=/boot/grub2/grub.cfg" after all modifications for make new config file | |
exec tail -n 5 $0 | |
menuentry "Windows 10" { | |
savedefault | |
set root=(hd0,1) | |
chainloader +1 |
First in a powershell create a new network switch
New-VMSwitch -SwitchName "Hyper-V [VM NAT]" -SwitchType Internal
Get-NetAdapter // (note down ifIndex of the newly created switch as INDEX)
New-NetIPAddress -IPAddress 192.168.0.1 -PrefixLength 24 -InterfaceIndex <INDEX>
New-NetNat -Name HyperV-NATnetwork -InternalIPInterfaceAddressPrefix 192.168.0.0/24
In your ubuntu server open your network netplan