Created
July 23, 2015 13:45
-
-
Save bhcopeland/e10e1a6b435ac9b20263 to your computer and use it in GitHub Desktop.
Docker file to deploy ansible playbook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Builds ubuntu latest image from docker hub | |
# Install and setups ansible | |
# Run from ansible dir: "docker build -t ansible_deploy ." | |
# You will need to update the playbook you deploy in this file. | |
FROM ubuntu | |
MAINTAINER Ben Copeland <[email protected]> | |
RUN apt-get install -y software-properties-common | |
RUN apt-add-repository ppa:ansible/ansible | |
# Update apt cache | |
RUN apt-get -y update | |
RUN apt-get install -y ansible | |
# add playbooks/roles to the image. | |
ADD roles/ /etc/ansible/roles | |
ADD host_vars/ /etc/ansible/host_vars | |
ADD group_vars/ /etc/ansible/group_vars | |
ADD *.yml /etc/ansible/ | |
ADD hosts-deploy /etc/ansible/hosts | |
WORKDIR /etc/ansible | |
# Run ansible using the site.yml playbook | |
#RUN ansible --version | |
# Does a syntax check. Will fail the build if it does not pass. | |
RUN ansible-playbook --syntax-check --list-tasks padpaste-servers.yml -c local | |
# Go wild, run the playbook. | |
RUN ansible-playbook padpaste-servers.yml -c local | |
# Open up some ports to access the build | |
EXPOSE 80 9001 22 | |
# Delete cache (this saves a lot of disk space) | |
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
WORKDIR /srv | |
ENTRYPOINT ["/bin/bash"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment