Contents:
pssh commands
parallel-ssh -i -h sshhosts.txt df -ht ext4
parallel-slurp -h sshhosts.txt -L host-files/ /etc/group group
/etc/ansible/hosts edit for Python
sudo nano /etc/ansible/hosts
10.0.3.93 ansible_python_interpreter=/usr/bin/python3
10.0.3.43 ansible_python_interpreter=/usr/bin/python3
Ansible webserver playbook
---
- hosts: all
become: true
tasks:
- name: Install Apache2
apt: name=apache2 state=present update_cache=yes
- name: ensure Apache2 started
service: name=apache2 state=started enabled=yes
Ansible NTP server playbook
ntp-clients.yml
- hosts: all
tasks:
- name: set timezone
shell: timedatectl set-timezone America/Toronto
become: true
- name: Install NTP
apt: name=ntp state=present
tags: ntp
become: true
- name: Install ntpdate
apt: name=ntpdate state=present
tags: ntpdate
become: true
- name: Copy ntp.conf file
template: src=/home/ubuntu/ntp.conf dest=/etc/ntp.conf
notify:
- restart ntp
tags: ntp
become: true
- name: Stop NTP
service: name=ntp state=stopped enabled=yes
tags: ntp
become: true
- name: Sync initial time
shell: ntpdate 10.0.3.140
tags: ntp
become: true
- name: Restart NTP
service: name=ntp state=running enabled=yes
tags: ntp
become: true
- name: Sync hwclock
shell: hwclock -w
tags: ntp
become: true
handlers:
- name: restart ntp
service: name=ntp state=restarted
become: true
LXD networking commands
sudo lxc network show lxdbr0
sudo lxc network create testbr0 ipv6.address=none ipv4.address=10.0.4.1/24 ipv4.nat=true
sudo lxc network attach testbr0 demo default eth2
LXD storage pool commands
sudo lxc storage volume attach MyPool myvolume demo data /home/me/data
sudo lxc launch images:ubuntu/bionic myUbuntu -s mypool
sudo lxc storage volume attach MyPool myvolume myUbuntu data /home/ubuntu/mydata
udev rule for renaming network interface
ACTION=="add", SUBSYSTEM=="net",ATTR{address}=="08:00:27:f8:a1:df",NAME="eth3"