Foreman_Ansible and Windows

I’m currently trying to add Windows hosts to my foreman installation via ansible -m setup and for Linux servers this works quite well.
The problems started when trying to get Windows servers into foreman.
There is already one issue open on github ( about os_name containing spaces in the facts returned from Windows and while working around that I also found that there is probably a problem with the facts returned for networking.

This what gets returned for interfaces with ansible -m setup for a Windows host:

    "ansible_interfaces": [
            "connection_name": "Ethernet", 
            "default_gateway": "", 
            "dns_domain": "", 
            "interface_index": 3, 
            "interface_name": "Red Hat VirtIO Ethernet Adapter", 
            "macaddress": "00:1A:4A:16:01:09"

And that gives the following error in production.log:

2018-06-13T10:37:17 e68d9738 [app] [D] interface with identifier '[{"macaddress"=>"00:1A:4A:16:01:09", "default_gateway"=>""
, "connection_name"=>"Ethernet", "dns_domain"=>"", "interface_name"=>"Red Hat VirtIO Ethernet Adapter", "interface_index"=>3}]' 
2018-06-13T10:37:17 e68d9738 [app] [W] Action failed
 | NoMethodError: undefined method `downcase' for #<ActiveSupport::HashWithIndifferentAccess:0x00007f216b683a10>
 | /usr/share/foreman/app/services/fact_parser.rb:181:in `map'
 | /usr/share/foreman/app/services/fact_parser.rb:181:in `normalize_interfaces'

The first line is extra debug that I inserted into /usr/share/foreman/app/services/fact_parser.rb and the second is the line that really is causing the problem probably because the input isn’t what it is expecting.

Did I find a bug and should I open an issue on Redmine or is it a problem in the way the ansible setup module works for Windows?

Using Foreman-1.17.1



I would open a bug as NoMethodError sound like a problem in the implementation or at least installation missing some dependency. Also if it is just a problem Ansible integration is expecting things differently then it gets it for Windows systems, I would call it a bug.

I’ve also opened to fix a problem when creating the OS from facts, but I haven’t seen this one.

If you think it’s a bug with the way we are parsing facts (I think it is, it should never 500) - a bug report in here would help us track it.

Thanks @Joop1 @Dirk!

Made the following issue:

1 Like