Notes when not using a ssh key for authentication

Fixed small typo, added an extra note on how to use the ansible docker image when not using a ssh key for authentication
This commit is contained in:
Hanno J. Gödecke 2020-01-03 15:58:08 +01:00 committed by GitHub
parent 92859e1817
commit a6f85df295
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,4 @@
# Running this playbook # Running this playbook
This playbook is meant to be run using [Ansible](https://www.ansible.com/). This playbook is meant to be run using [Ansible](https://www.ansible.com/).
@ -18,7 +19,7 @@ If you're on Ansible 2.5.x, due to bugs in Ansible 2.5.0 and 2.5.1, at least Ans
In most cases, you won't need to worry about the Ansible version. In most cases, you won't need to worry about the Ansible version.
The playbook will try to detect it and tell you if you're on an unsupported version. The playbook will try to detect it and tell you if you're on an unsupported version.
To manually check which verison of Ansible you're on, run: `ansible --version`. To manually check which version of Ansible you're on, run: `ansible --version`.
If you're on an old version of Ansible, you should [upgrade Ansible to a newer version](#upgrading-ansible) or [use Ansible via Docker](#using-ansible-via-docker). If you're on an old version of Ansible, you should [upgrade Ansible to a newer version](#upgrading-ansible) or [use Ansible via Docker](#using-ansible-via-docker).
@ -55,9 +56,18 @@ devture/ansible:2.8.1-r0
The above command tries to mount an SSH key (`$HOME/.ssh/id_rsa`) into the container (at `/root/.ssh/id_rsa`). The above command tries to mount an SSH key (`$HOME/.ssh/id_rsa`) into the container (at `/root/.ssh/id_rsa`).
If your SSH key is at a different path (not in `$HOME/.ssh/id_rsa`), adjust that part. If your SSH key is at a different path (not in `$HOME/.ssh/id_rsa`), adjust that part.
If you don't use SSH keys for authentication, simply remove that whole line (`-v $HOME/.ssh/id_rsa:/root/.ssh/id_rsa:ro`).
Once you execute the above command, you'll be dropped into a `/work` directory inside a Docker container. Once you execute the above command, you'll be dropped into a `/work` directory inside a Docker container.
The `/work` directory contains the playbook's code. The `/work` directory contains the playbook's code.
You can execute `ansible-playbook` commands as per normal now. You can execute `ansible-playbook` commands as per normal now.
### If you don't use SSH keys for authentication
If you don't use SSH keys for authentication, simply remove that whole line (`-v $HOME/.ssh/id_rsa:/root/.ssh/id_rsa:ro`).
To authenticate at your server using a password, you need to add a package. So, when you are in the shell of the ansible docker container (previous used `docker run -it ...`), run:
```bash
apk add sshpass
```
Then, to be asked for the password whenever running an `ansible-playbook` command add `--ask-pass` to the arguments of the command.