Also note they specifically tell the shell module that expect is the
executable. See blue bold text below.
- name: Run expect to wait for a successful PXE boot via out-of-band CIMC
ansible.builtin.shell: |
set timeout 300
spawn ssh admin@{{ cimc_host }}
expect "password:"
send "{{ cimc_password }}\n"
expect "\n{{ cimc_name }}"
send "connect host\n"
expect "pxeboot.n12"
send "\n"
exit 0
args:
executable: /usr/bin/expect
delegate_to: localhost
Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123
On Sep 26, 2022, at 8:56 AM, 'Rowe, Walter P. (Fed)' via Ansible Project
<[email protected]<mailto:[email protected]>>
wrote:
Here is an example of using expect from the ansible-doc shell output.
# You can use shell to run other executables to perform actions inline
- name: Run expect to wait for a successful PXE boot via out-of-band CIMC
ansible.builtin.shell: |
set timeout 300
spawn ssh admin@{{ cimc_host }}
expect "password:"
send "{{ cimc_password }}\n"
expect "\n{{ cimc_name }}"
send "connect host\n"
expect "pxeboot.n12"
send "\n"
exit 0
args:
executable: /usr/bin/expect
delegate_to: localhost
In your case you might need to change it to look like this:
- 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"
I have not done this myself. This is just a guess based on the ansible-doc page
for the shell module.
Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123
On Sep 26, 2022, at 8:47 AM, Andrew Okullu
<[email protected]<mailto:[email protected]>> 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<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
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CABcUpdpO7UkDCuCyGwZO3QEBUZWrmmZXsP6rVb_Ekqv%3DVJr9hg%40mail.gmail.com.
--
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
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/97E050BA-3770-4799-AADF-68EFBDC2D5C9%40nist.gov<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F97E050BA-3770-4799-AADF-68EFBDC2D5C9%2540nist.gov%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cb2a17bd98ada40d77c8c08da9fbe8c95%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637997938006362531%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5NJVvH%2FsKITiGZG7CqWT%2BgQEpxpYYYmjdHXYmjHlbas%3D&reserved=0>.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/60EB0958-FCC2-45FE-9C7D-E52C53257D4F%40nist.gov.