Foreman ansible error - 'NoneType' object has no attribute 'set_options'

Every job in foreman ansible returns ERROR! Unexpected Exception, this is probably a bug: ‘NoneType’ object has no attribute 'set_options’

Executing the same template locally with ansible-playbook echo.yaml -i localhost, completes successfully so this seems to be a foreman configuration issue.

This is Foreman 3.1 on Ubuntu 20.04

Job log:

ansible-playbook 2.9.6
  config file = /usr/share/foreman-proxy/.ansible.cfg
  configured module search path = ['/usr/share/foreman-proxy/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
Using /usr/share/foreman-proxy/.ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /tmp/d20220125-688-fjw2ek/inventory/hosts as it did not pass its verify_file() method
Parsed /tmp/d20220125-688-fjw2ek/inventory/hosts inventory source with script plugin
Loading callback plugin awx_display of type stdout, v2.0 from /usr/lib/python3/dist-packages/ansible_runner/callbacks/
ERROR! Unexpected Exception, this is probably a bug: 'NoneType' object has no attribute 'set_options'
the full traceback was:
Traceback (most recent call last):
  File "/usr/bin/ansible-playbook", line 123, in <module>
    exit_code =
  File "/usr/lib/python3/dist-packages/ansible/cli/", line 127, in run
    results =
  File "/usr/lib/python3/dist-packages/ansible/executor/", line 99, in run
  File "/usr/lib/python3/dist-packages/ansible/executor/", line 164, in load_callbacks
AttributeError: 'NoneType' object has no attribute 'set_options'
Exit status: 250

Job template:

- hosts: all
    - shell:
        cmd: |
          echo foo
      register: out
    - debug: var=out

seems like some whitelisted ansible callback issue, try to disable them in ~foreman-proxy/.ansible.cfg them and retry

Thank you. It seems to work when callback_whitelist is commented out. Is the foreman ansible callback necessary on the proxy?

This is the contents of ~foreman-proxy/.ansible.cfg created by foreman-installer.

callback_whitelist = theforeman.foreman.foreman
local_tmp = /tmp
host_key_checking = False
stdout_callback = yaml
roles_path = /etc/ansible/roles:/usr/share/ansible/roles
collections_paths = /etc/ansible/collections:/usr/share/ansible/collections

report_type = foreman
proxy_url =
url =
ssl_cert = /etc/puppetlabs/puppet/ssl/certs/
ssl_key = /etc/puppetlabs/puppet/ssl/private_keys/
verify_certs = /etc/puppetlabs/puppet/ssl/certs/ca.pem

ssh_args = -o ProxyCommand=none -C -o ControlMaster=auto -o ControlPersist=60s

It actually is required for sending facts and reports to the Foreman. If you’re not using that at all, feel free to keep it disabled. However if you want to get facts/reports in (recommended), we need to fix it. cc @lzap and @evgeni, this may be a regression in the recent changes, I’m not sure how to debug this or what other information to ask for.

My memory says that there was some bugs with collection-based callbacks in early 2.9 versions.

I had this exact error on a fresh Foreman 3.1 install on Ubuntu 20, and a matching copy of your posted ~foreman-proxy/.ansible.cfg file. I was able to get this working by changing callback_whitelist to

callback_whitelist = foreman

Facts and reporting are working for me with this change.

1 Like