-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
Before you do anything the best thing to do is clone a fork of this repository.
Please note that running this project is destructive, it will overwrite configuration and install applications, potentially different versions than the ones you already have. Therefore it is recommended to run this against a fresh install of a Debian-based Linux. I am using Ubuntu Bionic.
Once you have your own forked copy cloned the first place you want to take a look at is setup.yml, this contains a list of ansible tasks. When you run ansible each of the included tasks is run.
I would suggest you start by commenting out all but the base task and running ansible with:
ansible-playbook -K setup.yml
Take a look at tasks/base.yml and you will see the basic pattern for a task. Each item in the file starts with a name and then uses one of the core ansible modules to perform some work, such as installing a package or copying a configuration file.
All configuration files are templates and can use variables set within vars.yml
and the task yaml file itself.
The ansible apt module lets you install packages using apt-get:
- name: Install ectkeeper
apt: name=etckeeper state=installed
This is how most software is installed.
Sometimes a package is not available in the standard Ubuntu repositories and there is no PPA either.
- name: install Git Kraken
sudo: true
apt: deb=https://release.gitkraken.com/linux/gitkraken-amd64.deb state=installed
Often there is no deb package and a single binary is download from a URL.
- name: Install selecta
sudo: false
get_url: url=https://raw.githubusercontent.com/garybernhardt/selecta/master/selecta dest=/home/{{user}}/bin/selecta mode=u+x
(note ~/bin
is in the $PATH)
- name: Install latest chromium package with codecs
apt: pkg="{{ item }}" state=present force=yes
with_items:
- chromium-browser
- chromium-browser-l10n
- chromium-codecs-ffmpeg-extra
---
- name: Add Yubikey PPA
apt_repository: repo=ppa:yubico/stable
sudo: true
- name: Install Yubikey
apt: name=yunikey-neo-manager
or
- name: Add skype-wrapper repository
apt_repository: repo="deb http://archive.canonical.com/ xenial partner"
sudo: true
- name: Copy .tmux.conf
sudo: false
template: src=templates/tmux.conf dest=~/.tmux.conf
If you change any configuration files don't forget to copy those changes back to this project and commit and push. I usually make changes to the real configuration files, say ~/.zshrc
, and once I'm happy I can cp ~/.zshrc ~/dev/ansible-desktop/templates/zshrc
, commit and push.
- name: Launcher minimise on click
sudo: false
command: "gsettings set org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/ launcher-minimize-window true"
Most of ansible modules will be a no-op if the action has already been performed, for example the apt module will only install an application if it is not already in the desired state, e.g. state=installed
.
There are times when you want to run a command only after another action was performed. Any action can register itself under a name, other actions can then use when
to determine if the action was run.
- name: Install NeoVIM
apt: name=...
register: neovim_configuration_installed
- name: Install NeoVIM plugins
sudo: false
command: nvim -c "PlugInstall | qa!"
when: neovim_configuration_installed.changed
For a more complicated example where we download, untar and compile see the ruby-install.yml task.