How to pass prompt in ansible?ansible pass shell command result to variableAnsible : fetching remote...

Breaking changes to eieio in Emacs 27?

Canada travel to US using Global Entry

What should I be wary of when insurer is taking a lot of time to decide whether car is repairable or a total loss?

Is there a DSLR/mirorless camera with minimal options like a classic, simple SLR?

Tikz-cd diagram arrow passing under a node - not crossing it

Use 1 9 6 2 in this order to make 75

Housemarks (superimposed & combined letters, heraldry)

What should I discuss with my DM prior to my first game?

How durable are silver inlays on a blade?

Does putting salt first make it easier for attacker to bruteforce the hash?

Wizard clothing for warm weather

Print "N NE E SE S SW W NW"

I've been given a project I can't complete, what should I do?

So a part of my house disappeared... But not because of a chunk resetting

Three questions

Converting from CMYK to RGB (to work with it), then back to CMYK

Why is long-term living in Almost-Earth causing severe health problems?

Command of files and size

NUL delimited variable

Why are ambiguous grammars bad?

How to avoid typing 'git' at the begining of every Git command

Trying to get (more) accurate readings from thermistor (electronics, math, and code inside)

Does the new finding on "reversing a quantum jump mid-flight" rule out any interpretations of QM?

Generate certain list from two lists



How to pass prompt in ansible?


ansible pass shell command result to variableAnsible : fetching remote hostnamesAnsible Task Creates option issueAnsible shell module problemhost_vars not working in AnsibleAnsible shell module empty responseskip some task with prompt in ansibleansible block of codeAnsible configuration filehow to run playbooks in ansible parallel






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I am trying to pass a prompt y in ansible when it executes the below command. When i do manually on server it asks for a prompt. How should i do it with ansible using shell module.Please help with passing the prompt in ansible



ubuntu@ip-xx-xxx-xx-xx:~$ tsm pending-changes apply
This operation will perform a server restart. Are you sure you wish to continue?
(y/n):


My ansible script:



- name: Apply pending configuration changes
shell: source /etc/profile.d/tableau_server.sh && tsm pending-changes apply -u ubuntu -p '{{ tableau_server_admin_password }}' |
expect "This operation will perform a server restart. Are you sure you wish to continue?(y/n)"
send "yn"
args:
executable: /bin/bash
when: inventory_hostname == "xx.xxx.xx.xx"









share|improve this question














bumped to the homepage by Community 13 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2





    Why don't you use the prompt in Ansible? docs.ansible.com/ansible/latest/user_guide/…

    – maulinglawns
    Aug 20 '18 at 15:54






  • 1





    Looks like you can pass your command an --ignore-prompt flag to suppress the prompt... onlinehelp.tableau.com/current/server-linux/en-us/…

    – filbranden
    Aug 20 '18 at 18:18




















0















I am trying to pass a prompt y in ansible when it executes the below command. When i do manually on server it asks for a prompt. How should i do it with ansible using shell module.Please help with passing the prompt in ansible



ubuntu@ip-xx-xxx-xx-xx:~$ tsm pending-changes apply
This operation will perform a server restart. Are you sure you wish to continue?
(y/n):


My ansible script:



- name: Apply pending configuration changes
shell: source /etc/profile.d/tableau_server.sh && tsm pending-changes apply -u ubuntu -p '{{ tableau_server_admin_password }}' |
expect "This operation will perform a server restart. Are you sure you wish to continue?(y/n)"
send "yn"
args:
executable: /bin/bash
when: inventory_hostname == "xx.xxx.xx.xx"









share|improve this question














bumped to the homepage by Community 13 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2





    Why don't you use the prompt in Ansible? docs.ansible.com/ansible/latest/user_guide/…

    – maulinglawns
    Aug 20 '18 at 15:54






  • 1





    Looks like you can pass your command an --ignore-prompt flag to suppress the prompt... onlinehelp.tableau.com/current/server-linux/en-us/…

    – filbranden
    Aug 20 '18 at 18:18
















0












0








0








I am trying to pass a prompt y in ansible when it executes the below command. When i do manually on server it asks for a prompt. How should i do it with ansible using shell module.Please help with passing the prompt in ansible



ubuntu@ip-xx-xxx-xx-xx:~$ tsm pending-changes apply
This operation will perform a server restart. Are you sure you wish to continue?
(y/n):


My ansible script:



- name: Apply pending configuration changes
shell: source /etc/profile.d/tableau_server.sh && tsm pending-changes apply -u ubuntu -p '{{ tableau_server_admin_password }}' |
expect "This operation will perform a server restart. Are you sure you wish to continue?(y/n)"
send "yn"
args:
executable: /bin/bash
when: inventory_hostname == "xx.xxx.xx.xx"









share|improve this question














I am trying to pass a prompt y in ansible when it executes the below command. When i do manually on server it asks for a prompt. How should i do it with ansible using shell module.Please help with passing the prompt in ansible



ubuntu@ip-xx-xxx-xx-xx:~$ tsm pending-changes apply
This operation will perform a server restart. Are you sure you wish to continue?
(y/n):


My ansible script:



- name: Apply pending configuration changes
shell: source /etc/profile.d/tableau_server.sh && tsm pending-changes apply -u ubuntu -p '{{ tableau_server_admin_password }}' |
expect "This operation will perform a server restart. Are you sure you wish to continue?(y/n)"
send "yn"
args:
executable: /bin/bash
when: inventory_hostname == "xx.xxx.xx.xx"






ansible






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 20 '18 at 15:46









SwatSwat

1011




1011





bumped to the homepage by Community 13 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 13 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 2





    Why don't you use the prompt in Ansible? docs.ansible.com/ansible/latest/user_guide/…

    – maulinglawns
    Aug 20 '18 at 15:54






  • 1





    Looks like you can pass your command an --ignore-prompt flag to suppress the prompt... onlinehelp.tableau.com/current/server-linux/en-us/…

    – filbranden
    Aug 20 '18 at 18:18
















  • 2





    Why don't you use the prompt in Ansible? docs.ansible.com/ansible/latest/user_guide/…

    – maulinglawns
    Aug 20 '18 at 15:54






  • 1





    Looks like you can pass your command an --ignore-prompt flag to suppress the prompt... onlinehelp.tableau.com/current/server-linux/en-us/…

    – filbranden
    Aug 20 '18 at 18:18










2




2





Why don't you use the prompt in Ansible? docs.ansible.com/ansible/latest/user_guide/…

– maulinglawns
Aug 20 '18 at 15:54





Why don't you use the prompt in Ansible? docs.ansible.com/ansible/latest/user_guide/…

– maulinglawns
Aug 20 '18 at 15:54




1




1





Looks like you can pass your command an --ignore-prompt flag to suppress the prompt... onlinehelp.tableau.com/current/server-linux/en-us/…

– filbranden
Aug 20 '18 at 18:18







Looks like you can pass your command an --ignore-prompt flag to suppress the prompt... onlinehelp.tableau.com/current/server-linux/en-us/…

– filbranden
Aug 20 '18 at 18:18












1 Answer
1






active

oldest

votes


















0














This is what the ansible expect module is for:



- name: Apply pending configuration changes
expect:
command: /bin/bash -c "source /etc/profile.d/tableau_server.sh && tsm pending-changes apply -u ubuntu -p '{{ tableau_server_admin_password }}'"
responses:
'(y/n):': y
when: inventory_hostname == "xx.xxx.xx.xx"


(Not able to test but something like this is how it should work)






share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f463672%2fhow-to-pass-prompt-in-ansible%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    This is what the ansible expect module is for:



    - name: Apply pending configuration changes
    expect:
    command: /bin/bash -c "source /etc/profile.d/tableau_server.sh && tsm pending-changes apply -u ubuntu -p '{{ tableau_server_admin_password }}'"
    responses:
    '(y/n):': y
    when: inventory_hostname == "xx.xxx.xx.xx"


    (Not able to test but something like this is how it should work)






    share|improve this answer




























      0














      This is what the ansible expect module is for:



      - name: Apply pending configuration changes
      expect:
      command: /bin/bash -c "source /etc/profile.d/tableau_server.sh && tsm pending-changes apply -u ubuntu -p '{{ tableau_server_admin_password }}'"
      responses:
      '(y/n):': y
      when: inventory_hostname == "xx.xxx.xx.xx"


      (Not able to test but something like this is how it should work)






      share|improve this answer


























        0












        0








        0







        This is what the ansible expect module is for:



        - name: Apply pending configuration changes
        expect:
        command: /bin/bash -c "source /etc/profile.d/tableau_server.sh && tsm pending-changes apply -u ubuntu -p '{{ tableau_server_admin_password }}'"
        responses:
        '(y/n):': y
        when: inventory_hostname == "xx.xxx.xx.xx"


        (Not able to test but something like this is how it should work)






        share|improve this answer













        This is what the ansible expect module is for:



        - name: Apply pending configuration changes
        expect:
        command: /bin/bash -c "source /etc/profile.d/tableau_server.sh && tsm pending-changes apply -u ubuntu -p '{{ tableau_server_admin_password }}'"
        responses:
        '(y/n):': y
        when: inventory_hostname == "xx.xxx.xx.xx"


        (Not able to test but something like this is how it should work)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 18 '18 at 9:07









        mhuttermhutter

        556212




        556212






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f463672%2fhow-to-pass-prompt-in-ansible%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

            Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

            Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...