Problem:
I am setting up Foreman using the following option:
–foreman-proxy-plugin-ansible-ansible-dir=’/ansible/roles’
I have placed a role under this directory but when I try to import the role, Foreman shows the message “No changes in roles detected on hostname”.
If I place the role under /etc/ansible/roles, the import works.
Any idea why this install option doesn’t seem to be working?
Foreman and Proxy versions:
Foreman and Foreman Proxy are at version 1.20.1
Foreman and Proxy plugin versions:
Ansible plugin is at version 2.2.11
Other relevant data:
I doesn’t seem to be adding the roles_path in /etc/foreman-proxy/ansible.cfg, but even adding it manually doesn’t fix the problem.
Can you double check the user foreman-proxy can read that directory? Also could you please set debug log level in /etc/foreman-proxy/settings.yml, then restart service foreman-proxy and look at /var/log/foreman-proxy/proxy.log? Ideally capture that when trying to import ansible roles and upload it here.
Also there was a nasty issue fixed recently, in case there were multiple roles_dirs configured and the last directory was empty, it returned empty list so it could be it.
Just one blind guess: Is SELinux enabled? Creating a new toplevel directory like /ansible will generate a context of unlabeled_t which will probably not accessible by Foreman.
I created a symlink to /ansible/roles from /etc/ansible/roles and this actually worked so it’s not a permissions or SELinux issue.
Unfortunately, I cannot import roles at all now because I reinstalled using Foreman 1.21 so I can get the newer Ansible plugin which supports variable import (which I need). The new installation isn’t showing the smart proxy on localhost under Infrastructure->Smart Proxies. Is there a known issue with 1.21?
Yup… not assigning to the current organization was the problem. Now I feel dumb. Thank you for the help.
Okay, now back to debugging the original issue. I will update when I can.
Thanks for confirmation, it’s actually pretty bad user experience. If there’s single org in the system, resources should be automatically assigned to it.
I set the logging to DEBUG, restarted foreman-proxy, and tried the import. It didn’t pick up any new roles (the ones I already imported with the workaround were available for removal as expected). Here is the output of /var/log/foreman-proxy/proxy.log
2019-02-28T15:30:11 [D] accept: 172.22.254.201:39402
2019-02-28T15:30:11 [D] Rack::Handler::WEBrick is invoked.
2019-02-28T15:30:11 e7c9070a [I] Started GET /roles
2019-02-28T15:30:11 e7c9070a [I] Finished GET /roles with 200 (0.57 ms)
2019-02-28T15:30:11 [D] close: 172.22.254.201:39402
@Marek_Hulan I am also facing the same issue as @ethancpace. This is my error log
2021-07-28T13:53:43 [D] Rack::Handler::WEBrick is invoked.
2021-07-28T13:53:43 724235d6 [I] Started GET /ansible/roles
2021-07-28T13:53:43 724235d6 [I] Finished GET /ansible/roles with 200 (0.89 ms)
2021-07-28T13:53:43 [D] close: 161.92.208.226:37668
@almond This thread is from over 2 years ago and related to very old versions of Foreman and the ansible plugin. Even if you are facing a similar issue, it is likely not the same issue as described in this thread. Please open a new thread with the issue you are facing.