Skip to content

Titan-C/archlinux-ansible

Repository files navigation

Provision a local archlinux install

https://travis-ci.org/Titan-C/archlinux-ansible.svg?branch=master

After an incident with my personal PC I came to realize how complicated it was to restore from backup. No work data was lost, I think, but getting my PC into my work-tool is the hard an tedious part. Since I’m now forced to do/install everything again, I rather save the configuration like a system dotfiles. Luckily there exist nowadays configuration managers for this, I just chose ansible because that is the one I’m most familiar.

This is massively inspired/stolen from https://github.com/pigmonkey/spark. It serves as my reference for now. That repo is very advanced for my use case, but maybe as I evolve in my configuration I’ll understand why such repo is like that, for the moment mine is a simpler version for my use case.

Running the playbook

Cloning the repository

Clone either with the recursive flag or afterwards use

git submodule init && git submodule update

Set up the variables

First edit the hosts file to contain the hosts information of the machines to workon

# hosts to configure see readme.org
[laptop]
localhost ansible_connection=local

Then edit the variables for that machine in group_vars/host

Finally make sure that the install.yml playbook will run on the desired host.

Executing the playbook

Run as user with sudo.

ansible-playbook install.yml -i hosts --ask-become-pass

Run as root

ansible-playbook install.yml -i hosts

For a specific tag, e.g. multimedia

ansible-playbook install.yml -i hosts --ask-become-pass  --tags=multimedia

Troubleshooting

This might not work in any clean/new machine yet as there are still some steps that where carried manually when setting up the system. So look around and try.

Raspberry

Change default passwords

The image came with default passwords for root and alarm. Change those.

passwd

Install python

pacman -S python

Wifi

https://blog.desdelinux.net/en/raspberry-pi-conectar-red-wifi/ This is an interactive guide

pacman -Sy dialog wpa_supplicant linux-firmware
wifi-menu -o # Then follow the dialog
netctl enable "created profile"

SSH

mkdir ./ssh
chmod 700 .ssh
nano .ssh/authorized_keys
chmod 400 .ssh/authorized_keys

put ssh keys on user and root, may need to do it manually Be sure you can login

Languages development environments

I somehow feel it is better to have the script to install some dependencies compared to managing with ansible in the case where I can’t install everything with pacman.

Nix

curl -L https://nixos.org/nix/install | sh

Haskell

Just use ghcup https://www.haskell.org/ghcup/

curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

My basic packages

cabal update
cabal install git-annex hledger pandoc ShellCheck
cabal install hlint stylish-haskell stack

Servers

SSH over root and change password and create user

passwd
useradd --create-home deploy
passwd deploy
# Set the new account for a passwordless `sudo`.
echo 'deploy ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/deploy
ssh-copy-id -f -i ~/path/to/pubkep.pub deploy@server

About

Ansible playbook to install my personal computers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published