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 (https://github.com/theforeman/foreman_ansible/pull/174) 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": "192.168.0.252",
"dns_domain": "foo.bar",
"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"=>"192.168.0.252"
, "connection_name"=>"Ethernet", "dns_domain"=>"foo.bar", "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
tfm-rubygem-foreman_ansible-2.0.1-1.fm1_17.el7.noarch
tfm-rubygem-foreman_ansible_core-2.0.2-1.fm1_17.el7.noarch
Regards,
Joop