Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env bash
# In OpenShift, docker containers are run as a random high number uid
# that doesn't exist in /etc/passwd, but some programs
# require a named user. So if we're in OpenShift, we need to make
# one before Ansible runs.
if [ `id -u` -ge 500 ]; then
echo "runner:x:`id -u`:`id -g`:,,,:/runner:/bin/bash" > /tmp/passwd
cat /tmp/passwd >> /etc/passwd
rm /tmp/passwd

This comment has been minimized.

Copy link
Owner Author

@flickerfly flickerfly commented Aug 20, 2019

The above names the user running the container runner because I found this example in the Ansible Operator created by operator-sdk. That can of course, be changes to whatever user you like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment