ansible: simplify playbook execution and update README

This commit is contained in:
Fernando Schauenburg 2020-12-22 14:44:09 +01:00
parent 7cf5ac21ed
commit ae26678665
2 changed files with 40 additions and 25 deletions

View file

@ -1,33 +1,46 @@
# Prerequisites # Prerequisites
* [ansible][]: for installing the dofiles. Only [ansible][] is required for installing the dotfiles.
* [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)_.
# Installation _NOTE:_ [git-crypt][] and [gpg][] are needed to decrypt sensitive information
in the repository, but these are installed by the [ansible
Steps: playbook](local.yml).
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 -
```
[ansible]: https://www.ansible.com [ansible]: https://www.ansible.com
[git-crypt]: https://github.com/AGWA/git-crypt [git-crypt]: https://github.com/AGWA/git-crypt
[gpg]: https://gnupg.org [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 -
```

View file

@ -1,4 +1,6 @@
[defaults] [defaults]
interpreter_python = auto_silent interpreter_python = auto_silent
inventory = ./inventory
nocows = True nocows = True
roles_path = ./roles