Explorar el Código

Mention playbook ownership issues when running Ansible in a container and potential workarounds

Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/2248
pull/2249/head
Slavi Pantaleev hace 3 años
padre
commit
06df2df9e9
Se han modificado 1 ficheros con 17 adiciones y 2 borrados
  1. +17
    -2
      docs/ansible.md

+ 17
- 2
docs/ansible.md Ver fichero

@@ -76,7 +76,9 @@ docker.io/devture/ansible:2.13.6-r0
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 ...` (or `ansible-playbook --connection=community.docker.nsenter ...`) commands as per normal now.
First, consider running `git config --global --add safe.directory /work` to [resolve directory ownership issues](#resolve-directory-ownership-issues).

Finally, you can execute `ansible-playbook ...` (or `ansible-playbook --connection=community.docker.nsenter ...`) commands as per normal now.




### Running Ansible in a container on another computer (not the Matrix server) ### Running Ansible in a container on another computer (not the Matrix server)
@@ -98,7 +100,10 @@ If your SSH key is at a different path (not in `$HOME/.ssh/id_rsa`), adjust that
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.
First, consider running `git config --global --add safe.directory /work` to [resolve directory ownership issues](#resolve-directory-ownership-issues).

Finally, you 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


@@ -109,3 +114,13 @@ 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. Then, to be asked for the password whenever running an `ansible-playbook` command add `--ask-pass` to the arguments of the command.



#### Resolve directory ownership issues

Because you're `root` in the container running Ansible and this likely differs fom the owner (your regular user account) of the playbook directory outside of the container, certain playbook features which use `git` locally may report warnings such as:

> fatal: unsafe repository ('/work' is owned by someone else)
> To add an exception for this directory, call:
> git config --global --add safe.directory /work

These errors can be resolved by making `git` trust the playbook directory by running `git config --global --add safe.directory /work`

Cargando…
Cancelar
Guardar