'CallbackModule' object has no attribute 'ssl_verify'

Hi everyone,

Geeting errors when I try to run ansible roles from foreman. they work fine from the command line.

I’m running Foreman version 1.17 and Ansible version 2.5.2

I can’t find where these errors is coming from and how to fix it.

Thank you,

I suspect you have ssl_verify = 0 or ssl_verify = 1 in your config. Could you try with ssl_verify = /path/to/ca.pem or ssl_verify = False/True?

You can also try to apply https://github.com/ansible/ansible/commit/d303c0706c69831f4e5233a5c9d43b8f2db6e5ac or download https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/callback/foreman.py which should handle 0 and 1.

Hi ekohl,

Stupid question but which configuration file do I add ssl_verify = False? I added it to the /etc/ansible/ansible.cfg file and it did not help.

If you have no config at all, then the default is 1 which is broken. I’d recommend configuring it similar to


The short version is:

callback_whitelist = foreman

url = <%= @foreman_url %>
ssl_cert = <%= @foreman_ssl_cert %>
ssl_key = <%= @foreman_ssl_key %>
verify_certs = <%= @foreman_ssl_ca %>

I download the foreman.py and added the lines below to the ansible.cfg file.
https://ansible01.localhost.local = <%= @foreman_url %>
/etc/puppetlabs/puppet/ssl/certs/ansible01.localhost.local.pem = <%= @foreman_ssl_cert %>
/etc/puppetlabs/puppet/ssl/private_keys/ansible01.localhost.local.pem = <%= @foreman_ssl_key %>
/etc/puppetlabs/puppet/ssl/certs/ca.pem = <%= @foreman_ssl_ca %>

and getting this error running a playbook from command line:

ERROR! Unexpected Exception, this is probably a bug: ‘instancemethod’ object has no attribute ‘getitem
the full traceback was:

Traceback (most recent call last):
File “/usr/bin/ansible-playbook”, line 118, in
exit_code = cli.run()
File “/usr/lib/python2.7/site-packages/ansible/cli/playbook.py”, line 122, in run
results = pbex.run()
File “/usr/lib/python2.7/site-packages/ansible/executor/playbook_executor.py”, line 89, in run
File “/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py”, line 210, in load_callbacks
File “/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py”, line 98, in set_options
self.FOREMAN_SSL_CERT = (self.get_option[‘ssl_cert’], self.get_option[‘ssl_key’])
TypeError: ‘instancemethod’ object has no attribute ‘getitem

my bad… I changed the ansible.cfg file to the below settings and that fixed the SSL issue. I’m still getting the failed to connect to host via ssh error though. I thought fixing the ssl_verify would fix both.

verify_certs = /etc/puppetlabs/puppet/ssl/certs/ca.pem
ssl_key = “/etc/puppetlabs/puppet/ssl/private_keys/ansible01.localhost.local.pem”
ssl_cert = “/etc/puppetlabs/puppet/ssl/certs/ansible01.localhost.local.pem”
url = “https://ansible01.localhost.local

What error do you see? Does the user have permissions to read those files? Note that using ansible with -v or even -vvvv can show a lot more about what’s going on.

Hi ekohl,

It’s working now. I had to re-enter the user account under Administrator/Settings/Ansible/User. For some reason it did not take correctly the first time.

Thank you for your help.