From ae26678665585ddef036a296e818f0220313cb89 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Tue, 22 Dec 2020 14:44:09 +0100 Subject: [PATCH] ansible: simplify playbook execution and update README --- README.md | 63 ++++++++++++++++++++++++++++++++--------------------- ansible.cfg | 2 ++ 2 files changed, 40 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 9e1dc26..dd58c50 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,46 @@ # Prerequisites -* [ansible][]: for installing the dofiles. -* [git-crypt][]: for handling sensitive data in the repo - _(installed via ansible cookbook)_. -* [gpg][]: for decrypting the key used by `git-crypt` - _(installed via ansible cookbook)_. +Only [ansible][] is required for installing the dotfiles. -# Installation - -Steps: -1. Install [ansible][]. -1. Create an SSH key with (e.g. with - `ssh-keygen -t ed25519 -C "$(whoami)@$(hostname)"`) and register it. -1. Add a preliminary `~/.ssh/config` to reach `git.schauenburg.me` at the correct port. -1. Clone the repo. -1. Play the `dotfiles.yml` ansible playbook. -1. Decrypt key & initialize git-crypt to access sensitive data. - -Cookbook: -```bash -sudo apt-get install ansible -echo -e "Host git.schauenburg.me\nUser git\nPort 587" >>~/.ssh/config -git clone git@git.schauenburg.me:fernando/dotfiles.git $HOME/.dotfiles -cd $HOME/.dotfiles -ansible-playbook -i inventory dotfiles.yml -gpg -d --output - <(base64 -d .key) | git crypt unlock - -``` +_NOTE:_ [git-crypt][] and [gpg][] are needed to decrypt sensitive information +in the repository, but these are installed by the [ansible +playbook](local.yml). [ansible]: https://www.ansible.com [git-crypt]: https://github.com/AGWA/git-crypt [gpg]: https://gnupg.org +## Install ansible on Linux + +```bash +sudo apt install -y python3 +pyhton3 -m pip install ansible +``` + +## Install ansible on macOS + +```bash +brew install ansible +``` + +# Installation + +Steps: +1. Create an SSH key with (e.g. with + `ssh-keygen -t ed25519 -C "$(whoami)@$(hostname)"`) and register it. +1. Add a preliminary `~/.ssh/config` to reach `git.schauenburg.me` at the correct port. +1. Clone the repo. +1. Play the `local.yml` ansible playbook. +1. Decrypt key & initialize git-crypt to access sensitive data. + + +Gimme the code: +```bash +ssh-keygen -t ed25519 -C "$(whoami)@$(hostname)" +echo -e "Host git.schauenburg.me\nUser git\nPort 587" >>~/.ssh/config +git clone git@git.schauenburg.me:fernando/dotfiles.git $HOME/.dotfiles +cd $HOME/.dotfiles +ansible-playbook local.yml +gpg -d --output - <(base64 -d .key) | git crypt unlock - +``` + diff --git a/ansible.cfg b/ansible.cfg index c39516a..313fa92 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,4 +1,6 @@ [defaults] interpreter_python = auto_silent +inventory = ./inventory nocows = True +roles_path = ./roles