Good morning,

I'm getting the following Error when running my playbook:
TASK [patch_rhel : Install Red Hat Security Advisory (RHSA)] 
*******************
fatal: [rhel-t0.hrz.uni-bielefeld.de]: FAILED! => {"failed": true, "msg": "{{ 
2016_1_Set }}: template error while templating string: unexpected char u'_' 
at 7. String: {{ 2016_1_Set }}"}

I would be very happy if someone could help me to figure out what I'm doing 
wrong here.

Here are some information about my environment:
[2016.10.11 09:06:25] /data/ansible
root@ansible-pctrl01>cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)
[2016.10.11 09:07:57] /data/ansible
root@ansible-pctrl01>uname -r
3.10.0-327.36.1.el7.x86_64
[2016.10.11 09:08:03] /data/ansible
root@ansible-pctrl01>ansible --version
ansible 2.1.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

The playbook I'm trying to run:
root@ansible-pctrl01>cat patch_rhel.yml
---
- hosts: all

  tasks:
    - name: Group by OS
      group_by: key=os_{{ ansible_distribution }}
      changed_when: False

- hosts: os_RedHat
  roles:
    - patch_rhel

Here is the directory structure of my role followed by the contents of the 
tasks and vars main.yml:
roles/patch_rhel/
|-- [joerg    4.0K]  tasks
|   `-- [joerg     662]  main.yml
`-- [joerg    4.0K]  vars
    `-- [joerg     270]  main.yml

# cat roles/patch_rhel/tasks/main.yml
---
  - name: Install Red Hat Security Advisory (RHSA)
    command: yum -y update-minimal --advisory {{ rhsa_to_install }}
    register: yum_output
  - debug: var=yum_output

  - name: Reboot Host if packages were updated
    shell: sleep 2 && shutdown -r now "Ansible updates triggered"
    async: 1
    poll: 0
    ignore_errors: true
    when: ('"Complete!" in "{{ yum_output.stdout_lines[-1] }}"') or
          ('"Komplett!" in "{{ yum_output.stdout_lines[-1] }}"')

  - name: waiting for access server
    local_action: wait_for
      host={{ inventory_hostname }}
      state=started
      port=22
      delay=30
      timeout=300
      connect_timeout=15

# cat roles/patch_rhel/vars/main.yml
---
  2016_09_27: RHSA-2016:1940
  2016_09_28: RHSA-2016:1944
  2016_09_30: RHEA-2016:1982
  #
  2016_10_Set: "{{ 2016_09_27 }},{{ 2016_09_28 }},{{ 2016_09_30 }}"
  #
  rhsa_to_install: "{{ 2016_10_Set }}"

Things I tried so far were to remove the '_' but then I got the same error 
message complaining with the next character in line. Removing the character 
right before the one mentioned in the error I'm running into the same error 
as well.

To get my playbook up and running I changed *roles/patch_rhel/vars/mail.yml* 
to:
cat roles/patch_rhel/vars/main.yml
---
  2016_09_27: RHSA-2016:1940
  2016_09_28: RHSA-2016:1944
  2016_09_30: RHEA-2016:1982
  #
  #2016_10_Set: "{{ 2016_09_27 }},{{ 2016_09_28 }},{{ 2016_09_30 }}"
  #
  #rhsa_to_install: "{{ 2016_10_Set }}"
  rhsa_to_install: RHSA-2016:1940,RHSA-2016:1944,RHEA-2016:1982

Now my playbook runs without any failures. But I like to use the first 
version to be more flexible in applying my advisory.

Thank you in advance for your ideas and support on this. Looking forwared 
to reading from you.

Regards,
Joerg

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/28bbe1b5-3ba5-49c5-8959-22b678663ad9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to