On 11/21, [email protected] wrote:
> Hi, ladies and gentlemen. I'm trying to setup Foreman with Ansible.
> Looks like I'm missing something. After the test command on the Ansible
> server "ansible -m setup localhost" Ansible writes many green strings with
> configuration info, and in the end where the Callback should be used it
> says:
>
> *[WARNING]: Failure using method (v2_runner_on_ok) in callback plugin
> (</usr/share/ansible/plugins/callback/foreman_callback.CallbackModule
> object at 0x16995d0>):*
> *HTTPSConnectionPool(host='myAWShost.myRegion.compute.internal',
> port=3000): Max retries exceeded with url: /api/v2/hosts/facts (Caused by
> <class*
> *'socket.error'>: [Errno 111] Connection refused)*

The installation seems fine from the rest of your email, don't worry too
much about that. The problem seems to be that your Foreman host is not
accepting connections from this host on that port (notice that 'connection
refused' message).

I don't think the problem is in Foreman itself but rather in how the
host is configured. Can you run that same command, but from the Foreman
host itself? You might see different results if the firewall was
blocking the connection.

Have you checked /var/log/foreman/production.log on the Foreman host?
>From the looks of it I don't think the requests have even got to the
host. I'd check firewall, SELinux, Apache logs...

You should set FOREMAN_SSL_CERT and FOREMAN_SSL_KEY if you intend the
callback to work through HTTPS (or enable http for that Foreman route)

https://theforeman.org/plugins/foreman_ansible/1.x/index.html#2.1Ansiblecallback
has more info, if you don't feel like configuring stuff and you have
Ansible 2.2, the callback is shipped by default with it. You should only
have to enable it and set the appropriate variables.

> I did everything as in the manual, may be I have ony changed the default
> directory of a plugin (*/usr/share/ansible/plugins/*), but i made
> appropriate changes to Ansible config, as plugin itself works.
> In the Foreman UI I see some options appeared related to Ansible, like
> "Configure -> Ansible / Roles". Also I added my Ansible server to the
> *trusted_puppetmaster_hosts* and *create_new_host_when_facts_are_uploaded*
> are ON.
> The problem is, as I see, in connection to Foreman. In my Foreman Callback
> .py file *FOREMAN_URL *is the same, as it is in the results of the
> following command
> *openssl s_client -showcerts
> -connect myAWShost.myRegion.compute.internal:443*
> This same address was by default. Also I copied Foreman's cert .pem and ssl
> .pem to the Ansible server and added this paths in the *foreman_callback.py*
> file.
>
> When I try to turn off *FOREMAN_SSL_VERIFY*, I'm getting another error:
>
> *ERROR! Unexpected Exception: 'module' object has no attribute 'packages'*
> *the full traceback was:*
>
> *Traceback (most recent call last):*
> *  File "/usr/bin/ansible", line 92, in <module>*
> *    exit_code = cli.run()*
> *  File "/usr/lib/python2.6/site-packages/ansible/cli/adhoc.py", line 193,
> in run*
> *    result = self._tqm.run(play)*
> *  File
> "/usr/lib/python2.6/site-packages/ansible/executor/task_queue_manager.py",
> line 202, in run*
> *    self.load_callbacks()*
> *  File
> "/usr/lib/python2.6/site-packages/ansible/executor/task_queue_manager.py",
> line 188, in load_callbacks*
> *    self._callback_plugins.append(callback_plugin())*
> *  File "/usr/share/ansible/plugins/callback/foreman_callback.py", line 69,
> in __init__*
> *    self.ssl_verify = self._ssl_verify()*
> *  File "/usr/share/ansible/plugins/callback/foreman_callback.py", line 83,
> in _ssl_verify*
> *    requests.packages.urllib3.disable_warnings()*
> *AttributeError: 'module' object has no attribute 'packages'*
>
> Need help, what have I done wrong? May be something wrong with the
> installation, don't know...
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: PGP signature

Reply via email to