atosatto / ansible-dockerswarm

Docker Engine clustering using "Swarm Mode" and Ansible
https://galaxy.ansible.com/atosatto/docker-swarm/
MIT License
264 stars 148 forks source link

Q: jmespath issues on #84

Closed paul42 closed 3 years ago

paul42 commented 4 years ago

Hey, first of all, thanks for making this great role! I've got it mostly working but my playbook gets to the verify last step:

TASK [atosatto.docker-swarm : Extract the name of the latest docker-compose release tag.] ******************************
fatal: [swarm-proto-3]: FAILED! => {"msg": "You need to install \"jmespath\" prior to running json_query filter"}
fatal: [swarm-proto-2]: FAILED! => {"msg": "You need to install \"jmespath\" prior to running json_query filter"}
fatal: [swarm-proto-1]: FAILED! => {"msg": "You need to install \"jmespath\" prior to running json_query filter"}

I've tried the following:

  1. running pip install -r requirements.txt after copying your requirements.txt over on my workstation (where I'm launching playbooks from), running straight pip install jmespath==0.9.3
  2. creating a role with a single task of:
    - name: install jmespath==0.9.3 for other role
    pip:
    name: jmespath==0.9.3

    and having it run on the hosts before the dockerswarm role

  3. running playbook multiple times

I apologize I'm very new to ansible/python, is there something I'm doing wrong? something I should be launching?

dev.yaml (inventory)

docker_swarm_manager:
    hosts:
      swarm-proto-1:
        ansible_ssh_host: 10.x.x.x
        swarm_labels: zone1
      swarm-proto-2:
        ansible_ssh_host: 10.x.x.x
        swarm_labels: zone2
      swarm-proto-3:
        ansible_ssh_host: 10.x.x.x
        swarm_labels: zone3

docker-swarm.yml (playbook)

- hosts: docker_swarm_manager
  become: true
  become_user: root
  roles:
    - '../roles/pip-dependencies'
    - atosatto.docker-swarm

and cli that I'm launching as:

ansible-playbook playbooks/docker-swarm.yml -i inventory/dev.yaml  --become-user root --ask-become-pass

I'm able to ssh into the host and can see the other nodes by doing a sudo docker node ls so thanks for making an awesome role :D would just love to figure out what I'm doing wrong on this last step.

Thanks again, Paul

edumgui commented 3 years ago

Hi Paul,

You need to install requirements locally, like:

$ pip install -r /roles/ansible-docker-swarm/requirements.txt
Collecting jmespath==0.9.3
  Downloading jmespath-0.9.3-py2.py3-none-any.whl (23 kB)
Installing collected packages: jmespath
Successfully installed jmespath-0.9.3

Enjoy!

paul42 commented 3 years ago

Thanks, sorry for the slow response on my end