semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

the field 'hosts' is required and cannot have empty values

Open seaurching opened this issue 1 year ago • 1 comments

Issue

Hellow,owner: my playbook field hosts is an variables with {{ exec_group }}. The file is

- name: "test hosts ping"
  hosts: "{{ exec_group }}"
  roles: ["ping"]

The webui configured the list_enviromnent with emulate values, like this: image

then the task is faied with error: image

Impact

Ansible (task execution)

Installation method

Docker

Database

BoltDB

Browser

Microsoft Edge

Semaphore Version

v2.10.7

Ansible Version

No response

Logs & errors

No response

Manual installation - system information

No response

Configuration

No response

Additional information

No response

seaurching avatar Jun 28 '24 08:06 seaurching

I guess this is because you need to define a default value to your hosts variable using Jinja2 syntax. Mine is:

hosts: "{{ custom_host | default('invalid') }}"

Then in the webui: image

ramiuslr avatar Jun 28 '24 11:06 ramiuslr

I guess this is because you need to define a default value to your hosts variable using Jinja2 syntax. Mine is:

hosts: "{{ custom_host | default('invalid') }}"

Here is my ansible directory tree,all playbooks hosts is jinja2 syntax variable image

still same error

seaurching avatar Jul 01 '24 04:07 seaurching