Skip to content

baztian/ansible-mint-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Mint setup

CI

Ansible playbook whose aim is to save time setting up my Linux Mint XFCE machines.

Ansible installation

Setup ansible on the host (not VM guest).

sudo -s
apt update
apt install -y python3-venv libssl-dev python3-dev
python3 -m venv /opt/ansible-2.8.5
. /opt/ansible-2.8.5/bin/activate
pip install wheel
pip install ansible==2.8.5
deactivate
ln -sf /opt/ansible-2.8.5/bin/ansible-playbook /usr/local/bin/
exit

Usage

Install on local machine using ansible-pull.

ansible-pull -U https://github.com/baztian/ansible-mint-setup.git -i local playbook.yml -K

Install on local machine using stock ansible.

ansible-playbook playbook.yml -i local -K

Install but skip some steps.

ansible-playbook playbook.yml -i local -K --skip-tags xfce,calibre,eac,spotify,multimedia,squeezeplay

Force upgrade required roles.

ansible-galaxy install -f -r requirements.yml

Manual steps while running the Linux Mint installer

  1. Start Install Linux Mint
  2. English
  3. German - German (no dead keys)
  4. Install third-party
  5. Erase disk plus Encrypt plus LVM
  6. Generate Security Key in KeePass
  7. Berlin
  8. Name <Firstname> <Lastname>
  9. Computer's name vbox
  10. Username <myuser>
  11. Require login

Testing

Before setting up a real machine I usually try this on up a VirtualBox (see below). Once set up I can test the ansible playbook.

ansible-playbook playbook.yml -i vbox -K

To easily create a new VM from scratch I use these commands. (Heavily inspired by https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html)

ISO=/path/to/linux_mint.iso
VM='LinuxMint'
MEDIUM="$HOME/VirtualBox VMs/$VM/$VM.vdi"
VBoxManage createvm --name $VM --ostype "Ubuntu_64" --register
VBoxManage createhd --filename "$MEDIUM" --size 32768
VBoxManage storagectl $VM --name "SATA Controller" --add sata \
 --controller IntelAHCI
VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 \
 --device 0 --type hdd --medium "$MEDIUM"
VBoxManage storagectl $VM --name "IDE Controller" --add ide
VBoxManage storageattach $VM --storagectl "IDE Controller" --port 0 \
 --device 0 --type dvddrive --medium $ISO
VBoxManage modifyvm $VM --ioapic on
VBoxManage modifyvm $VM --boot1 dvd --boot2 disk --boot3 none --boot4 none
VBoxManage modifyvm $VM --memory 4096 --vram 128
# Port forwarding 3222 for ssh
VBoxManage modifyvm $VM --natpf1 "guestssh,tcp,,3222,,22"

Now start the VM.

VBoxManage startvm $VM

Or start headless and connect to localhost:3389 via vnc

# enable VNC server on port 3389
VBoxManage modifyvm $VM --vrde on
# set VNC password
VBoxManage modifyvm $VM --vrdeproperty VNCPassword=secret
VBoxHeadless -s $VM

Run through the installer. Set up using the description below.

Setup SSH server on the VM.

sudo apt install -y openssh-server

Setup SSH authorized keys and configure vbox alias.

ssh-copy-id -p 3222 -o IdentitiesOnly=yes -i ~/.ssh/id_rsa localhost
cat >> ~/.ssh/config <<HERE
Host vbox
  HostName localhost
  Port 3222
  IdentityFile ~/.ssh/id_rsa.pub
  IdentitiesOnly yes
HERE

Install the guest additions.

VBoxManage storageattach $VM --storagectl "IDE Controller" --port 0 \
 --device 0 --type dvddrive --medium /usr/share/virtualbox/VBoxGuestAdditions.iso
ssh vbox
user@vbox$ sudo mount /dev/cdrom /media && sudo /media/VBoxLinuxAdditions.run
user@vbox$ sudo shutdown -h now

Now it's time to take a snapshot.

VBoxManage snapshot $VM take installer_finished

Try the ansible script. If you want to start from the previous state again run

VBoxManage snapshot $VM restore installer_finished

Customization and development notes

The following notes might help you in developing and customizing the roles.

Identifying xfconf properties

To browse Xfce configuration use xfce4-settings-editor.

You can monitor so called channels from the command line with the -m switch of xfconf-query.

xfconf-query # list all channels available
xfconf-query -m -c xfce4-desktop -v

To monitor all available channels use this one liner.

for i in $(xfconf-query); do (xfconf-query -m -c $i -v |awk '{print "'$i' " $0}' &) ;done

You can cancel monitoring by issuing

killall xfconf-query

Role dependencies

This playbook depends on several roles.

Galaxy Role Github Role
baztian.apt_upgrade CI
baztian.git CI
baztian.asdf CI
baztian.docker CI
baztian.vscode CI
baztian.python CI
baztian.pip_venv CI
baztian.adr_tools CI
baztian.dev_tools CI
baztian.java CI
baztian.aws CI
baztian.keepass CI
baztian.calibre CI
baztian.joplin CI
baztian.gocryptfs CI
baztian.emacs CI
baztian.jetbrains_toolbox CI
baztian.js CI
baztian.jython CI
baztian.other_installs CI
baztian.multimedia CI
baztian.squeezeplay CI
baztian.skype CI
baztian.xfce CI
baztian.signal CI
baztian.vagrant CI
baztian.eac CI

About

Ansible playbook for my Linux Mint setup

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published