Ansible role not triggered after Host creation

Hi,

Foreman v1.16 is not able to trigger the ansible role after Host creation. I’m able to inflate the Host using the “Run Ansible Roles” button on Host details page. But my requirement is not run the ansible role while creating host. Please let me know if you need anything from side.

Thanks in advance

Hi @rahul_s,

I’m not sure which version of Foreman Ansible you’re running with 1.16. However, that feature is known to be broken since we moved Foreman Ansible to work as a provider for the Foreman Remote Execution framework.

Sorry if that’s a bit confusing, basically https://github.com/theforeman/foreman_ansible/blob/master/app/models/concerns/foreman_ansible/host_managed_extensions.rb#L23 is calling an old method - this should be fixed on the next release. thanks for bringing this up.

Foreman v1.16
ansible 2.5.3
config file = /etc/ansible/ansible.cfg
configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Apr 11 2018, 07:36:10) [KCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

Can you share path location where i have to put this file https://github.com/theforeman/foreman_ansible/blob/master/app/models/concerns/foreman_ansible/host_managed_extensions.rb#L23

Thanks @dLobatog for responding so quick

@rahul_s Sorry if I did not explain myself clearly, but the issue still happens on the most current release.

The file I was pointing at contains the code supposed to do what you wanted, but as of now there is no way of fixing it (other than manually running Ansible roles as you said). I will keep this thread updated with the fix.

Hey, Don’t say sorry… I get you thanks for explaining. Could you tell me any pervious version of foreman lower than v1.16 having this issue fixed or if not in which version it will be fixed??