Hi,
I'm running an ansible playbook called create_admin_user.yml and I'm getting
this error
fatal: [172.31.3.117]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'herlit_semaphore' is undefined. 'herlit_semaphore' is undefined\n\nThe error appears to be in '/etc/ansible/roles/create_admin_user/tasks/main.yml': line 13, 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: semaphore\n ^ here\n"}
This is my create_admin_user.yaml file in the playbooks/users directory
- hosts: all
gather_facts: yes
become: yes
become_user: root
tasks:
- ansible.builtin.import_role:
name: create_admin_user
This is my main.yml in the vars directory
admin:
- name: 'herlit_semaphore'
comment: 'Ultimate User'
uid: '1000'
- name: 'semaphore'
comment: 'Semaphore App User'
uid: '1001'
This is my main.yml in the tasks directory
---
# tasks file for create_admin_user
- name: Add the user with a specific uid and a primary group of "admin"
ansible.builtin.user:
name: "{{
herlit_semaphore.name }}"
comment: "{{ herlit_semaphore.comment }}"
uid: "{{ herlit_semaphore.uid }}"
state: present
group: admin
append: yes
- name: Add the user "semaphore" with a specific uid and a primary group of "admin"
ansible.builtin.user:
name: "{{
semaphore.name }}"
comment: "{{ semaphore.comment }}"
uid: "{{ semaphore.uid }}"
state: present
group: admin
append: yes
Sorry for the long email. Any ideas about this error?
THanks
Hernan