usage 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash -e
  2. cat <<"EOF"
  3. The origin-ansible image provides several options to control the behaviour of the containers.
  4. For more details on these options see the documentation:
  5. https://github.com/openshift/openshift-ansible/blob/master/README_CONTAINER_IMAGE.md
  6. At a minimum, when running a container using this image you must provide:
  7. * ssh keys so that Ansible can reach your hosts. These should be mounted as a volume under
  8. /opt/app-root/src/.ssh
  9. * An inventory file. This can be mounted inside the container as a volume and specified with the
  10. INVENTORY_FILE environment variable. Alternatively you can serve the inventory file from a web
  11. server and use the INVENTORY_URL environment variable to fetch it.
  12. * The playbook to run. This is set using the PLAYBOOK_FILE environment variable.
  13. Here is an example of how to run a containerized origin-ansible with
  14. the openshift_facts playbook, which collects and displays facts about your
  15. OpenShift environment. The inventory and ssh keys are mounted as volumes
  16. (the latter requires setting the uid in the container and SELinux label
  17. in the key file via :Z so they can be accessed) and the PLAYBOOK_FILE
  18. environment variable is set to point to the playbook within the image:
  19. docker run -tu `id -u` \
  20. -v $HOME/.ssh/id_rsa:/opt/app-root/src/.ssh/id_rsa:Z,ro \
  21. -v /etc/ansible/hosts:/tmp/inventory:Z,ro \
  22. -e INVENTORY_FILE=/tmp/inventory \
  23. -e OPTS="-v" \
  24. -e PLAYBOOK_FILE=playbooks/byo/openshift_facts.yml \
  25. docker.io/openshift/origin-ansible
  26. EOF