Skip to content

Instantly share code, notes, and snippets.

@flickerfly
Created August 20, 2019 13:55
Show Gist options
  • Save flickerfly/f0f2a07390dfc5f12c4ed9ebe1d7201d to your computer and use it in GitHub Desktop.
Save flickerfly/f0f2a07390dfc5f12c4ed9ebe1d7201d to your computer and use it in GitHub Desktop.
#!/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
fi
@flickerfly
Copy link
Author

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