Ansible – 1 – Setting Up Workspace


Ansible is configuration management tool.Its need no agent.

Lets setup ansible create workspace

brew install ansible

brew cask install virtualbox

brew cask install vagrant
brew cask install vagrant-manager

$ mkdir ansible/ext1/playbooks
$ cd playbooks
$ vagrant init ubuntu/trusty64
$ vagrant up

You should be able to SSH into your new Ubuntu 14.04 virtual machine by running:
$ vagrant ssh

Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-133-generic x86_64)

if you run the

$vagrant ssh-config
Host default
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/abdullaheroglu/psp-deployment/ansible-workspace/ex1/playbooks/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL

You can also connect to vargant host via ssh

ssh vagrant@ -p 2222 -i /Users/abdullaheroglu/psp-deployment/ansible-workspace/ex1/playbooks/.vagrant/machines/default/virtualbox/private_key

Next post we will define the hosts.



MacOsx Docker Start and Stop


#!/usr/bin/env bash

case $1 in
    echo $'usage: docker-start\n\nStarts Docker ( on macOS and waits until the Docker environment is initialized.'
    exit 0
(( $# )) && { echo "ARGUMENT ERROR: Unexpected argument(s) specified. Use -h for help." >&2; exit 2; }

[[ $(uname) == 'Darwin' ]] || { echo "This function only runs on macOS." >&2; exit 2; }

echo "-- Starting, if necessary..."

open -g -a || exit

# Wait for the server to start up, if applicable.  
while ! docker system info &>/dev/null; do
  (( i++ == 0 )) && printf %s '-- Waiting for Docker to finish starting up...' || printf '.'
  sleep 1
(( i )) && printf '\n'

echo "-- Docker is ready."


#!/usr/bin/env bash

case $1 in
    echo $'usage: docker-stop\n\nStops Docker ( on macOS.'    
    exit 0
(( $# )) && { echo "ARGUMENT ERROR: Unexpected argument(s) specified. Use -h for help." >&2; exit 2; }

[[ $(uname) == 'Darwin' ]] || { echo "This function only runs on macOS." >&2; exit 2; }

echo "-- Quitting, if running..."

osascript - <<'EOF' || exit
tell application "Docker"
  if it is running then quit it
end tell

echo "-- Docker is stopped."
echo "Caveat: Restarting it too quickly can cause errors."

Setting up Docker Private Registry

create a folder which name is docker-private-registry

then install docker compose

pip install docker-compose

then create the docker-compose.yml

image: registry
– STORAGE_PATH=/registry
– registry-stuff:/registry
– “5000:5000”

run the compose file with

docker-compose up

then you will see the blank page when you visit http://localhost:5000

private registry is done but i found the nice ui for registry


How To Dockerize Jenkins

create a sample directory  with mkdir jenkinsci and create a new Dockerfile

cd jenkinsci

touch Dockerfile


FROM jenkins:2.0

USER root
RUN apt-get update \
&& apt-get install -y sudo \
&& rm -rf /var/lib/apt/lists/*
RUN echo “jenkins ALL=NOPASSWD: ALL” >> /etc/sudoers

USER jenkins
COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/ /usr/share/jenkins/plugins.txt

then create a plugins.txt file for jenkins plugins


save it then build the jenkins image

sudo docker build -t jenkinsci .

now we must to run container

sudo docker run -d -v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):/usr/bin/docker -p 8080:8080 jenkinsci

by the way we mapped docker socket ,binary  for running docker commands in container

this command will return container job id. Dont clear the console!

when you visit the http://localhost:8080 you will see the jenkins default login screen


you can find the administator password with

docker logs <job_id>


Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:


You can continue the next steps then you will see the Jenkins Home screen, then we must the test docker command with docker-test project

  • Create a Freestyle Project
  • Add shell build step then save it
  • sudo docker run hello-world

  • Run the build and look at the build logs

run the build.


Well, you dockerized jenkins 🙂 awesome!  In next chapter we will integrate jenkins volume