semaphoreui / semaphore

Modern UI for Ansible, Terraform, OpenTofu, PowerShell and other DevOps tools.
https://semaphoreui.com
MIT License
10.39k stars 1.05k forks source link

Problem: CLI ["-i", "inventory/test"] not work #2157

Open UmfintechWtc opened 3 months ago

UmfintechWtc commented 3 months ago

Issue

I have two host lists, one host and one test. When I specify ["- i", "inventory/test"] in the CLI, this parameter does not take effect. There is only one host in the test, but the hosts are still being read during runtime。 image image

hosts
[all_host]
app1 ansible_host=192.168.0.1
app2 ansible_host=localhost
test
app2 ansible_host=localhost

Impact

Ansible (task execution)

Installation method

Package

Database

MySQL

Browser

Chrome

Semaphore Version

Semaphore 2.10.11-d31ebd3-1719394739

Ansible Version

[root@my-node2 repository_1_1]# ansible --version
ansible [core 2.15.12]
  config file = /tmp/semaphore/repository_1_1/ansible.cfg
  configured module search path = ['/usr/share/ansible', '/tmp/semaphore/repository_1_1/playbooks/library']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.6 (default, Jul  2 2024, 11:57:08) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] (/usr/local/bin/python3.9)
  jinja version = 3.1.4
  libyaml = True

Logs & errors

No response

Manual installation - system information

No response

Configuration

No response

Additional information

No response

UmfintechWtc commented 3 months ago

I found a strange phenomenon that when adding a host in the inventory menu bar, there is an option called Type - File. Then I filled in "Path to inventory file", and the hosts used an absolute path. image Before I triggered Build, I specified specific hosts in the CLI image I found that regardless of which hosts were specified in the Build CLI, the path "Path to inventory file" was always used during the build. Is this phenomenon normal?

invy commented 2 months ago

Nice try :)

I think it correlates to my 'feature request', where you should be able to attach multiple inventories in task template, so semaphore would do '-i' ... multiple times for you:

2093