Преглед изворни кода

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.

Avesh Agarwal пре 9 година
родитељ
комит
20814f5f16
2 измењених фајлова са 20 додато и 2 уклоњено
  1. 18 0
      README_ANSIBLE.md
  2. 2 2
      Dockerfile

+ 18 - 0
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
+  ```
+
+
+ 

+ 2 - 2
Dockerfile

@@ -10,6 +10,6 @@ RUN yum install -y --enablerepo rhel-7-server-extras-rpms net-tools bind-utils t
 
 RUN git clone https://github.com/openshift/openshift-ansible.git /opt/openshift-ansible
 
-CMD ansible-playbook /opt/openshift-ansible/playbooks/byo/config.yml
+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/hosts:/etc/ansible/hosts --name NAME -e NAME=NAME -e IMAGE=IMAGE IMAGE
+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