summaryrefslogtreecommitdiffstats
path: root/ansible/ansible.sh
blob: 7d508332e521c5fe0fef371998ca9a8f92542857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash

set -euo pipefail
IMG=ansible:2.10-cytopia-plus
SSH_ARGS=()

#[[ -n "${SSH_AUTH_SOCK:-}" && -S "$SSH_AUTH_SOCK" ]] && SSH_ARGS=(-v "$SSH_AUTH_SOCK":/ssh-agent -e SSH_AUTH_SOCK=/ssh-agent)



cmd="$(basename "$0")"

exec docker run --rm -it \
  -u "$(id -u):$(id -g)" \
  -v "/root/ands":/root/ands -w /root/ands \
  -v "$HOME/.ssh":/root/.ssh:ro \
  -v "$HOME/.ansible":/root/.ansible \
  "${SSH_ARGS[@]}" \
  "$IMG" "$cmd" "$@"