0

I'm trying to run molecule test on role. Role works good when I use it in playbook, but when i try to run 'molecule test' its failing as follows:

TASK [meta_install_package : Install apt ['openssh-server']] *******************
fatal: [instance]: FAILED! => {"msg": "The conditional check 'ansible_facts['os_family'] == 'Debian'' failed. The error was: error while evaluating conditional (ansible_facts['os_family'] == 'Debian'): 'dict object' has no attribute 'os_family'\n\nThe error appears to be in '/home/mkozub/ansible/ansible/roles/meta_install_package/tasks/Debian.yml': line 1, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: 'Install apt {{var_package_name}}'\n  ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n    with_items:\n      - {{ foo }}\n\nShould be written as:\n\n    with_items:\n      - \"{{ foo }}\"\n"}

I'm running 'meta_install_package' as a role dependency cascade: ROLE1 --- dep. on role 2 -> ROLE2 ---- dep. on role 'meta_install_package' -> meta_install_package

I already gathering facts in playbook. As I mentioned above - role added to playbook works without any error, but molecule doesn't see ansible_facts variables.

mkozub
  • 23
  • 2

0 Answers0