Foreman + Ansible + winrm


#21

Interesting, thanks for confirmation! It may be related to https://github.com/theforeman/smart_proxy_ansible/pull/16 that will appear in the new version.


#22

Hi Marek,

i did a clean install on debian stretch with 1.21.0 Foreman.
The fix is commited there as far as i can see, but it does not solve the problem.

I’ve opened a bug report in redmine.

Maybe there is a chance you can look at this?

Thanks


#23

Hi Folks,

i did fix this in my case.
After the hint from @Marek_Hulan about ansible core i was digging aroud if this package was installed -> it was not.
So i tried to install it, which led to the following error:

apt-get install ruby-foreman-ansible-core
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
ruby-foreman-ansible-core
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/6,104 B of archives.
After this operation, 36.9 kB of additional disk space will be used.
(Reading database … 95994 files and directories currently installed.)
Preparing to unpack …/ruby-foreman-ansible-core_2.2.0-1_all.deb …
Unpacking ruby-foreman-ansible-core (2.2.0-1) …
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite ‘/usr/bin/json_inventory.sh’, which is also in package ruby-smart-proxy-ansible 2.1.2-1
Setting up ruby-foreman-ansible-core (2.2.0-1) …

So i forced the installation with:

apt-get -o Dpkg::Options::="–force-overwrite" install ruby-foreman-ansible-core

After that the package was installed i restarted foreman-proxy service and the first ansible job run with following hint:

[WARNING]: Unable to parse /usr/lib/ruby/bin/json_inventory.sh as an inventory
source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note
that the implicit localhost does not match ‘all’
PLAY [all] *********************************************************************
skipping: no hosts matched
PLAY RECAP *********************************************************************
Exit status: 0

I then created the folder and created a symlink to the inventory script provided by ruby-smart-proxy-ansible:

mkdir /usr/lib/ruby/bin
ln -s /usr/bin/json_inventory.sh json_inventory.sh

After that the ansible runs are successfull.

I know: this kind of a dirty hack and needs to be investigated by the developers, but it’s a workaround for my current situation.

Thanks a lot for @Marek_Hulan for the hint with the fix - it finally leaded me to the “right” workaround.


#24

@mmoll do you happen to know, where or how exclude it from smart-proxy-ansible? And I suppose we need to add ruby-foreman-ansible-core now. It was probably mistakenly removed in https://github.com/theforeman/foreman-packaging/commit/bfd6ea77fa76184c396b655715747702fa269f11

Thanks @bstorp for testing.


#25

Thank you for your help Marek. In my case under ubuntu 16.04 i installed a lot off times with foreman installer with dynflow and remote execution enabled and configured all settings. And the port 8008 want open. I think something missing. I will do a clean installation and look. Best regards


#26

do you happen to know, where or how exclude it from smart-proxy-ansible? And I suppose we need to add ruby-foreman-ansible-core now.

Tbh I lost track of all the ansible(_core) and ansible_proxy(_core) stuff long time ago…

Which ruby gem is json_inventory.sh in? Which DEB package (the can only be one) should carry it?


#27

Yeah, it does not help that we run that differently than in rpm stack. json_inventory.sh seems to be now in both smart_proxy_ansible and foreman_ansible_core. I believe it should be only in foreman_ansible_core. We seem to be shipping it in both rpms, but one is in SCL, one is not.

In other words, could you please somehow blacklist the file from packaging on smart_proxy_ansible? Also the dependency technically can be Recommends but I’d rather be more opinionated and keep it to Depends. Ideally with comments than on Debian systems, foreman_ansible_core runs as part of smart proxy process. I’d do it myself, but I don’t know how to blacklist the file.


#28

AFAIK foreman_ansible_core is only used on the proxy side and should really be smart_proxy_ansible_core.

As @Marek_Hulan said, that is also the package that actually calls the command and uses json_inventory.sh. It shouldn’t be in smart_proxy_ansible.


#29

Would it be an option to do a new gem release of foreman_ansible_core without that file?


#30

Probably yes, I’ll double check it can be safely removed. Though it won’t be in smart_proxy_ansible, foreman_ansible_core still needs it.