First off, I hope you are doing well 😊.
When it comes to my laptop set up, I care about not having to think too much about my setup between machines. Especially when I want to get right to work, gaming, etc.
For that reason, it is very comfortable for me to have the same base configuration on each machine (look, feel, keyboard shortcuts, core software, etc.).
When I learned about infrastructure as code concept, I thought it would be a fun learning experience to try it on my desktop.
Here is my story of the ways I found to help configure and maintain my desktop configuration.
- I found a cool bash script on the internet (I didn't understand most of it) 🤷
- I modified cool bash script for my needs and it worked! 🚀
- I learned about Makefiles. 😄
- I proceeded to do everything with Makefiles. 🤩🤩🤩
- I got tired of running successive Make targets over and again 😐.
- I used Ansible at work and decided to take a course to learn more about it. 🤓
- I put off actually taking the plunge to use Ansible. 🕒🕕🕘🕛
- I finally took the plunge and decided to use Ansible for my configuration. ✔️
- Ubuntu 18.04
- Ubuntu 20.04
There are no plans to ensure non-LTS versions are supported.
Software support is LTS version dependent.
While these changes don't take long to do, we could have a script check and assert that they are set the way you want, and change them if they are different than your desired state.
Lets get into an example to see why I went this route.
If you have ever install GNOME Tweak Tools, you've been exposed to some of these settings. The Settings application exposes some of them as well.
The settings are organized in a hierarchical manner
- name: GNOME Preferences - Shell - Attach Modal Dialogues dconf: key: "/org/gnome/shell/overrides/attach-modal-dialogs" value: "false" state: present - name: GNOME Preferences - Nautilus - Clock Format dconf: key: "/org/gnome/desktop/interface/clock-format" value: "'24h'" state: present
The two tasks above allow modal dialogues to be moved independently of the application (so you can see what is behind the dialog) and change the clock to 24 hour time.
The underlying tools that manage these settings are
dconf-editor is a graphical application for editing these items.
gsettings is a way to get, set, and query the schema of entries on the command line.
The two Ansible tasks use
dconf to set the value for each key. The
state: present flag tells ansible that we want the key/value pair to be present on our system.
This isn't exactly the list of Ansible roles,
but below is a list of what the software installs.
cherrytree(like OneNote for Linux)
Visual Studio Code,
- kite AI Autocompletion and Docs for Python, runs locally
- carbon-cli for beautiful images of my code - right inside my terminal,
- Flameshot keybinding to the Print Screen key using
- Peek animated GIF screen recorder,
- Postman for API testing,
I use Makefiles to help run existing Ansible roles or scripts to make editing/updating my configuration easier.
To give you a sense of more details around what some of the make targets do, below is my
group_vars/all.yml file at the time of this article.
This file sets global variables for all hosts I want to run the playbook on. In my case, this generally is just the local machine.
--- docker_compose_version: 1.25.4 flameshot_version: 0.6.0 flatpak_applications: - "com.uploadedlobster.peek" # - "com.github.alainm23.planner" # not used - "com.valvesoftware.Steam" - "org.gnome.Evolution" - "ch.protonmail.protonmail-bridge" - "org.libreoffice.LibreOffice" gh_version: 0.7.0 jetbrains_mono_version: 1.0.3 protonmail_bridge_version: 1.2.6-1 nodejs_version: "12.x" nodejs_yarn_global_packages: - name: "@vue/cli" - name: "@gridsome/cli" - name: "nativefier" - name: "markdownlint-cli" - name: "carbon-now-cli" snaps_chat: - "signal-desktop" - "telegram-desktop" snaps_chat_classic: - "slack" snaps_common: - "snap-store" - "breaktimer" - "cherrytree" - "drawio" # https://github.com/jgraph/drawio-desktop/issues/138, # snap 12.6.5 > flatpak 12.4 (as of 2020-02-28) - "spotify" - "ncspot" - "standard-notes" snaps_development: - "postman" snaps_development_classic: - "code" # - "codium" # Code without telemetry - "sublime-text" snaps_web_browsers: - "chromium" - "firefox" snaps_web_browsers_plugs: - plug: "home" app: "chromium" code_extensions: ## Ansible - vscoss.vscode-ansible ## Docker and Remote Development - ms-azuretools.vscode-docker - ms-vscode-remote.remote-containers - ms-vscode-remote.remote-ssh - ms-vscode-remote.remote-ssh-edit # - ms-vscode-remote.remote-wsl - ms-vscode-remote.vscode-remote-extensionpack ## General Development - christian-kohler.path-intellisense - vscode-icons-team.vscode-icons - riccardoNovaglia.missinglineendoffile - shardulm94.trailing-spaces # - Shan.code-settings-sync ## Git Utilities - eamodio.gitlens - donjayamanne.githistory ## Markdown Linting - DavidAnson.vscode-markdownlint ## Python Development - ms-python.python - himanoa.Python-autopep8 - njpwerner.autodocstring - wholroyd.jinja # Pyright Attribution to tiangolo and florimondmanca # https://twitter.com/tiangolo/status/1252891149708275713?s=21 # > Disabled type checking in the extension settings as I rely on mypy, # > but autoimport and unused import colouring alone make it a # > 100% worthwhile companion on VSCode - ms-pyright.pyright ## Spellchecking - streetsidesoftware.code-spell-checker ## Travis-CI # - felixrieseberg.vsc-travis-ci-status # has issues with status resolution ## Vue.js Development - octref.vetur - dbaeumer.vscode-eslint - pranaygp.vscode-css-peek ## YAML - redhat.vscode-yaml # doesn't allow hostname in .travis.yml stacer_version: 1.1.0 zsh_theme: robbyrussell zsh_plugins: - ansible - aws - docker - docker-compose - git - pipenv
For a walk through of my process on existing machine, please visit
For a new machine, I run the following command
to set up my computer:
I like to do this during the initial configuration of the machine.
wget -qO- \ https://github.com/iancleary/ansible-desktop/raw/main/run.sh | \ bash
This will prompt you for your
for the bash script and then once later for
ansible's "BECOME PASSWORD" prompt.
If you want to edit the variables, hit
CTRL + C at
ansible's "BECOME PASSWORD" prompt.
The script created two extra files that ensure that the
ansible-playbook will on your host name.
Note: Both files are intentionally not version controlled.
This allows hostname specific group_vars relative to the playbook.
- a private
#.inventory [$(hostname)] 127.0.0.1
- a group_vars file
# group_vars/$(hostname)/all.yml -------- # You can copy and modify variables over from ../all.yml
Voila (with your edits)! 🚀🚀🚀
Detailed documentation is hosted by Netlify at https://ansible-desktop.iancleary.me.
I hope you enjoyed reading about my desktop configuration and feel free to use/modify/share.
If you like it give it a star ⭐ and let me know if you have any questions!
Especially if you a suggestion for cool application or piece of software you use 😎😎😎.
Edit: Changed default branch from