ansibe-fehler undefined variable...

Αρχική Σελίδα
Συνημμένα:
Μήνυμα σαν ηλεκτρονικό μήνυμα
+ (text/plain)
Delete this message
Reply to this message
Συντάκτης: Norman Zimmer
Ημερομηνία:  
Προς: list
Αντικείμενο: ansibe-fehler undefined variable...
Hi,

ich hab hier eine lustige Fehlermeldung in Ansible.
Die Variable "{{ ansible_managed }}" wird von mir an mehreren Stellen verwendet.

Variante 1: In Template-Files, hier wird die Variable wie erwartet verwendet.

bigboss@frodo3th:/etc/ansible/roles/vim/templates/etc/vim$ head -n 4 vimrc.local.j2
"
" {{ ansible_managed }}
" vimrc.local 2023-07-14
"

root@newserver:/etc/vim# head -n 4 vimrc.local
"
" Ansible managed
" vimrc.local 2023-07-14
"

Variante 2: In Task-Files, hier gibts eine Fehlemeldung.

bigboss@frodo3th:/etc/ansible/roles/nagios-nrpe-server/tasks$ vi main.yml
20 - name: Edit nrpe.cfg File, Ansible Managed
21 lineinfile:
22 name: '/etc/nagios/nrpe.cfg'
23 line: "# {{ ansible_managed }}"
24 create: yes
25 insertbefore: BOF
26 state: present
27 notify: restart nagios-nrpe-server

TASK [nagios-nrpe-server : Edit nrpe.cfg File, Ansible Managed] **********************************************************************************************
fatal: [newserver]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible_managed' is undefined\n\nThe error appears to be in '/etc/ansible/roles/nagios-nrpe-server/tasks/main.yml': line 20, 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: Edit nrpe.cfg File, Ansible Managed\n ^ here\n"}

... any Ideas?

LG Norman


-- 
Norman "bigboss" Zimmer
GnuPG-ID: 0x1842A431


Packets don't lie, but they may not tell everything if captured by a misconfigured filter.

-- 
Mailing-Liste der Linux User Schwabach (LUSC) e.V.
Vor und beim Posten bitte
        => http://lusc.de/List-Netiquette <=    und
        => http://lusc.de/List-Howto      <=    beachten. Danke!