Dear All,
Thanks alot for the pointers.
This is what I finally used to get it working.


    - name: Install Java update for Netbackup
      shell: |
        set timeout 300
        spawn /usr/openv/netbackup/bin/goodies/nbcomponentupdate -product
NetBackup -component jre -path /tmp/jdk1.8.0_341
        expect "Do you want to continue "
        send "y\r"
        interact
        exit 0
      args:
        executable: /usr/bin/expect

Much appreciation for the pointers and guidance.

Kind Regards
Andrew Okullu
Mob:+256-772-418560, +256754213295
| Skype:aokullu | twitter: @aokullu | gtalk: aokullu


On Mon, Sep 26, 2022 at 5:53 PM Alex Wanderley <alex.wander...@edmonton.ca>
wrote:

> Hello Andrew,
>
> Why not use Ansible's "expect" module instead?
> I've been using it in a playbook to perform an interactive installation
> and that module works just fine as the expect Shell command:
>
>  - name: install ahf
>           expect:
>               echo: yes
>               timeout: null
>               command: "{{ ahf_installer }}"
>               responses:
>                 (.*)Do you want to install AHF at \[/opt/oracle.ahf\] \?
> \[Y\]\|N :(.*): "Y"
>                 (.*)Please Enter AHF Data Directory :(.*): "{{
> server_data_dir }}"
>                 (.*)Do you want to add AHF Notification Email IDs \?
> \[Y]\|N :(.*): "N"
>                 (.*)Enter Email IDs separated by space :(.*): "{{
> ahf_notification_emails }}"
>                 (.*)Do you want AHF to store your My Oracle Support
> Credentials for Automatic Upload \? Y\|\[N\] :(.*): "N"
>           register: ahf_installer_result
>           changed_when: "'AHF is already installed' not in
> ahf_installer_result.stdout"
>
> Regards,
>
> Alex
>
> On Mon, Sep 26, 2022 at 6:48 AM Andrew Okullu <aoku...@gmail.com> wrote:
>
>> Dear Team
>> i have an issue. I have written a playbook that will perform and update
>> of the netbackup java.
>> ############################################################
>> Expect section
>>
>>     - name: Install
>>       shell: |
>>         set timeout -1
>>         log_file /tmp/nbexpect.log
>>         spawn /usr/openv/netbackup/bin/goodies/nbcomponentupdate -product
>> NetBackup -component jre -path /tmp/jdk1.8.0_341
>>         expect {
>>           "Do you wish to continue" {
>>             sleep 1
>>             send "y\n"
>>             exp_continue
>>             }
>>
>>             }
>> ################### Log waiting at prompt
>> spawn /usr/openv/netbackup/bin/goodies/nbcomponentupdate -product
>> NetBackup -component jre -path /tmp/jdk1.8.0_341
>> Command line: /usr/openv/netbackup/bin/goodies/nbcomponentupdate -product
>> NetBackup -component jre -path /tmp/jdk1.8.0_341
>>
>> Java Runtime Envrionment(JRE) version installed with product 'Veritas
>> NetBackup'                                 : 1.8.0_331 (64bit)
>> Java Runtime Envrionment(JRE) version found at path '/tmp/jdk1.8.0_341'
>>                                        : 1.8.0_341 (64bit)
>>
>> This utility will update the Java Runtime Envrionment(JRE) binaries
>> present at '/usr/openv/java/jre' path
>>
>> This utility may start and stop all (or some) services depending upon the
>> present state of services.
>>
>>
>> Do you want to continue (Y[es]/N[o]):
>>
>> From the log file its waiting at the prompt to continue the install.
>>
>> Some guidance on where am going wrong.
>>
>> Kind Regards
>> Andrew Okullu
>> Mob:+256-772-418560, +256754213295
>> | Skype:aokullu | twitter: @aokullu | gtalk: aokullu
>>
>> --
>> 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-project+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CABcUpdpO7UkDCuCyGwZO3QEBUZWrmmZXsP6rVb_Ekqv%3DVJr9hg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CABcUpdpO7UkDCuCyGwZO3QEBUZWrmmZXsP6rVb_Ekqv%3DVJr9hg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
>
>
>
> [image: Edmonton_sig_RGB_S.jpg]
>
> Alex Wanderley
>
> Application and Infrastructure Analyst II
> Storage and Backup Solutions
>
> Financial and Corporate Services | Open City and Technology
>
>
>
> 780-496-4156  Office
>
> 780-819-0273  Mobile
>
>
>
> City of Edmonton
>
> Century Place, 19th Floor
>
> 9803 102A Avenue NW
>
> Edmonton AB, T5J 3A3
>
>
>
> All information contained in this email post is proprietary to the City of
> Edmonton, confidential and intended only for the addressed recipient. If
> you have received this post in error, please disregard the contents, inform
> the sender of the misdirection, and remove it from your system. The
> copying, dissemination or distribution of this email, if misdirected, is
> strictly prohibited.
>
> *The contents of this message and any attachment(s) are confidential,
> proprietary to the City of Edmonton, and are intended only for the
> addressed recipient. If you have received this in error, please disregard
> the contents, inform the sender of the misdirection, and remove it from
> your system. The copying, dissemination, or distribution of this message,
> if misdirected, is strictly prohibited.*
>
> --
> 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-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CADp8UUS%3DE7%2BJUE38HGXPD5zij_7oFtn66u3Rzi44KChg-ODyFA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CADp8UUS%3DE7%2BJUE38HGXPD5zij_7oFtn66u3Rzi44KChg-ODyFA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CABcUpdo2QXzc2A%2B1cV3v3aCZehj3ALF6D5NHz%2BThhcQ40E8uBA%40mail.gmail.com.

Reply via email to