From 20814f5f16800dbf7956ccf8aa16eb972aeade1c Mon Sep 17 00:00:00 2001 From: Avesh Agarwal Date: Thu, 13 Aug 2015 18:17:11 -0400 Subject: Added README_ANSIBLE.md file that contains instructions to build and run ansible in a docker container, and also modified Dockerfile to replace CMD with ENTRYPOINT to run the container as executable. --- Dockerfile | 15 --------------- README_ANSIBLE.md | 18 ++++++++++++++++++ ansible-container/Dockerfile | 15 +++++++++++++++ 3 files changed, 33 insertions(+), 15 deletions(-) delete mode 100644 Dockerfile create mode 100644 README_ANSIBLE.md create mode 100644 ansible-container/Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 7fca42b9b..000000000 --- a/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM rhel7 - -MAINTAINER Aaron Weitekamp - -RUN yum -y install http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - -# Not sure if all of these packages are necessary -# only git and ansible are known requirements -RUN yum install -y --enablerepo rhel-7-server-extras-rpms net-tools bind-utils tmux git ansible - -RUN git clone https://github.com/openshift/openshift-ansible.git /opt/openshift-ansible - -CMD ansible-playbook /opt/openshift-ansible/playbooks/byo/config.yml - -LABEL RUN docker run -it --rm --privileged --net=host -v ~/.ssh:/root/.ssh -v /etc/ansible/hosts:/etc/ansible/hosts --name NAME -e NAME=NAME -e IMAGE=IMAGE IMAGE diff --git a/README_ANSIBLE.md b/README_ANSIBLE.md new file mode 100644 index 000000000..19e32d342 --- /dev/null +++ b/README_ANSIBLE.md @@ -0,0 +1,18 @@ +# Running ansible in a docker container +* Building ansible container: + + ```sh + git clone https://github.com/openshift/openshift-ansible.git + cd openshift-ansible/ansible-container + docker build --rm -t ansible . + ``` +* Create /etc/ansible directory on the host machine and copy inventory file (hosts) into it. +* Copy ssh public key of the host machine to master and nodes machines in the cluster. +* Running the ansible container: + + ```sh + docker run -it --rm --privileged --net=host -v ~/.ssh:/root/.ssh -v /etc/ansible:/etc/ansible ansible + ``` + + + diff --git a/ansible-container/Dockerfile b/ansible-container/Dockerfile new file mode 100644 index 000000000..477ea6712 --- /dev/null +++ b/ansible-container/Dockerfile @@ -0,0 +1,15 @@ +FROM rhel7 + +MAINTAINER Aaron Weitekamp + +RUN yum -y install http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + +# Not sure if all of these packages are necessary +# only git and ansible are known requirements +RUN yum install -y --enablerepo rhel-7-server-extras-rpms net-tools bind-utils tmux git ansible + +RUN git clone https://github.com/openshift/openshift-ansible.git /opt/openshift-ansible + +ENTRYPOINT ["/usr/bin/ansible-playbook", "/opt/openshift-ansible/playbooks/byo/config.yml"] + +LABEL RUN docker run -it --rm --privileged --net=host -v ~/.ssh:/root/.ssh -v /etc/ansible:/etc/ansible --name NAME -e NAME=NAME -e IMAGE=IMAGE IMAGE -- cgit v1.2.3