Run ansible role in foreman : gathering fact : 500 Server Error: Internal Server Error for url: /api/v2/hosts/facts

Problem:

I’m trying to run ansible role dj-wasabi.zabbix-agent from foreman to windows server.
During gathering fact, I have an error 500

Expected outcome:
No error 500

Foreman and Proxy versions:
1.22.1
Foreman and Proxy plugin versions:
foreman-tasks 0.15.9
foreman_ansible 3.0.2
foreman_remote_execution 1.8.2
foreman_userdata 0.1.0
foreman_virt_who_configure 0.4.1
foreman_vmwareannotations 0.0.1
katello 3.12.3

Other relevant data:

It is in /usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py
when executing :

r = requests.post(url=self.FOREMAN_URL + '/api/v2/hosts/facts',
                              data=json.dumps(facts),
                              headers=self.FOREMAN_HEADERS,
                              cert=self.FOREMAN_SSL_CERT,
                              verify=self.ssl_verify)

When examining production.log, I found the following error :

NoMethodError: undefined method `match' for #<ActiveSupport::HashWithIndifferentAccess:0x00007fa392c404e0>
/usr/share/foreman/app/services/fact_parser.rb:187:in `block in remove_ignored'

So, it seems the error is during the callback from ansible to foreman, in /usr/share/foreman/app/services/fact_parser.rb when executing :

def remove_ignored(interfaces)
    interfaces.clone.delete_if do |identifier|
      if (remove = identifier.match(ignored_interfaces))
        logger.debug { "skipping interface with identifier '#{identifier}' since it was matched by 'ignored_interface_identifiers' setting " }
      end
      remove
    end
  end 

Thanks in advance.

1 Like