Foreman-Ansible -- hosts never appear

Hi, I have followed the instructions to set-up Foreman-Ansible and i never
see any hosts appear. This is a clean install on 2 vm clients (SL6 +SL7)
and a physical (Centos 7) machine. The 'master' server, foreman + ansible
is the SL7 vm.

All machines can resolve via hosts, hostname -f gives fqdn
I can execute any Ansible command and run playbooks.
Foreman has the 'master' in hosts via the puppet agent.
I have the plugin and callback installed
The callback has been modded for the foreman url
https://sl7.localdomain.net, the ssl cert and key point to the
/etc/puppetlabs…pem files
I have tried ssl verify on and off
Foreman web Administer > settings > auth > Trusted puppetmaster hosts has
the fqdn [ sl7.localdomain.net ]

I am stumped, the hosts just never appear and there is nothing in the very
sparse plugin manual suggesting where to start looking.

Any suggestions…

> Hi, I have followed the instructions to set-up Foreman-Ansible and i never
> see any hosts appear. This is a clean install on 2 vm clients (SL6 +SL7)
> and a physical (Centos 7) machine. The 'master' server, foreman + ansible
> is the SL7 vm.
>
> All machines can resolve via hosts, hostname -f gives fqdn
> I can execute any Ansible command and run playbooks.
> Foreman has the 'master' in hosts via the puppet agent.
> I have the plugin and callback installed
> The callback has been modded for the foreman url
> https://sl7.localdomain.net, the ssl cert and key point to the
> /etc/puppetlabs…pem files
> I have tried ssl verify on and off
> Foreman web Administer > settings > auth > Trusted puppetmaster hosts has
> the fqdn [ sl7.localdomain.net ]
>
> I am stumped, the hosts just never appear and there is nothing in the very
> sparse plugin manual suggesting where to start looking.

What do you see in the foreman logs (/var/log/foreman/production.log)
when you run 'ansible-playbook'? You should see some call to
api/v2/hosts/facts

How about when you run 'ansible-playbook'? What's the output? The
callback needs to be installed on the host from which you run
'ansible-playbook' from in order to work

··· On 08/01, 'KaneK' via Foreman users wrote:

Any suggestions…


You received this message because you are subscribed to the Google Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.


Daniel Lobato Garcia

@dLobatog
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30
Keybase: https://keybase.io/elobato

>
> Morning,
>

I did a bit more poking around and now i have an error message that may
actually be helpful;

ansible-playbook -i 'gtrnliwsts3.localdomain.net,'
/etc/ansible/roles/test-playbook.yml
plugin foreman_callback.py: SSL verification of
https://gtrnliwsts2.localdomain.net disabled

PLAY [all]

··· *********************************************************************

TASK [setup]


ok: [gtrnliwsts3.localdomain.net]
[WARNING]: Failure using method (v2_runner_on_ok) in callback plugin
(</root/.ansible/plugins/callback_plugins/foreman_callback.CallbackModule
object at 0x2fe3050>): [Errno
2] No such file or directory

TASK [command]


changed: [gtrnliwsts3.localdomain.net]

PLAY RECAP


gtrnliwsts3.localdomain.net : ok=2 changed=1 unreachable=0 failed=0

[WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin
(</root/.ansible/plugins/callback_plugins/foreman_callback.CallbackModule
object at 0x2fe3050>):
[Errno 2] No such file or directory

It’s looking for something that isn’t there but I have no idea what.

:confused:

Thanks for your help with this,

ansible --version
#]ansible 2.1.0.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides

My callback is identical to the one you linked except for the foreman url
and the error is the same.

>
> Hi Daniel,
>

Do you have any plans to release an Ansible 2.x version of your plugin or
an updated callback.py?

Regards

Kane.

>
> Hi Daniel,

I have renamed my servers but the same issue stands. The plugin and the
callback are installed on the Ansible/Foreman server, does the callback
need to be installed onto all the machines? here is the info you have asked
for;

Ansible playbook run:

ansible-playbook -i 'gtrnliwsts3.localdomain.net,'
/etc/ansible/roles/test-playbook.yml
plugin foreman_callback.pyc: SSL verification of
http://gtrnliwsts2.localdomain.net disabled

PLAY [all]

··· *********************************************************************

TASK [setup]


ok: [gtrnliwsts3.localdomain.net]

TASK [command]


changed: [gtrnliwsts3.localdomain.net]

PLAY RECAP


gtrnliwsts3.localdomain.net : ok=2 changed=1 unreachable=0 failed=0

my /var/log/foreman/production.log is empty. I installed using the
foreman-installer from the main site.

Cheers,

Kane.

Thanks for the log. That's certainly helpful. At first glance it looks
like you're using Ansible 2, which I haven't tested with the callback.
What's the output of 'ansible --version'?

Can you open your callback plugin file
(.ansible/plugins/callback_plugins/foreman_callback.py) and add a method
'v2_playbook_on_stats'? It'd be identical to the one you see here
(playbook_on_stats).

Let me know if that fixes the problem, if it works, feel free to send a pull
request to that repository or I'll do it myself. Thanks for reporting
the issue :slight_smile:

··· On 08/03, 'KaneK' via Foreman users wrote: > > > > > Morning, > > > > I did a bit more poking around and now i have an error message that may > actually be helpful; > > ansible-playbook -i 'gtrnliwsts3.localdomain.net,' > /etc/ansible/roles/test-playbook.yml > plugin foreman_callback.py: SSL verification of > https://gtrnliwsts2.localdomain.net disabled > > PLAY [all] > ********************************************************************* > > TASK [setup] > ******************************************************************* > ok: [gtrnliwsts3.localdomain.net] > [WARNING]: Failure using method (v2_runner_on_ok) in callback plugin > ( object at 0x2fe3050>): [Errno > 2] No such file or directory > > > TASK [command] > ***************************************************************** > changed: [gtrnliwsts3.localdomain.net] > > PLAY RECAP > ********************************************************************* > gtrnliwsts3.localdomain.net : ok=2 changed=1 unreachable=0 failed=0 > > [WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin > ( object at 0x2fe3050>): > [Errno 2] No such file or directory


Daniel Lobato Garcia

@dLobatog
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30
Keybase: https://keybase.io/elobato

>
> >
> > Hi Daniel,
> >
>
> Do you have any plans to release an Ansible 2.x version of your plugin or
> an updated callback.py?

I have not tried anything yet, but I have opened
Bug #16048: Ansible 2 support for callback - Ansible - Foreman to track it

Have you tried to add a method 'v2_playbook_on_stats' to your callback,
that does the same thing as 'playbook_on_stats'?

··· On 08/10, 'KaneK' via Foreman users wrote:

Regards

Kane.


You received this message because you are subscribed to the Google Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.


Daniel Lobato Garcia

@dLobatog
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30
Keybase: https://keybase.io/elobato