Open Befrog57 opened 2 years ago
There seems to be a Problem with variables that are defined in the invertory file. Example hosts.yml:
all: hosts: children: production: vars: ansible_python_interpreter: /usr/bin/python3 hosts: host1.com: userlist: - user_name: "user1" host2.com: userlist: - user_name: "user1" - user_name: "user2" - user_name: "user3" host3.com: userlist: - user_name: "user1"
Example paybook that uses theese vars:
--- - hosts: all remote_user: root tasks: - name: Add users ansible.builtin.user: name: "{{ item.user_name }}" shell: /bin/bash groups: wheel append: yes with_items: "{{ userlist }}" - name: Set authorized key {{ item.user_name }} authorized_key: user: "{{ item.user_name }}" state: present key: "{{ lookup('file', '../files/ssh-keys/{{ item.user_name }}.pub') }}" with_items: "{{ userlist }}"
When executed on CLI it works just fine.
When executed in Rundeck this error message appears:
The task includes an option with an undefined variable. The error was: 'user_name' is undefined
I have the same issue. Perhaps any resolution?
There seems to be a Problem with variables that are defined in the invertory file. Example hosts.yml:
Example paybook that uses theese vars:
When executed on CLI it works just fine.
When executed in Rundeck this error message appears: