0
votes

Whenever I run my playbook on my control machine I only see this:

PLAY RECAP *********************************************************************

So I get the feeling ansible is not finding my task file. Here is my directory structure (it's a git project in Eclipse):

ansible
    ansible
        dockerhosts.yml
        hosts
        roles
            dockerhost
                tasks
                    main.yml

My dockerhosts.yml:

---
- hosts: integration
  roles: [dockerhost]
...

My hosts file:

[integration]
192.168.1.8
192.168.1.9

And my main.yml file:

- name: Install Docker CE from added Docker YUM repo
  remote_user: installer
  become: true
  become_user: root
  become_method: sudo
  command: yum -y install docker-ce

I don't have any syntax errors clearly as it's running but for some reason it doesn't appear to find my main.yml file. I tried to see what user ansible runs under in case it's a question of file permissions but I haven't found anything.

I am running ansible-playbook dockerhosts.yml from the /ansible/ansible directory.

What am I doing wrong?

1
I set up an ansible/ directory exactly the way you specified in your question, and got a correct response, so it might be something with your local config?APerson
This leads me to wonder about file permissions. I installed Ansible as root via a YUM package on RHEL 7. It shouldn't have any issues I would think. What permissions do you have on the ansible/ directory?Justin

1 Answers

0
votes

I have a hosts file but it's not in the /etc/ansible/hosts default location. As I showed in my question it's actually at the same level as dockerhosts.yml since this is a git project.

I used the -vvvv flag but that didn't tell me much. After running ansible-playbook -h I tried the -i flag and ran ansible-playbook dockerhosts.yml -i hosts and that actually did something.

It gave me SSH connection errors but it did more than just the blank PLAY RECAP I got before which to me means it's actually running the tasks now.