Updated after trying out @konstantin-suvorov solution. Now it doesn't do anything.
I have created 5 Vagrant VMs, all from bento/xenial64 and have then used Ansible to deploy docker onto all of the machines.
When I then attempt to use Ansible to deploy a container onto a remote VM, it says that it has done it, but the container is running on the local machine.
My 4 machines are: control cluster01 cluster02 cluster03 cluster04
Docker is up and running on all 5
From VM control, I run
ansible-playbook -i hosts/local jenkins.yml
My inventory file is
[control]
10.100.100.100
[cluster]
10.100.100.101
10.100.100.102
10.100.100.103
10.100.100.104
[master]
10.100.100.101
This is my Jenkins playbook
---
- hosts: master
remote_user: ubuntu
serial: 1
roles:
- jenkins
and this is my jenkins role
---
- name: Container is running
docker_container:
name: jenkins
image: "jenkins:{{ jenkins_version }}"
ports: 8080:8080
volumes:
- "{{ jenkins_home_dir }}:/var/jenkins_home"
After running the ansible-playbook, with very very very verbose option, and adding inventory for the vagrant machines,
vagrant@control:/vagrant$ ansible-playbook -i hosts/local jenkins.yml -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory -vvvv
Using /vagrant/ansible.cfg as config file
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/__init__.pyc
PLAYBOOK: jenkins.yml **********************************************************
1 plays in jenkins.yml
PLAY RECAP *********************************************************************
What am I doing wrong?