IBM-Security / isam-ansible-roles

Ansible Custom Modules, Handlers and Tasks for ISAM. Requires "ibmsecurity" python package.
Apache License 2.0
24 stars 43 forks source link

Role search_attribute_source does not work on ansible 2.8 #150

Closed kalemontes closed 4 years ago

kalemontes commented 4 years ago

When launching a playbook that used to work on ansible 2.7, I found myself with the following warning :

TASK [isam-ansible-roles/search_attribute_source : Search for an Attribute Source] ************************************************************************************************************************************ 
[WARNING]: "register" is not templatable, but we found: {{ search_attribute_source_register }}, it will not be templated and will be used "as is".

My play fails on the next task as it try to use the search_attribute_source_register variable.

From what i understand from the warning and this thread you can no longer use a templated variable as done here :

https://github.com/IBM-Security/isam-ansible-roles/blob/fc70dc5cb102f77ee414fee91d89ca82f58493c0/search_attribute_source/tasks/main.yml#L13

The fix would be rather easy,

- name: Search for an Attribute Source
  isam:
    appliance: "{{ inventory_hostname }}"
    username:  "{{ username }}"
    password:  "{{ password }}"
    lmi_port:  "{{ lmi_port }}"
    log:       "{{ log_level }}"
    force:     "{{ force }}"
    action: ibmsecurity.isam.fed.attribute_source.search
    isamapi:
      name: "{{ search_attribute_source_name }}"
  when: search_attribute_source_name is defined
  register: search_attribute_source_register

But these means that when including this role on a playbook, it should use search_attribute_source_register variable instead of the mapped one map_attribute_source_result :

- include_role:
    name: isam-ansible-roles/search_attribute_source
  vars:
    - search_attribute_source_name: "{{ map_attribute_source_source_name }}"
    # - search_attribute_source_register: "{{ map_attribute_source_result }}" # does not work anymore