I am new with Ansible.
Here is the set I am trying to test
- ansible targets - 2 local docker containers(host port :
9800,9801) - ansible is installed in local docker based on
centos:latestimage
I guess accessing to those 2 containers is working fine, since I am running tomcat instance inside of them. I can access with brower without any extra settings.
This is my /etc/ansible/hosts
# I also tried with 127.0.0.1, but same
[docker-hosts]
0.0.0.0:9800
0.0.0.0:9801
And here is my playbook.yml
---
# This playbook deploys a docker image centos:latest
- hosts: docker-hosts
remote_user: root
become: yes
become_method: sudo
tasks:
- name: pulling docker image
docker_image:
name: centos
When I command ansible-playbook playbook.yml -f 10, the console shows below error logs.
PLAY [docker-hosts] ************************************************************
TASK [Gathering Facts] *********************************************************
fatal: [127.0.0.1]: UNREACHABLE! => {"changed": false, "msg": "[Errno None] Unable to connect to port 9800 on 127.0.0.1", "unreachable": true}
to retry, use: --limit @/home/ansible/playbook/playbook.retry
PLAY RECAP *********************************************************************
127.0.0.1 : ok=0 changed=0 unreachable=1 failed=0
I think it is just network setting problem, but do not know how to figure it out.
How can I fix this access error?
Thanks!
Aucun commentaire:
Enregistrer un commentaire