These tasks
-
name: Create Jenkins data directory on host
file: “path=/home/{{ansible_ssh_user}}/.jenkins state=directory mode=0777” -
name: Jenkins data directory
shell: “docker create -v {{ansible_env.HOME}}/.jenkins:/var/jenkins_home --name jenkins.data mediaplayout/jenkins”
sudo: yes -
name: Run Jenkins container
shell: docker run -d -p 8080:8080 -p 50000:50000 --volumes-from jenkins.data --name jenkins.master mediaplayout/jenkins
sudo: yes
generates a docker container with a volume that is shared with the host at ~/.jenkins
These tasks:
-
name: Create Jenkins data directory on host
file: “path=/home/{{ansible_ssh_user}}/.jenkins state=directory mode=0777” -
name: Jenkins data directory
docker:
name: jenkins.data
image: mediaplayout/jenkins
state: present
volumes: “/home/{{ansible_ssh_user}}/.jenkins:/var/jenkins_home”
sudo: yes -
name: Start Jenkins container
docker:
name: jenkins.master
image: mediaplayout/jenkins
pull: always
state: started
volumes_from: -
‘jenkins.data’
ports: -
8080:8080
-
50000:50000
sudo: yes
don’t shared the directory at that location
Is the second playbook correct or is there a issue with the Ansible docker module?