Re: [ansible-project] Templating error with Ansible 2.9 or higher

2020-02-24 Thread harry devine
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
 

Re: [ansible-project] Templating error with Ansible 2.9 or higher

2020-02-21 Thread Hugo Gonzalez



On 2/19/20 8:02 AM, harry devine wrote:
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

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/97c41ac4-a61f-e435-b56b-f6703f218e2b%40redhat.com.


[ansible-project] Templating error with Ansible 2.9 or higher

2020-02-19 Thread harry devine
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:


---
- name: "Create list of content view version names"
  set_fact:
cv_ver_names: "{{ cv_qry.json.results[0] | json_query(cv_ver_names_jq ) 
| sort(attribute='id',reverse=True) }}"
  vars:
cv_ver_names_jq: "versions[*].{name: version, id: id}"

- debug:
var: "cv_ver_names"
verbosity: "1"

- name: "Set content view version keep list"
  set_fact:
cv_keep_list: "{{ keep_qry }}"
  vars:
keep_count: ":{{ cv.keep_content_view_versions_count }}"
keep_qry: "{{ '{{' }} cv_ver_names[{{ keep_count }}] {{ '}}' }}"

- debug:
var: "cv_keep_list"
verbosity: "1"

- name: "Set content view remove list"
  set_fact:
cv_remove_list: "{{ cv_ver_names | difference(cv_keep_list) }}"

- debug:
var: "cv_remove_list"
verbosity: "1"

Any help would be appreciated.

Thanks,
Harry

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/48cf5321-f37a-4c56-a642-e5de05c2d080%40googlegroups.com.