Handling prompts and drop-downs via ansible 2.9

22 views
Skip to first unread message

Nishant Passari

unread,
Jun 25, 2020, 4:16:20 AM6/25/20
to Ansible Project
Hi everyone,

Am trying to install jenkins-x version 2.0.785 via ansible 2.9.9.

How do I handle the prompts like "Please enter the name you wish to use with git:" that I get while installing jenkins-x? I get the prompt even though "--git-username=automation" is already passed in the JX install command. I tried with both expect and shell module in ansible.

There are also yes/no prompts to be handled that I will get further.

Regards,
Nishant Passari

Luca 'remix_tj' Lorenzetto

unread,
Jun 25, 2020, 4:19:09 AM6/25/20
to ansible...@googlegroups.com
Hello,

if you aren't able to automate with silent install, use the expect module.

Luca
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/21f3aa9a-5d6f-409f-be30-9dc063c00bd6o%40googlegroups.com.



--
"E' assurdo impiegare gli uomini di intelligenza eccellente per fare
calcoli che potrebbero essere affidati a chiunque se si usassero delle
macchine"
Gottfried Wilhelm von Leibnitz, Filosofo e Matematico (1646-1716)

"Internet è la più grande biblioteca del mondo.
Ma il problema è che i libri sono tutti sparsi sul pavimento"
John Allen Paulos, Matematico (1945-vivente)

Luca 'remix_tj' Lorenzetto, http://www.remixtj.net , <lorenze...@gmail.com>

Nishant Passari

unread,
Jun 25, 2020, 6:05:21 AM6/25/20
to Ansible Project
Already tried with expect and shell module.

```
- name: Handling multiple prompts
  expect:
    command: jx install --git-provider-kind bitbucketserver --git-provider-url http://xyz-abc-git.net.local --git-username automation --default-environment-prefix Testproject --git-api-token MzI1ODg1NjA1NTk4OqjiP9N3lr4iHt9L5rofdaWMqsW --on-premise --external-ip {{ hostvars[groups["kubemaster"][0]]["ip"] }} --verbose --static-jenkins=true --provider=openshift
    responses:
      Question:
        - Please enter the name you wish to use with git: automation
    timeout: 60
```
```
- name: Handling prompts
  expect:
    command: jx install --git-provider-kind bitbucketserver --git-provider-url http://abc-xyz-git.net.local --git-username automation --default-environment-prefix Testproject --git-api-token MzI1ODg1NjA1NTk4OqjiP9N3lr4iHt9L5rofdaWMqsW --on-premise --external-ip {{ hostvars[groups["kubemaster"][0]]["ip"] }} --verbose --static-jenkins=true --provider=openshift
    responses:
      Please enter the name you wish to use with git: "automation"
```

On Thursday, 25 June 2020 13:49:09 UTC+5:30, Luca 'remix_tj' Lorenzetto wrote:
Hello,

if you aren't able to automate with silent install, use the expect module.

Luca

On Thu, Jun 25, 2020 at 10:16 AM Nishant Passari
<passar...@gmail.com> wrote:
>
> Hi everyone,
>
> Am trying to install jenkins-x version 2.0.785 via ansible 2.9.9.
>
> How do I handle the prompts like "Please enter the name you wish to use with git:" that I get while installing jenkins-x? I get the prompt even though "--git-username=automation" is already passed in the JX install command. I tried with both expect and shell module in ansible.
>
> There are also yes/no prompts to be handled that I will get further.
>
> Regards,
> Nishant Passari
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages