Smart_proxy_ansible default variable import

Problem:
Importing ansible variables returns “No changes in variables detected”.

Expected outcome:
Variables are read from yaml files in “{{ role_path }}/defaults/*” and subdirectories

Foreman and Proxy versions:
Foreman: 1.24.2-1
Foreman Proxy: 1.24.2-1

Foreman and Proxy plugin versions:
smart_proxy_ansible: 3.0.1
foreman_ansible: 4.0.4

Distribution and version:
Ubuntu 16.04.6 LTS (Xenial Xerus)

Other relevant data:
I noticed that the glob patterns do not match defaults/main.yml (https://github.com/theforeman/smart_proxy_ansible/blob/v3.0.0/lib/smart_proxy_ansible/variables_extractor.rb#L9)
To test, In one of the roles that had variables, I created a main directory and moved main.yml into it (defaults/main/main.yml) Doing so did not resolve the problem.

What ever is failing appears to be doing so silently, I am unable to find logs that suggest that there is an issue.

Hi @eight,

I’d guess the role_path itself is incorrect

The role lookup goes to your /etc/ansible/ansible.cfg file and read roles_path config there. If that fails for any reason, we search this default directories for roles:

  • /etc/ansible/roles
  • /usr/share/ansible/roles

If that’s what you expect, could you please confirm, that Foreman is able to import your roles correctly and the issue is just with variables?

In /etc/ansible/ansible.cfg, roles_path does contain /etc/ansible/roles.
/etc/ansible/roles is where I have installed the roles with the following command:
ansible-galaxy role install -r requirements.yml -p /etc/ansible/roles/ -f

I can confirm that foreman is able to import the roles. Well, at least I think foreman is doing so.

  • Configure -> (Ansible) Roles
  • Import from <foreman_proxy_hostname>
  • A new page appears with a list of roles to import
  • I check the checkbox for the roles and click update
  • I’m redirected to the Ansible Roles page and the roles I imported are in the list

When I do the same type of steps with Ansible Variables, I am presented with "No changes in variables detected on <foreman_proxy_hostname>. There are no variables in the list. Some of our roles do not have any variables defined in defaults, most of them do.

Isn’t it possible the variables are already imported? I went through the code and I struggle to see the difference that could cause roles vs variables. Only difference is, that variables are presented only if there are any changes detected.

There is one caveat to keep in mind, the change of value is not currently considered a chage of the variable. This will be changed in upcoming version, but curretly only if you add new variable or drop old one is considered a change.