0

I have created simple task to add key value in Consul but i have error:

    ansible-playbook -i hosts -u siecadm master_playbook.yml

PLAY [consul] **************************************************************************************************************************************

TASK [Gathering Facts] *****************************************************************************************************************************
ok: [lxxxxxx.xxx.rxx.xxx]

TASK [hello_world : Bare include (free-form)] ******************************************************************************************************
ok: [lxxxxxx.xxx.rxx.xxx]

TASK [hello_world : Hello World !!!!] **************************************************************************************************************
changed: [lxxxxxx.xxx.rxx.xxx]

TASK [add_keysValues : Bare include (free-form)] ***************************************************************************************************
ok: [lxxxxxx.xxx.rxx.xxx]

TASK [add_keysValues : Add Key Values In Consul] ***************************************************************************************************
fatal: [lxxxxxx.xxx.rxx.xxx]: FAILED! => {"changed": false, "msg": "python-consul required for this module. see https://python-consul.readstallation"}
        to retry, use: --limit @/home/sietadm/ansible/ansible_repo/consul_create_KeyValue/master_playbook.retry

PLAY RECAP *****************************************************************************************************************************************
lxxxxxx.xxx.rxx.xxx : ok=4    changed=1    unreachable=0    failed=1

But the module is already installed, I have already done successfully

    sudo pip install python-consul
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already satisfied: python-consul in /usr/local/lib/python2.7/dist-packages (1.1.0)
Requirement already satisfied: six>=1.4 in /usr/lib/python2.7/dist-packages (from python-consul) (1.10.0)
Requirement already satisfied: requests>=2.0 in /usr/local/lib/python2.7/dist-packages (from python-consul) (2.20.1)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/local/lib/python2.7/dist-packages (from requests>=2.0->python-consul) (1.24.2)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/dist-packages (from requests>=2.0->python-consul) (3.0.4)
Requirement already satisfied: idna<2.8,>=2.5 in /usr/local/lib/python2.7/dist-packages (from requests>=2.0->python-consul) (2.7)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/dist-packages (from requests>=2.0->python-consul) (2019.3.9)


whereis python
python: /usr/bin/python3.5m-config /usr/bin/python3.5-config /usr/bin/python3.5m /usr/bin/python2.7-config /usr/bin/python3.5 /usr/bin/python /usr/bin/python2.7 /usr/lib/python3.5 /usr/lib/python2.7 /etc/python3.5 /etc/python /etc/python2.7 /usr/local/lib/python3.5 /usr/local/lib/python2.7 /usr/include/python3.5m /usr/include/python3.5 /usr/include/python2.7 /usr/share/python /usr/share/man/man1/python.1.gz

Thanks for Help

rab boubou
  • 21
  • 3

2 Answers2

2

python-consul needs to be installed on the machine that executes the module (i.e the remote host unless you use delegate_to or something. That information is specified here: https://docs.ansible.com/ansible/latest/modules/consul_module.html).

Also make sure that ansible on the remote host is using python2 and not python3 on the remote host.

Pär Berge
  • 21
  • 2
0

I have found the solution, you should install on the remote server the module python-consul

EDIT : Why Downvote ?

Thanks

rab boubou
  • 21
  • 3