Templating error with Ansible 2.9 or higher

I’m using the Satellite6 Content Views role found here: https://galaxy.ansible.com/ahuffman/satellite6_manage_content_views. It works on Ansible up to 2.8.6, but any version after that gives the following error:

TASK [satellite6_manage_content_views : Set content view remove list] ********************************************************************************************************************
fatal: [test-server]: FAILED! => {“msg”: “Unexpected templating type error occurred on ({{ cv_ver_names | difference(cv_keep_list) }}): coercing to Unicode: need string or buffer, dict found”}

I filed an issue on the author’s Github repo in October when Ansible 2.9 rc5 was automatically installed on my system, but nothing has been done with it since I filed it. I’d like to try and fix it myself, but I don’t understand what the error means or is doing. Here’s the YAML code that’s being executed when it fails:

All the debug statements you put in the code will set you see if the lists you're trying to get the differences of are actually lists. Can you post your output for those?

Hugo

Here’s the output:

[root@test-server ~]#ansible-playbook test_manage_satellite_cv.yml -K
BECOME password:

PLAY [Automated Satellite6 content view publish and promote] **************************************************************************************************************************

TASK [Manage Satellite Content Views] *************************************************************************************************************************************************

TASK [satellite6_manage_content_views : Ensure we have the Satellite Server’s CA for validating authentication] ***********************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : Download CA Certificate] **********************************************************************************************************************

TASK [satellite6_manage_content_views : Update CA trust] ******************************************************************************************************************************

TASK [satellite6_manage_content_views : Obtain Satellite6 Organization ID] ************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Set Satellite6 Organization ID] ***************************************************************************************************************
[WARNING]: conditional statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: org_qry.json.results[0].name == ‘{{ sat6_organization }}’
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Set initial statistics] ***********************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : Manage Content Views] *************************************************************************************************************************
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/manage_content_views.yml for test-server
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/manage_content_views.yml for test-server
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/manage_content_views.yml for test-server
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/manage_content_views.yml for test-server
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/manage_content_views.yml for test-server
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/manage_content_views.yml for test-server

TASK [satellite6_manage_content_views : Clear facts] **********************************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : Obtain RHEL7 content view data] ***************************************************************************************************************
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/get_content_views.yml for test-server

TASK [satellite6_manage_content_views : Obtain content view ID] ***********************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Set RHEL7 content view facts] *****************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Set composite content view facts] *************************************************************************************************************

TASK [satellite6_manage_content_views : Publish new content view version] *************************************************************************************************************
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/publish_content_view.yml for test-server

TASK [satellite6_manage_content_views : Clear content view name] **********************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : Set content view name] ************************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : Clear content view ID and name] ***************************************************************************************************************

TASK [satellite6_manage_content_views : Set content view ID and name] *****************************************************************************************************************

TASK [satellite6_manage_content_views : Initiate publishing new content view version of RHEL7] ****************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Check RHEL7 content view publish status] ******************************************************************************************************
FAILED - RETRYING: Check RHEL7 content view publish status (240 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (239 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (238 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (237 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (236 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (235 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (234 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (233 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (232 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (231 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (230 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (229 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (228 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (227 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (226 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (225 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (224 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (223 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (222 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (221 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (220 retries left).
FAILED - RETRYING: Check RHEL7 content view publish status (219 retries left).
changed: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Update publish statistics] ********************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : Publish new composite content view version] ***************************************************************************************************

TASK [satellite6_manage_content_views : Promote content view to lifecycle environments] ***********************************************************************************************
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/promote_content_view.yml for test-server

TASK [satellite6_manage_content_views : Obtain lifecycle environments] ****************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Obtain latest content views] ******************************************************************************************************************
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/get_content_views.yml for test-server

TASK [satellite6_manage_content_views : Obtain content view ID] ***********************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Set content view facts] ***********************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : Set RHEL7 latest version promotion list] ******************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Clean Library from content_view_environment_ids] **********************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Set lifecycle environment id list] ************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : Build lifecycle environment id list] **********************************************************************************************************
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/build_promotion_list.yml for test-server

TASK [satellite6_manage_content_views : Clear lifecycle id] ***************************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Set lifecycle ID] *****************************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : Add lifecycle_id to lifecycle_ids list] *******************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Promote content view to lifecycle environments] ***********************************************************************************************
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/promote_to_lifecycle.yml for test-server

TASK [satellite6_manage_content_views : Set promotion_diff] ***************************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : Set promotion_names] **************************************************************************************************************************
ok: [test-server] => (item=2)

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Initiate promotion of RHEL7 to Production] ****************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : Check RHEL7 content view promotion status to Production] **************************************************************************************
FAILED - RETRYING: Check RHEL7 content view promotion status to Production (240 retries left).
changed: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Set content_view_published] *******************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : Set content view promotion statistics] ********************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Remove previous content view version] *********************************************************************************************************

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Obtain latest RHEL7 content view data] ********************************************************************************************************
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/get_content_views.yml for test-server

TASK [satellite6_manage_content_views : Obtain content view ID] ***********************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Build list of content views to remove] ********************************************************************************************************
included: /etc/ansible/roles/satellite6_manage_content_views/tasks/build_cv_keep_list.yml for test-server

TASK [satellite6_manage_content_views : Create list of content view version names] ****************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : debug] ****************************************************************************************************************************************

TASK [satellite6_manage_content_views : Output vars used in building the custom facts] ************************************************************************************************
fatal: [test-server]: FAILED! => {“msg”: “Error in jmespath.search in json_query filter plugin:\n’cv_ver_names_jq’ is undefined”}

TASK [satellite6_manage_content_views : Set statistics output] ************************************************************************************************************************
ok: [test-server]

TASK [satellite6_manage_content_views : Report content view changes] ******************************************************************************************************************
ok: [test-server] => {
“msg”: [
“Total content views published: 1”,
“Content views published:”,
[
“RHEL7”
],
“Total composite content views published: 0”,
“Composite content views published:”,
,
“Total content view promotions: 1”,
“Content views promoted:”,
[
“RHEL7 was promoted to Production”
],
“Total composite content view component updates: 0”,
“Composite content view components updated:”,
,
“Total content view versions removed: 0”,
“Content view versions removed:”,

]
}

PLAY RECAP ****************************************************************************************************************************************************************************
test-server : ok=45 changed=2 unreachable=0 failed=1 skipped=28 rescued=0 ignored=0

Thanks,
Harry