semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

Problem: CLI Arg in task only in JSON format

Open Tristan-Theroux opened this issue 1 year ago • 2 comments

Issue

It would be great to not have to write in JSON the CLI args when running a task.

Currently to limit an Ansible playbooK I need to do :

image

But if I add the arg in the task template, it works without being in JSON format :

image

The goal would be to be able to limit the scope of an ansible playbook easily like in CLI without having to format in JSON every time.

Impact

Web-Frontend (what users interact with), Ansible (task execution), Configuration

Installation method

Package

Database

MySQL

Browser

Chrome

Semaphore Version

2.10.22-e44910d-1721658299

Ansible Version

ansible [core 2.14.14]

Logs & errors

No response

Manual installation - system information

    'c:.                              
    lkkkx, ..       ..   ,cc,           ----------------
    okkkk:ckkx'  .lxkkx.okkkkd          OS: AlmaLinux 9.4 x86_64
    .:llcokkx'  :kkkxkko:xkkd,          Host: VMware20,1
  .xkkkkdood:  ;kx,  .lkxlll;           Kernel: Linux 5.14.0-427.33.1.el9_44
   xkkx.       xk'     xkkkkk:          Uptime: 18 hours, 39 mins
   'xkx.       xd      .....,.          Packages: 1237 (rpm)
  .. :xkl'     :c      ..''..           Shell: bash 5.1.8
.dkx'  .:ldl:'. '  ':lollldkkxo;        Display (Virtual-1): 1280x800 @ 60 z

.''lkkko' ckkkx. Cursor: Adwaita 'xkkkd:kkd. .. ;' :kkxo. Terminal: /dev/pts/0 ,xkkkd;kk' ,d; ld. ':dkd::cc, CPU: Intel(R) Xeon(R) Silver 4216 (z .,,.;xkko'.';lxo. dx, :kkk'xkkkkc GPU: VMware SVGA II Adapter 'dkkkkkxo:. ;kx .kkk:;xkkd. Memory: 932.52 MiB / 15.34 GiB (6%) ..... .;dk:. lkk. :;, Swap: 0 B / 32.00 GiB (0%) :kkkkkkkdoxkkx Disk (/): 7.35 GiB / 85.95 GiB (9%)s ,c,,;;;:xkkd. Local IP (ens33): 192.168.3.18/22 ;kkkkl... Locale: en_CA.UTF-8 ;kkkkl ,od;

Configuration

Inventory / task scope limitation.

Additional information

No response

Tristan-Theroux avatar Sep 27 '24 19:09 Tristan-Theroux

Hi @SysAdminShed

You are right. Looks like new args UI works not as expected :)

fiftin avatar Sep 29 '24 15:09 fiftin

Wanted to add the following :

When adding multiple limit of the scope (with proper JSON format), it gives the following error :

9:51:06 AM ERROR! the playbook: Producer could not be found

JSON format used : ["-l", "benchtest","benchtest2"]

Tristan-Theroux avatar Sep 29 '24 16:09 Tristan-Theroux

i tried limiting host by

["-l", "host"]

but getting error

ERROR! the playbook: ["-l", "host"] could not be found

kingp0dd avatar Nov 01 '24 09:11 kingp0dd

Don't use the JSON format, just input the -l host.

Best,

On Fri, Nov 1, 2024, 5:44 a.m. kingp0dd @.***> wrote:

i tried limiting host by

["-l", "host"]

but getting error

ERROR! the playbook: ["-l", "host"] could not be found

— Reply to this email directly, view it on GitHub https://github.com/semaphoreui/semaphore/issues/2367#issuecomment-2451602217, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7DTQ5SJZHUKRGEXIFYDNZDZ6NEPFAVCNFSM6AAAAABO7XLPY6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJRGYYDEMRRG4 . You are receiving this because you were mentioned.Message ID: @.***>

Tristan-Theroux avatar Nov 01 '24 11:11 Tristan-Theroux

that worked thank you

On Fri, Nov 1, 2024 at 7:38 PM Tristan Theroux @.***> wrote:

Don't use the JSON format, just input the -l host.

Best,

On Fri, Nov 1, 2024, 5:44 a.m. kingp0dd @.> wrote:

> i tried limiting host by
>
> ["-l", "host"]
>
> but getting error
>
> ERROR! the playbook: ["-l", "host"] could not be found
>
> —
> Reply to this email directly, view it on GitHub
> < https://github.com/semaphoreui/semaphore/issues/2367#issuecomment-2451602217>,
> or unsubscribe
> < https://github.com/notifications/unsubscribe-auth/A7DTQ5SJZHUKRGEXIFYDNZDZ6NEPFAVCNFSM6AAAAABO7XLPY6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJRGYYDEMRRG4>
> .
> You are receiving this because you were mentioned.Message ID:
> @.
>
>

— Reply to this email directly, view it on GitHub https://github.com/semaphoreui/semaphore/issues/2367#issuecomment-2451736813, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACGD6KWGON54WYQ5KOLVTM3Z6NR2TAVCNFSM6AAAAABO7XLPY6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJRG4ZTMOBRGM . You are receiving this because you commented.Message ID: @.***>

kingp0dd avatar Nov 02 '24 09:11 kingp0dd

Odd behavior discovered today: This works: -l groupName This fails: --limit groupName

The error message received is: ERROR! the playbook: --limit groupName could not be found

It seems that the template's CLI args field cannot handle --limit, though -limit and -l both work.

CryptoFewka avatar Dec 26 '24 23:12 CryptoFewka

This also means that things like --skip-tags and --vault-password-file won't work currently when defined in CLI Args.

CryptoFewka avatar Dec 26 '24 23:12 CryptoFewka