This Ansible playbook automates many of the (my) tasks whenever starting with a fresh OS installation or new computer.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

188 lines
4.4 KiB

# Ansible Playbook for Bootstrapping a (new) Personal Computer
- name: Bootstrap personal computer
hosts: localhost
connection: local
become: true
vars:
tmp_dir: /tmp/ansible/bootstrap
tasks:
- name: Make temporary directory
become: false
file:
path: "{{ tmp_dir }}"
state: directory
- name: Download AnyDesk
get_url:
url: https://anydesk.com/en/downloads/thank-you?dv=deb_64
dest: "{{ tmp_dir }}/anydesk.deb"
- name: Download argocd
get_url:
url: https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
dest: /usr/local/bin/argocd
mode: 0755
- name: Download Chia light wallet
get_url:
url: https://download.chia.net/latest/x86_64-Ubuntu-gui
dest: "{{ tmp_dir }}/chia_blockchain.deb"
- name: Download Discord
get_url:
url: https://discordapp.com/api/download?platform=linux&format=deb
dest: "{{ tmp_dir }}/discord.deb"
- name: Download yq
get_url:
url: https://github.com/mikefarah/yq/releases/download/v4.18.1/yq_linux_amd64
dest: /usr/local/bin/yq
mode: 0755
- name: Add APT keys
apt_key:
url: "{{ item }}"
loop:
- "https://download.docker.com/linux/ubuntu/gpg"
- "https://packages.cloud.google.com/apt/doc/apt-key.gpg"
- name: Add APT repositories
apt_repository:
repo: "{{ item }}"
loop:
- "deb [arch=amd64 trusted=yes] https://download.docker.com/linux/ubuntu focal stable"
- "deb [arch=amd64 trusted=yes] https://apt.kubernetes.io/ kubernetes-xenial main"
- name: Install Python packages
pip:
name:
- boto3
- catt
- pytest
- regex
- requests
- name: Install packages
apt:
pkg:
- ansible # so meta!
- apt-transport-https
- audacity
- bash-completion
- bc
- ca-certificates
- cmake
- containerd.io
- curl
- dino-im
- dnsutils
- docker-ce
- docker-ce-cli
- dos2unix
- fd-find
- file
- fzf
- gimp
- git
- gnome-tweak-tool
- gnome-tweaks
- gpg
- jq
- keepassxc
- kubectl
- libreoffice
- lmms
- mixxx
- netcat
- nmap
- obs-studio
- pandoc
- python3-pip
- qpdf
- syncthing
- tar
- tcpdump
- texlive
- traceroute
- unzip
- vim
- vlc
- wget
- whois
- wireshark
- youtube-dl
- zip
- name: Install deb packages
apt:
deb: "{{ item }}"
loop:
- https://github.com/sharkdp/bat/releases/download/v0.19.0/bat_0.19.0_amd64.deb
- https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
- https://go.skype.com/skypeforlinux-64.deb
- https://repo.steampowered.com/steam/archive/stable/steam_latest.deb
- https://download.sublimetext.com/sublime-text_build-3211_amd64.deb
- https://zoom.us/client/latest/zoom_amd64.deb
- name: Install Zerotier
args:
warn: false # to suppress warning suggesting usage of `get_url` module
shell: curl -s https://install.zerotier.com | sudo bash
- name: Download and unarchive aws (CLI) and helm
unarchive:
remote_src: yes
src: "{{ item }}"
dest: "{{ tmp_dir }}"
loop:
- https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
- https://get.helm.sh/helm-v3.8.0-linux-amd64.tar.gz
- name: Install AWS CLI
command: "{{ tmp_dir }}/aws/install --update"
- name: Download and unarchive terraform
unarchive:
remote_src: yes
src: https://releases.hashicorp.com/terraform/1.1.4/terraform_1.1.4_linux_amd64.zip
dest: /usr/local/bin/
- name: Move helm into path
copy:
src: "{{ tmp_dir }}/linux-amd64/helm"
dest: /usr/local/bin/helm
mode: 0755
- name: Create docker and wireshark groups
group:
name: "{{ item }}"
loop:
- docker
- wireshark
- name: Add user to docker and wireshark groups
user:
name: "{{ lookup('env', 'USER') }}"
groups: "{{ item }}"
append: yes
loop:
- docker
- wireshark
- name: Enable and start service docker
service:
name: docker
enabled: yes
state: started
- name: Enable and start service syncthing
service:
name: "syncthing@{{ lookup('env', 'USER') }}"
enabled: yes
state: started
- name: Remove temporary directory
file:
path: "{{ tmp_dir }}"
state: absent