0

The ansible role 'ansible-hardening' from OpenStack is throwing this error:

ERROR! Error when evaluating variable in import path: {{ stig_version }}stig/main.yml.

When using static imports, ensure that any variables used in their names are defined in vars/vars_files or extra-vars passed in from the command line. Static imports cannot use variables from facts or inventory sources like group or host vars.

It was working before. I can't say I did anything to break the role. I'm running ansible 2.6.5 on Ubuntu 18.10 (client). The role is the latest version checked out today per OpenStack instructions on https://docs.openstack.org/ansible-hardening/latest/getting-started.html#installing-the-ansible-hardening-role The version I had before - that has worked in the past was also broken, showing the same error.

1

The error seems to apply to ansible 2.6.5. It doesn't occur in ansible 2.8.2.

The error seems to be related to the ansible variable {{ stig_version }} not being available for the file https://github.com/openstack/ansible-hardening/blame/979805c9043793ab644dddd02091d4dce5ab267c/tasks/main.yml#L55

The variable is set in ansible-hardening/defaults/main.yml, but according to the error message, this path is not included when running the module import_tasks. Blame data shows that the module include_tasks was purposefully replaced by import_tasks.

I tested reversing to include_tasks in tasks/main.yml and this fixes the error.

A quick fix, without changing anything in the role ansible-hardening code, is to set stig_version in the vars: section of your playbook:

vars:
  stig_version: rhel7

Although I was able to fix the error and move on, I still don't understand why it stopped working, since less than 2 months ago.

I'm posting this here in case it helps other people, as the GitHub repo doesn't have the Issues tab activated - I couldn't find any place related to the project where to submit a post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.