Re: [ansible-project] Handling "file not found" for the slurp module

2022-09-26 Thread Dick Visser
Add a stat task first and use the result to conditionally run the slurp task

On Tue, 27 Sep 2022 at 05:10, Shabir Abdul Samdh 
wrote:

> Hello All,
>
> I am trying to read a file from a remote host and do some checks on its
> content using the slurp module
> .
> However I want these checks to run only if the file exists. If the file is
> not found I want to skip some of the following tasks.
>
> However, it seems like the slurp module fails when the file I am looking
> for is not found. Is there a way to handle the case of a file not being
> there gracefully when using slurp?
>
> Thank you very much
> Best regards
> ---
> Shabir
>
> --
> 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/CAGK3r_gHYeG4_M1pqzNEX8pp182oUQaQgHYpxh7mtd_iuaekNw%40mail.gmail.com
> 
> .
>
-- 
Sent from Gmail Mobile

-- 
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/CAF8BbLZAcG6Povn9c5PG2eH3o2jw4JUacYZmS95my7QnSiCAbg%40mail.gmail.com.


[ansible-project] Handling "file not found" for the slurp module

2022-09-26 Thread Shabir Abdul Samdh
Hello All,

I am trying to read a file from a remote host and do some checks on its
content using the slurp module
.
However I want these checks to run only if the file exists. If the file is
not found I want to skip some of the following tasks.

However, it seems like the slurp module fails when the file I am looking
for is not found. Is there a way to handle the case of a file not being
there gracefully when using slurp?

Thank you very much
Best regards
---
Shabir

-- 
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/CAGK3r_gHYeG4_M1pqzNEX8pp182oUQaQgHYpxh7mtd_iuaekNw%40mail.gmail.com.


Re: [ansible-project] Expect still prompting to continue

2022-09-26 Thread Alex Wanderley
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  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
> 
> .
>


-- 



[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.


Re: [ansible-project] become_password and ansibe variable

2022-09-26 Thread 'Django [Bastard Operator from Hell]' via Ansible Project
O.K., no problem, so I ask 'bout that password while the initial 
ansible-configuration done by my ansible-playbook. Then it will be 
stored in my inventory and everything works fine as ecpected.


Thanx 4 help!

--
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/e2042060-055d-c932-926d-0555788305eb%40nausch.org.


Re: [ansible-project] become_password and ansibe variable

2022-09-26 Thread Brian Coca
No, this is specifically avoided.

-- 
--
Brian Coca

-- 
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/CACVha7f6Za0uKvfPq%3D-A2r78ZUGKD-9bcuY0WHGhY4GtJiis_Q%40mail.gmail.com.


Re: [ansible-project] Expect still prompting to continue

2022-09-26 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
The ansible-doc page for ansible.builtin.shell shows it including the newline 
[enter].

# 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


Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

On Sep 26, 2022, at 9:22 AM, Kevin Shumaker 
mailto:kevin.shuma...@gmail.com>> wrote:

In my non-ansible scripts, I just sent the 'y' or the 'n' ans the request isn't 
for a "y[enter]" and they (the apps) can get confused when the see something 
other than what they want...

On Monday, September 26, 2022 at 9:17:54 AM UTC-4 
uto...@gmail.com wrote:
`send "y\n"` is a "y" followed by a new-line character, which may work (I would 
be surprised), but most of the 'expect' examples I'm seeing would use `send 
"y\r"` which is a "y" followed by a return.



--
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/54718c1d-ab12-4da6-b3ce-384ad9171d45n%40googlegroups.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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8B4895A5-0FA9-4C86-B034-8035AD932E5C%40nist.gov.


Re: [ansible-project] Expect still prompting to continue

2022-09-26 Thread Kevin Shumaker
In my non-ansible scripts, I just sent the 'y' or the 'n' ans the request 
isn't for a "y[enter]" and they (the apps) can get confused when the see 
something other than what they want...

On Monday, September 26, 2022 at 9:17:54 AM UTC-4 uto...@gmail.com wrote:

> `send "y\n"` is a "y" followed by a new-line character, which may work (I 
> would be surprised), but most of the 'expect' examples I'm seeing would use 
> `send "y\r"` which is a "y" followed by a return.
>
>
>

-- 
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/54718c1d-ab12-4da6-b3ce-384ad9171d45n%40googlegroups.com.


Re: [ansible-project] Expect still prompting to continue

2022-09-26 Thread Todd Lewis
`send "y\n"` is a "y" followed by a new-line character, which may work (I 
would be surprised), but most of the 'expect' examples I'm seeing would use 
`send "y\r"` which is a "y" followed by a return.

On Monday, September 26, 2022 at 9:07:51 AM UTC-4 kevin.s...@gmail.com 
wrote:

> Is 'send "y\n" ' a valid response to the expect? Or should it be just "y" 
> or just "n"? 
>
> On Monday, September 26, 2022 at 9:05:01 AM UTC-4 aok...@gmail.com wrote:
>
>> Thanks @Walter. Let me try and revert.
>>
>> Kind Regards
>> Andrew Okullu
>> Mob:+256-772-418560 <+256%20772%20418560>, +256754213295 
>> <+256%20754%20213295> 
>> | Skype:aokullu | twitter: @aokullu | gtalk: aokullu 
>>
>> On Mon, Sep 26, 2022 at 3:58 PM 'Rowe, Walter P. (Fed)' via Ansible 
>> Project  wrote:
>>
>>> 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 <(202)%20355-4123>
>>>
>>> On Sep 26, 2022, at 8:56 AM, 'Rowe, Walter P. (Fed)' via Ansible Project 
>>>  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 <(202)%20355-4123>
>>>
>>> On Sep 26, 2022, at 8:47 AM, Andrew Okullu  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 <+256%20772%20418560>, +256754213295 
>>> <+256%20754%20213295> 
>>> | 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-proje...@googlegroups.com.
>>> To vi

Re: [ansible-project] Expect still prompting to continue

2022-09-26 Thread Kevin Shumaker
Is 'send "y\n" ' a valid response to the expect? Or should it be just "y" 
or just "n"? 

On Monday, September 26, 2022 at 9:05:01 AM UTC-4 aok...@gmail.com wrote:

> Thanks @Walter. Let me try and revert.
>
> Kind Regards
> Andrew Okullu
> Mob:+256-772-418560 <+256%20772%20418560>, +256754213295 
> <+256%20754%20213295> 
> | Skype:aokullu | twitter: @aokullu | gtalk: aokullu 
>
> On Mon, Sep 26, 2022 at 3:58 PM 'Rowe, Walter P. (Fed)' via Ansible 
> Project  wrote:
>
>> 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 <(202)%20355-4123>
>>
>> On Sep 26, 2022, at 8:56 AM, 'Rowe, Walter P. (Fed)' via Ansible Project <
>> ansible...@googlegroups.com> 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 <(202)%20355-4123>
>>
>> On Sep 26, 2022, at 8:47 AM, Andrew Okullu  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 <+256%20772%20418560>, +256754213295 
>> <+256%20754%20213295> 
>> | 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-proje...@googlegroups.com.
>> 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 ansible-proje...@googlegroups.co

Re: [ansible-project] Expect still prompting to continue

2022-09-26 Thread Andrew Okullu
Thanks @Walter. Let me try and revert.

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


On Mon, Sep 26, 2022 at 3:58 PM 'Rowe, Walter P. (Fed)' via Ansible Project
 wrote:

> 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 <
> ansible-project@googlegroups.com> 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  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
> .
>
>
>
> --
> 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/97E050BA-3770-4799-AADF-68EFBDC2D5C9%40nist.gov
> 

Re: [ansible-project] Expect still prompting to continue

2022-09-26 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
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 
mailto:ansible-project@googlegroups.com>> 
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 
mailto: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.


--
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/97E050BA-3770-4799-AADF-68EFBDC2D5C9%40nist.gov.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and 

Re: [ansible-project] Expect still prompting to continue

2022-09-26 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
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 
mailto: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.

-- 
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/97E050BA-3770-4799-AADF-68EFBDC2D5C9%40nist.gov.


[ansible-project] Expect still prompting to continue

2022-09-26 Thread Andrew Okullu
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.


Re: [ansible-project] creating a postgres user - non default postgres port

2022-09-26 Thread Dick Visser
This is correct, you supplied the port parameter at the task level itself,
while you should provide it to the task.

Indent one level more.

On Mon, 26 Sep 2022 at 12:10, dulhaver via Ansible Project <
ansible-project@googlegroups.com> wrote:

> I am trying to create a postgres user/role with
> community.postgresql.postgresql_user.
> The instance I am trying to address runs on port 5436 so my TASK looks like
>
>
> 
>   - name: create db admin user
> community.postgresql.postgresql_user:
>   name: "{{ item }}"
> become: true
> port: "{{ pg_service_port.stdout }}"
> loop:
>   - "{{ pg_service_admin }}"
>
> 
>
> the pg_service_port.stdout value is created earlier in my playbook and
> equals to 5436 in the example here
>
> however creation of the postgres user throws this error at me:
>
>ssh: connect to host vm-414001-0227.step.zrz.dvz.cn-mv.de port 5436
>
> this looks as it the expected port is used to try connection to my remote
> host via ssh for that particular TASK, not logging in to postgresql.
>
> the docs imply something else though
>
>- port
> Database port to connect to.
> (Aliases: login_port)[Default: 5432]
> type: int
>
> so ... what is my misinterpretation here?
>
> I can make it work with a shell command, so at least I can confirm the
> variables and basic logic works
>
>
> 
>   - name: create db_admin user with shell
> ansible.builtin.shell:
>   cmd:
> '/opt/db/postgres/postgresql-12.11-postgis-3.2.1-el8-ina1/bin/psql -p {{
> pg_service_port.stdout }} -c "CREATE ROLE {{ pg_service_admin }};"'
> become: true
>
> 
>
> --
> 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/143191617.565062.1664186997508%40office.mailbox.org
> .
>
-- 
Sent from Gmail Mobile

-- 
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/CAF8BbLb_kdHYqe64WB3KWBZ1Bv-udY1mMkqkn9br-a9JkOZ63A%40mail.gmail.com.


[ansible-project] creating a postgres user - non default postgres port

2022-09-26 Thread dulhaver via Ansible Project
I am trying to create a postgres user/role with 
community.postgresql.postgresql_user.
The instance I am trying to address runs on port 5436 so my TASK looks like


  - name: create db admin user
community.postgresql.postgresql_user:
  name: "{{ item }}"
become: true
port: "{{ pg_service_port.stdout }}"
loop:
  - "{{ pg_service_admin }}"


the pg_service_port.stdout value is created earlier in my playbook and equals 
to 5436 in the example here

however creation of the postgres user throws this error at me:

   ssh: connect to host vm-414001-0227.step.zrz.dvz.cn-mv.de port 5436

this looks as it the expected port is used to try connection to my remote host 
via ssh for that particular TASK, not logging in to postgresql. 

the docs imply something else though

   - port
Database port to connect to.
(Aliases: login_port)[Default: 5432]
type: int

so ... what is my misinterpretation here?

I can make it work with a shell command, so at least I can confirm the 
variables and basic logic works


  - name: create db_admin user with shell
ansible.builtin.shell:
  cmd: '/opt/db/postgres/postgresql-12.11-postgis-3.2.1-el8-ina1/bin/psql 
-p {{ pg_service_port.stdout }} -c "CREATE ROLE {{ pg_service_admin }};"'
become: true


-- 
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/143191617.565062.1664186997508%40office.mailbox.org.


Re: [ansible-project] create variable from value gathered on remote

2022-09-26 Thread Todd Lewis
Better put a `-n` on that `sort`.

On Tuesday, September 20, 2022 at 5:13:40 AM UTC-4 dulh...@mailbox.org 
wrote:

> this is how I manged this in the end. probably the solution suggested by 
> @Vladimit Botka is more scientific but I could not indorporate the find 
> operation required with the rest of the suggestion
>
>
> ###
> - name: detect port number for new service & put it into the 
> "pg_service_port" variable
> ansible.builtin.shell:
> cmd: "current_port=$(grep 'PGPORT=' .*.env | cut -d= -f2 | sort | tail -1) 
> && new_port=$((current_port+1)) && echo $new_port"
> chdir: /opt/db/postgres/bin/
> register: pg_service_port
> become: true
>
> - name: Print "pg_service_port.stdout" value
> ansible.builtin.debug:
> # var: pg_service_port
> msg: "{{ pg_service_port.stdout }}"
>
> ###
>
> I use "{{ pg_service_port.stdout }}" later on for defining the port# of 
> the new postgres service
>
> thks everybody for the input. I learned a lot, even though I do not use 
> everything ini this particular case yet.
>
>
>
> > On 09/19/2022 5:34 PM CEST dulhaver via Ansible Project <
> ansible...@googlegroups.com> wrote:
> > 
> > 
> > > On 09/19/2022 4:25 PM CEST Todd Lewis  wrote:
> > > 
> > > do this:
> > > 
> > > loop: "{{ found_files.files | map(attribute='path') | map('basename') 
> | list }}"
> > 
> > great, that works. So one part of the puzzle is solved, thx
> > 
> > -- 
> > 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/1197590870.58407.1663601642760%40office.mailbox.org
> .
>

-- 
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/53826e41-1c48-4a5b-93c5-cfa75de00486n%40googlegroups.com.