Re: [ansible-project] How to split value from list

2020-07-06 Thread Jenisha T
This logic works. Thankyou

On Tuesday, 7 July 2020 at 10:52:51 UTC+5:30 Karl Auer wrote:

> so what's wrong with:
>
> USR="jenisha"
> FOUND=`grep $USR /etc/passwd | cut -d: -f1`
> if [ -z "$FOUND" ] ; then
>echo "No such user: $USR"
> else
># do whatever...
> fi
>
> ?
>
> Regards, K.
>
>
> On Tue, Jul 7, 2020 at 3:11 PM T. JENISHA  wrote:
>
>> In my case cut doesn't work. I m searching for a particular user from a 
>> password.
>> $ grep anil /etc/passwd
>>
>>
>> Best Regards
>> Jenisha T
>> Whatsapp: +91 07598087866 <+91%2075980%2087866>
>>
>>
>>
>>
>>
>> On Mon, 6 Jul 2020 at 19:50, Stefan Hornburg (Racke)  
>> wrote:
>>
>>> On 7/6/20 3:32 PM, Srinivas Naram wrote:
>>> > Hello Jenisha,
>>> > 
>>> > Assuming that you are getting this value from /etc/passwd., try to 
>>> change you command
>>> > 
>>> >  tail -1 /etc/passwd | awk '{split($0,a,":"); print a[1]}'
>>> > 
>>>
>>> cut -d : -f 1 is more concise and readable than your awk command.
>>>
>>> Otherwise I would really like to know why Jenisha resorts to reading the 
>>> password file.
>>>
>>> Regards
>>>  racke
>>>
>>>
>>> > On Mon, Jul 6, 2020 at 6:35 PM Dick Visser >> > wrote:
>>> > 
>>> > you should either use set_fact, or register. Both doesn't make 
>>> sense.
>>> > 
>>> > On Mon, 6 Jul 2020 at 13:44, Jenisha T >> joy...@gmail.com>> wrote:
>>> > >
>>> > > Hi
>>> > > Could you pls help me with the splitting value from the list. I 
>>> need to extract first value anil before ('':')
>>> > >
>>> > >  grep_atm.stdout_lines output below
>>> > >
>>> > > ok: [localhost] => {
>>> > > "msg": "anil:x:500:500:Anil:/home/anil:/bin/bash
>>> > > "
>>> > > }
>>> > >
>>> > > I tried,
>>> > > - set_fact:
>>> > >user_name: "{{ grep_atm.stdout_lines }}"
>>> > > register: user_name.split(':')[0]
>>> > >  - debug:
>>> > > var: user_name.split(':')[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
>>> > ansible-proje...@googlegroups.com >> ansible-project%2bunsu...@googlegroups.com>.
>>> > > To view this discussion on the web visit
>>> > 
>>> https://groups.google.com/d/msgid/ansible-project/42fb2917-8336-42a2-979a-44573e91fd77n%40googlegroups.com
>>> .
>>> > 
>>> > 
>>> > 
>>> > -- 
>>> > Dick Visser
>>> > Trust & Identity Service Operations Manager
>>> > GÉANT
>>> > 
>>> > -- 
>>> > 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 >> ansible-project%2bunsu...@googlegroups.com>.
>>> > To view this discussion on the web visit
>>> > 
>>> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMo1%3D9XhddQY_BDaREzKLRGS_xDvZbtu1o5UCj0R1h%3Duw%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.com >> ansible-proje...@googlegroups.com>.
>>> > To view this discussion on the web visit
>>> > 
>>> https://groups.google.com/d/msgid/ansible-project/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com
>>> > <
>>> https://groups.google.com/d/msgid/ansible-project/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com?utm_medium=email_source=footer
>>> >.
>>>
>>>
>>> -- 
>>> Ecommerce and Linux consulting + Perl and web application programming.
>>> Debian and Sympa administration. Provisioning with Ansible.
>>>
>>> -- 
>>> 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/b4c85876-5359-f104-cd6f-03667cd7f93b%40linuxia.de
>>> .
>>>
>> -- 
>> 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/CAAGhZYjxvOgKKa1pFfh5oAp2JDzyeOmW0SE8zFM_j3vTefgaUw%40mail.gmail.com
>>  
>> 
>> .
>>
>
>
> -- 
>
> *Karl Auer* { manager, systems support }
> P: 1300 759 975
> E: 

Re: [ansible-project] How to split value from list

2020-07-06 Thread T. JENISHA
Thank you, everyone, grep followed by cut gave me desired output



Best Regards
Jenisha T
Whatsapp: +91 07598087866





On Mon, 6 Jul 2020 at 19:50, Stefan Hornburg (Racke) 
wrote:

> On 7/6/20 3:32 PM, Srinivas Naram wrote:
> > Hello Jenisha,
> >
> > Assuming that you are getting this value from /etc/passwd., try to
> change you command
> >
> >  tail -1 /etc/passwd | awk '{split($0,a,":"); print a[1]}'
> >
>
> cut -d : -f 1 is more concise and readable than your awk command.
>
> Otherwise I would really like to know why Jenisha resorts to reading the
> password file.
>
> Regards
>  racke
>
>
> > On Mon, Jul 6, 2020 at 6:35 PM Dick Visser  > wrote:
> >
> > you should either use set_fact, or register. Both doesn't make sense.
> >
> > On Mon, 6 Jul 2020 at 13:44, Jenisha T  joyj...@gmail.com>> wrote:
> > >
> > > Hi
> > > Could you pls help me with the splitting value from the list. I
> need to extract first value anil before ('':')
> > >
> > >  grep_atm.stdout_lines output below
> > >
> > > ok: [localhost] => {
> > > "msg": "anil:x:500:500:Anil:/home/anil:/bin/bash
> > > "
> > > }
> > >
> > > I tried,
> > > - set_fact:
> > >user_name: "{{ grep_atm.stdout_lines }}"
> > > register: user_name.split(':')[0]
> > >  - debug:
> > > var: user_name.split(':')[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
> > ansible-project+unsubscr...@googlegroups.com  ansible-project%2bunsubscr...@googlegroups.com>.
> > > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/42fb2917-8336-42a2-979a-44573e91fd77n%40googlegroups.com
> .
> >
> >
> >
> > --
> > Dick Visser
> > Trust & Identity Service Operations Manager
> > GÉANT
> >
> > --
> > 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  ansible-project%2bunsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMo1%3D9XhddQY_BDaREzKLRGS_xDvZbtu1o5UCj0R1h%3Duw%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  ansible-project+unsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/ansible-project/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com?utm_medium=email_source=footer
> >.
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> 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/b4c85876-5359-f104-cd6f-03667cd7f93b%40linuxia.de
> .
>

-- 
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/CAAGhZYhrp1iWGeOY%2BD9ns0J3nVeLA9BGvjVnMEOW75CxygXxQQ%40mail.gmail.com.


Re: [ansible-project] How to split value from list

2020-07-06 Thread Srinivas Naram
Did you try this ?

 user_name: "{{ my_string[0].split(':')[0] }}"

On Tue, Jul 7, 2020 at 10:52 AM Karl Auer  wrote:

> so what's wrong with:
>
> USR="jenisha"
> FOUND=`grep $USR /etc/passwd | cut -d: -f1`
> if [ -z "$FOUND" ] ; then
>echo "No such user: $USR"
> else
># do whatever...
> fi
>
> ?
>
> Regards, K.
>
>
> On Tue, Jul 7, 2020 at 3:11 PM T. JENISHA  wrote:
>
>> In my case cut doesn't work. I m searching for a particular user from a
>> password.
>> $ grep anil /etc/passwd
>>
>>
>> Best Regards
>> Jenisha T
>> Whatsapp: +91 07598087866
>>
>>
>>
>>
>>
>> On Mon, 6 Jul 2020 at 19:50, Stefan Hornburg (Racke) 
>> wrote:
>>
>>> On 7/6/20 3:32 PM, Srinivas Naram wrote:
>>> > Hello Jenisha,
>>> >
>>> > Assuming that you are getting this value from /etc/passwd., try to
>>> change you command
>>> >
>>> >  tail -1 /etc/passwd | awk '{split($0,a,":"); print a[1]}'
>>> >
>>>
>>> cut -d : -f 1 is more concise and readable than your awk command.
>>>
>>> Otherwise I would really like to know why Jenisha resorts to reading the
>>> password file.
>>>
>>> Regards
>>>  racke
>>>
>>>
>>> > On Mon, Jul 6, 2020 at 6:35 PM Dick Visser >> > wrote:
>>> >
>>> > you should either use set_fact, or register. Both doesn't make
>>> sense.
>>> >
>>> > On Mon, 6 Jul 2020 at 13:44, Jenisha T >> joyj...@gmail.com>> wrote:
>>> > >
>>> > > Hi
>>> > > Could you pls help me with the splitting value from the list. I
>>> need to extract first value anil before ('':')
>>> > >
>>> > >  grep_atm.stdout_lines output below
>>> > >
>>> > > ok: [localhost] => {
>>> > > "msg": "anil:x:500:500:Anil:/home/anil:/bin/bash
>>> > > "
>>> > > }
>>> > >
>>> > > I tried,
>>> > > - set_fact:
>>> > >user_name: "{{ grep_atm.stdout_lines }}"
>>> > > register: user_name.split(':')[0]
>>> > >  - debug:
>>> > > var: user_name.split(':')[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
>>> > ansible-project+unsubscr...@googlegroups.com >> ansible-project%2bunsubscr...@googlegroups.com>.
>>> > > To view this discussion on the web visit
>>> >
>>> https://groups.google.com/d/msgid/ansible-project/42fb2917-8336-42a2-979a-44573e91fd77n%40googlegroups.com
>>> .
>>> >
>>> >
>>> >
>>> > --
>>> > Dick Visser
>>> > Trust & Identity Service Operations Manager
>>> > GÉANT
>>> >
>>> > --
>>> > 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 >> ansible-project%2bunsubscr...@googlegroups.com>.
>>> > To view this discussion on the web visit
>>> >
>>> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMo1%3D9XhddQY_BDaREzKLRGS_xDvZbtu1o5UCj0R1h%3Duw%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 >> ansible-project+unsubscr...@googlegroups.com>.
>>> > To view this discussion on the web visit
>>> >
>>> https://groups.google.com/d/msgid/ansible-project/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com
>>> > <
>>> https://groups.google.com/d/msgid/ansible-project/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com?utm_medium=email_source=footer
>>> >.
>>>
>>>
>>> --
>>> Ecommerce and Linux consulting + Perl and web application programming.
>>> Debian and Sympa administration. Provisioning with Ansible.
>>>
>>> --
>>> 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/b4c85876-5359-f104-cd6f-03667cd7f93b%40linuxia.de
>>> .
>>>
>> --
>> 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/CAAGhZYjxvOgKKa1pFfh5oAp2JDzyeOmW0SE8zFM_j3vTefgaUw%40mail.gmail.com
>> 
>> .
>>
>
>
> --
>
> *Karl Auer* { manager, systems support }

Re: [ansible-project] How to split value from list

2020-07-06 Thread Karl Auer
so what's wrong with:

USR="jenisha"
FOUND=`grep $USR /etc/passwd | cut -d: -f1`
if [ -z "$FOUND" ] ; then
   echo "No such user: $USR"
else
   # do whatever...
fi

?

Regards, K.


On Tue, Jul 7, 2020 at 3:11 PM T. JENISHA  wrote:

> In my case cut doesn't work. I m searching for a particular user from a
> password.
> $ grep anil /etc/passwd
>
>
> Best Regards
> Jenisha T
> Whatsapp: +91 07598087866
>
>
>
>
>
> On Mon, 6 Jul 2020 at 19:50, Stefan Hornburg (Racke) 
> wrote:
>
>> On 7/6/20 3:32 PM, Srinivas Naram wrote:
>> > Hello Jenisha,
>> >
>> > Assuming that you are getting this value from /etc/passwd., try to
>> change you command
>> >
>> >  tail -1 /etc/passwd | awk '{split($0,a,":"); print a[1]}'
>> >
>>
>> cut -d : -f 1 is more concise and readable than your awk command.
>>
>> Otherwise I would really like to know why Jenisha resorts to reading the
>> password file.
>>
>> Regards
>>  racke
>>
>>
>> > On Mon, Jul 6, 2020 at 6:35 PM Dick Visser > > wrote:
>> >
>> > you should either use set_fact, or register. Both doesn't make
>> sense.
>> >
>> > On Mon, 6 Jul 2020 at 13:44, Jenisha T > joyj...@gmail.com>> wrote:
>> > >
>> > > Hi
>> > > Could you pls help me with the splitting value from the list. I
>> need to extract first value anil before ('':')
>> > >
>> > >  grep_atm.stdout_lines output below
>> > >
>> > > ok: [localhost] => {
>> > > "msg": "anil:x:500:500:Anil:/home/anil:/bin/bash
>> > > "
>> > > }
>> > >
>> > > I tried,
>> > > - set_fact:
>> > >user_name: "{{ grep_atm.stdout_lines }}"
>> > > register: user_name.split(':')[0]
>> > >  - debug:
>> > > var: user_name.split(':')[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
>> > ansible-project+unsubscr...@googlegroups.com > ansible-project%2bunsubscr...@googlegroups.com>.
>> > > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/ansible-project/42fb2917-8336-42a2-979a-44573e91fd77n%40googlegroups.com
>> .
>> >
>> >
>> >
>> > --
>> > Dick Visser
>> > Trust & Identity Service Operations Manager
>> > GÉANT
>> >
>> > --
>> > 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 > ansible-project%2bunsubscr...@googlegroups.com>.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMo1%3D9XhddQY_BDaREzKLRGS_xDvZbtu1o5UCj0R1h%3Duw%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 > ansible-project+unsubscr...@googlegroups.com>.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/ansible-project/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com
>> > <
>> https://groups.google.com/d/msgid/ansible-project/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com?utm_medium=email_source=footer
>> >.
>>
>>
>> --
>> Ecommerce and Linux consulting + Perl and web application programming.
>> Debian and Sympa administration. Provisioning with Ansible.
>>
>> --
>> 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/b4c85876-5359-f104-cd6f-03667cd7f93b%40linuxia.de
>> .
>>
> --
> 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/CAAGhZYjxvOgKKa1pFfh5oAp2JDzyeOmW0SE8zFM_j3vTefgaUw%40mail.gmail.com
> 
> .
>


-- 

*Karl Auer* { manager, systems support }
P: 1300 759 975
E: ka...@2pisoftware.com
2pisoftware.com

GPG/PGP : DF6A 43E5 FB9D D884 C6CA CD7F 5278 212D E80F C107
Previous: 301B 1F4E 624D AD99 242C 7A68 EC24 7113 E854 4A4E

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

[ansible-project] Looping CF Templates with items loops and its reporting an error

2020-07-06 Thread ameya agashe
Hello,

Here is the tasks/main.yml content
```
roles/patching-cf-ssm/tasks/main.yml
---
# tasks file for patching-cf-ssm
- name: create a cloudformation stack
  cloudformation:
stack_name: "ansible-cloudformation"
state: "present"
disable_rollback: true
template: roles/patching-cf-ssm/files/{{ item }}
with_file:
  - PatchBaseline.yml
  - MaintenanceWindow.yml
...
```

Unfortunately throws me back an error as below

fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an 
undefined variable. The error was: 'item' is undefined\n\nThe error appears 
to be in 'roles/patching-cf-ssm/tasks/main.yml': line 3, column 3, but 
may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe 
offending line appears to be:\n\n# tasks file for patching-cf-ssm\n- name: 
create a cloudformation stack\n  ^ here\n"}

I used double quotes for roles/patching-cf-ssm/files/{{ item }} but still 
no luck.

Any idea why?

Regards,
Ameya

-- 
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/833d4832-ea66-4dc8-937f-5e4a99ab4075o%40googlegroups.com.


Re: [ansible-project] How to split value from list

2020-07-06 Thread T. JENISHA
In my case cut doesn't work. I m searching for a particular user from a
password.
$ grep anil /etc/passwd


Best Regards
Jenisha T
Whatsapp: +91 07598087866





On Mon, 6 Jul 2020 at 19:50, Stefan Hornburg (Racke) 
wrote:

> On 7/6/20 3:32 PM, Srinivas Naram wrote:
> > Hello Jenisha,
> >
> > Assuming that you are getting this value from /etc/passwd., try to
> change you command
> >
> >  tail -1 /etc/passwd | awk '{split($0,a,":"); print a[1]}'
> >
>
> cut -d : -f 1 is more concise and readable than your awk command.
>
> Otherwise I would really like to know why Jenisha resorts to reading the
> password file.
>
> Regards
>  racke
>
>
> > On Mon, Jul 6, 2020 at 6:35 PM Dick Visser  > wrote:
> >
> > you should either use set_fact, or register. Both doesn't make sense.
> >
> > On Mon, 6 Jul 2020 at 13:44, Jenisha T  joyj...@gmail.com>> wrote:
> > >
> > > Hi
> > > Could you pls help me with the splitting value from the list. I
> need to extract first value anil before ('':')
> > >
> > >  grep_atm.stdout_lines output below
> > >
> > > ok: [localhost] => {
> > > "msg": "anil:x:500:500:Anil:/home/anil:/bin/bash
> > > "
> > > }
> > >
> > > I tried,
> > > - set_fact:
> > >user_name: "{{ grep_atm.stdout_lines }}"
> > > register: user_name.split(':')[0]
> > >  - debug:
> > > var: user_name.split(':')[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
> > ansible-project+unsubscr...@googlegroups.com  ansible-project%2bunsubscr...@googlegroups.com>.
> > > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/42fb2917-8336-42a2-979a-44573e91fd77n%40googlegroups.com
> .
> >
> >
> >
> > --
> > Dick Visser
> > Trust & Identity Service Operations Manager
> > GÉANT
> >
> > --
> > 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  ansible-project%2bunsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMo1%3D9XhddQY_BDaREzKLRGS_xDvZbtu1o5UCj0R1h%3Duw%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  ansible-project+unsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/ansible-project/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com?utm_medium=email_source=footer
> >.
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> 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/b4c85876-5359-f104-cd6f-03667cd7f93b%40linuxia.de
> .
>

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


Re: [ansible-project] How to split value from list

2020-07-06 Thread T. JENISHA
Hi Team
I get below error when I use split directly,

The error was: 'list object' has no attribute 'split'

How to unlist in ansible


Best Regards
Jenisha T
Whatsapp: +91 07598087866





On Mon, 6 Jul 2020 at 20:27, Vladimir Botka  wrote:

> On Mon, 6 Jul 2020 04:44:18 -0700 (PDT)
> Jenisha T  wrote:
>
> > extract first value* anil *before (':')
> >
> > "msg": "*anil*:x:500:500:Anil:/home/anil:/bin/bash
> >
>
>user_name: "{{ my_string.split(':')[0] }}"
>
> This is the correct expression, given the data is in the variable
> "my_string",
> wherever it might come from.
>
> --
> Vladimir Botka
>

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


Re: [ansible-project] The conditional check 'cmdb_hwmodel.startswith('HP ')' failed

2020-07-06 Thread Nagesh sheregar
Hi Dick,

worked .. I need output results like below , do we have a call back plugin
for this?

*Socket Locator* *Status* *Size* *Max Supported Frequency* *Technology*
PROC 1 DIMM 3  Good, In Use 32.00 GB 2666 MHz RDIMM


On Sat, Jul 4, 2020 at 4:19 PM Dick Visser  wrote:

> Read the error more carefully, it says exactly what is the matter
>
> On Sat, 4 Jul 2020 at 22:15, Nagesh sheregar  wrote:
>
>> can you pelase someone let me know what i am missing here:
>>
>> Error:
>>
>> TASK [hp : hpilo_info]
>> **
>> task path: /data01/ansible/playbooks/roles/hp/tasks/main.yml:1
>> fatal: [localhost]: FAILED! => {
>> "msg": "The conditional check 'cmdb_hwmodel.startswith('HP ')'
>> failed. The error was: error while evaluating conditional
>> (cmdb_hwmodel.startswith('HP ')): 'cmdb_hwmodel' is undefined\n\nThe error
>> appears to be in '/data01/ansible/playbooks/roles/hp/tasks/main.yml': line
>> 1, column 3, but may\nbe elsewhere in the file depending on the exact
>> syntax problem.\n\nThe offending line appears to be:\n\n\n- hpilo_info:\n
>> ^ here\n"
>> }
>>
>>
>> Playbook:
>>
>> - hpilo_info:
>> host: "{{ host }}"
>> login: "{{ login }}"
>> password: "{{ password }}"
>> ssl_version:
>>  description:
>>   - The SSL version used to authenticate to the HP iLO interface.
>> default: tlsv1
>>   when: cmdb_hwmodel.startswith('HP ')
>>   delegate_to: localhost
>>   register: results
>> - fail:
>> msg: 'CMDB serial ({{ cmdb_serialno }}) does not match hardware
>> serial ({{ results.hw_system_serial }}) !'
>>   when: cmdb_serialno != results.hw_system_serial
>>
>>
>> Link:
>>
>>
>> https://docs.ansible.com/ansible/latest/modules/hpilo_info_module.html#hpilo-info-module
>>
>>
>> --
>> 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/36b84e06-097a-462c-b0e3-5ac1684c97d0o%40googlegroups.com
>> 
>> .
>>
> --
> Sent from a mobile device - please excuse the brevity, spelling and
> punctuation.
>
> --
> 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/CAL8fbwNMFOYD7Lm-4TnYDtdVk3X6qtPaMMi%3DrrSWH9A%2BBsomqA%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/CAFu5ZNxWPzSpBRYeG2x1XAOAcA1zmiRUVya3VR_tMykwtxidHA%40mail.gmail.com.


[ansible-project] Trying to install Feature update to Windows 10, version 1909 with Ansible

2020-07-06 Thread Alan Woods
Hello I am trying to install windows 10 feature updates or upgrades. The 
playbook I am using seems to download it but it will not install it. I 
still need to go into windows updates and hit retry then it installs.  This 
is the playbook I am currently using:


---
- hosts: win10-pro-1
 gather_facts: yes
 tasks:
   - name: Re-Boot PC before upgrade
 win_reboot:

- name: Upgrade Windows 10
 win_updates:
   category_names:
 - Upgrades
   state: installed
 register: update_result

- name: reboot host if required
 win_reboot:
 when: update_result.reboot_required

I just added the first task to re-boot the PC first because I get errors 
sometimes that the PC needs to be re-booted first. The playbook runs with 
no errors and this is the what I get when running it.

[vagrant@controller win_10_Updates]$ ansible-playbook testFeatureUPdate.yml 

PLAY [win10-pro-1] 
***

TASK [Gathering Facts] 
***
ok: [win10-pro-1]

TASK [Re-Boot PC before upgrade] 
*
changed: [win10-pro-1]

TASK [Upgrade Windows 10] 

changed: [win10-pro-1]

TASK [reboot host if required] 
***
changed: [win10-pro-1]

PLAY RECAP 
***
win10-pro-1: ok=4changed=3unreachable=0failed=0 
   skipped=0rescued=0ignored=0   

[vagrant@controller win_10_Updates]$ 



I am trying to get Ansible to install the upgrade and re-boot the PC if it 
needs to be without having to touch the windows 10 PC at all. Does anyone 
know if this is achievable? 

-- 
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/8094f3ed-d2e5-4988-a3b7-fb79f3abf6dbo%40googlegroups.com.


Re: [ansible-project] multithread ansible

2020-07-06 Thread Dick Visser
https://docs.ansible.com/ansible/latest/user_guide/playbooks_strategies.html

On Mon, 6 Jul 2020 at 17:45, Tony Wong  wrote:
>
> Can ansible do multithread and update all my VMwarte tools all at the same 
> time or does it have to be one by one (one after another) in the host list?
>
> --
> 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/CALmkhkqFYmGRu84f_ktsjHcZU%3Dwb%3Di8CNN4bMAwJ6XLAh2rfSQ%40mail.gmail.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

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


[ansible-project] multithread ansible

2020-07-06 Thread Tony Wong
Can ansible do multithread and update all my VMwarte tools all at the same
time or does it have to be one by one (one after another) in the host list?

-- 
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/CALmkhkqFYmGRu84f_ktsjHcZU%3Dwb%3Di8CNN4bMAwJ6XLAh2rfSQ%40mail.gmail.com.


[ansible-project] vmware tools update.completed but shows failed status

2020-07-06 Thread Tony Wong
I got following to update vmware tools on windows vm

---
- name: testing win_get_url
  hosts: all
  tasks:
- name: Create Directory if not exist
  win_file:
path: C:\temp
state: directory

- name: Download exe to winbox
  win_get_url:
url:
https://packages.vmware.com/tools/esx/latest/windows/x64/VMware-tools-11.1.0-16036546-x86_64.exe
dest: C:\temp\VMware-tools-11.1.0-16036546-x86_64.exe

- name: Install Vmware tools Silent
  win_command: C:\temp\VMware-tools-11.1.0-16036546-x86_64.exe /S /v
"/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs"


it updates the tools successfully but not sure why its giving a failed
status error

TASK [Install Vmware tools Silent]
***
task path: /home/tony/windows/download2.yml:15
Using module file
/usr/lib/python2.7/dist-packages/ansible/modules/windows/win_command.ps1
Pipelining is enabled.
 ESTABLISH WINRM CONNECTION FOR USER: adm-...@xxx.xxx
on PORT 5986 TO rw-ctxapp-02.xxx.xxx
EXEC (via pipeline wrapper)
fatal: [rw-ctxapp-02.xxx.xxx]: FAILED! => {
"changed": true,
"cmd": "C:\\temp\\VMware-tools-11.1.0-16036546-x86_64.exe /S /v \"/qn
REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs\"",
"delta": "0:02:31.265796",
"end": "2020-07-06 03:17:27.895492",
"msg": "non-zero return code",
"rc": 3010,
"start": "2020-07-06 03:14:56.629695",
"stderr": "",
"stderr_lines": [],
"stdout": "",
"stdout_lines": []
}

PLAY RECAP
***
rw-ctxapp-02.xxx.xxx : ok=3changed=1unreachable=0failed=1
 skipped=0rescued=0ignored=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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALmkhkqxK9EfJwc8Wwx8UMAk%3D_XvOpjTPAqWrSvH4xz2dGjF3Q%40mail.gmail.com.


Re: [ansible-project] Bonding with ansible

2020-07-06 Thread Dick Visser
If you show what the current data structure exactly looks like, and
how this ties into what you want your system to look like, then we
might be able to help.
(i'm only vaguely familiar with the network interface stuff...)

On Mon, 6 Jul 2020 at 15:56, marcos  wrote:
>
> I already know hot to bond to interfaces with ansible. But here is were it 
> gets complicated: I need to make a playbook that lists all the facts, 
> filtering just the interfaces, classifying them by speed and bonding them 
> automatically.
> The idea would be to start with something like this, but I'm completely lost.
>
> hosts: pve1 remote_user: root tasks:
>
> name: print interfaces debug: msg: "{{ ansible_facts | dict2items | 
> selectattr('value.speed', 'defined') | map(attribute='value') | list}}"
>
> If someone knows and explains me how to do it, it would be very nice
>
> --
> 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/33283a12-73b2-4091-a399-e429b5095417o%40googlegroups.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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/CAL8fbwMy02m%2Buw%2BsRn7Ruc%3DgEY-vO3jy1T7oXE-pvh9eMUcEXQ%40mail.gmail.com.


Re: [ansible-project] How to split value from list

2020-07-06 Thread Vladimir Botka
On Mon, 6 Jul 2020 04:44:18 -0700 (PDT)
Jenisha T  wrote:

> extract first value* anil *before (':')
>
> "msg": "*anil*:x:500:500:Anil:/home/anil:/bin/bash
>

   user_name: "{{ my_string.split(':')[0] }}"

This is the correct expression, given the data is in the variable "my_string",
wherever it might come from.

-- 
Vladimir Botka

-- 
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/20200706165717.0fa53926%40gmail.com.


pgpghlnoi_M81.pgp
Description: OpenPGP digital signature


Re: [ansible-project] How to split value from list

2020-07-06 Thread Stefan Hornburg (Racke)
On 7/6/20 3:32 PM, Srinivas Naram wrote:
> Hello Jenisha,
> 
> Assuming that you are getting this value from /etc/passwd., try to change you 
> command
> 
>  tail -1 /etc/passwd | awk '{split($0,a,":"); print a[1]}'
> 

cut -d : -f 1 is more concise and readable than your awk command.

Otherwise I would really like to know why Jenisha resorts to reading the 
password file.

Regards
 racke


> On Mon, Jul 6, 2020 at 6:35 PM Dick Visser  > wrote:
> 
> you should either use set_fact, or register. Both doesn't make sense.
> 
> On Mon, 6 Jul 2020 at 13:44, Jenisha T  > wrote:
> >
> > Hi
> > Could you pls help me with the splitting value from the list. I need to 
> extract first value anil before ('':')
> >
> >  grep_atm.stdout_lines output below
> >
> > ok: [localhost] => {
> >     "msg": "anil:x:500:500:Anil:/home/anil:/bin/bash
> > "
> > }
> >
> > I tried,
> > - set_fact:
> >        user_name: "{{ grep_atm.stdout_lines }}"
> >         register: user_name.split(':')[0]
> >  - debug:
> >         var: user_name.split(':')[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
> ansible-project+unsubscr...@googlegroups.com 
> .
> > To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/ansible-project/42fb2917-8336-42a2-979a-44573e91fd77n%40googlegroups.com.
> 
> 
> 
> -- 
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
> 
> -- 
> 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/CAL8fbwMo1%3D9XhddQY_BDaREzKLRGS_xDvZbtu1o5UCj0R1h%3Duw%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/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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/b4c85876-5359-f104-cd6f-03667cd7f93b%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


[ansible-project] Bonding with ansible

2020-07-06 Thread marcos
 

I already know hot to bond to interfaces with ansible. But here is were it 
gets complicated: I need to make a playbook that lists all the facts, 
filtering just the interfaces, classifying them by speed and bonding them 
automatically.
The idea would be to start with something like this, but I'm completely 
lost.

   - hosts: pve1 remote_user: root tasks: 
  - name: print interfaces debug: msg: "{{ ansible_facts | dict2items | 
  selectattr('value.speed', 'defined') | map(attribute='value') | list}}"
   
If someone knows and explains me how to do it, it would be very nice

-- 
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/33283a12-73b2-4091-a399-e429b5095417o%40googlegroups.com.


Re: [ansible-project] How to split value from list

2020-07-06 Thread Srinivas Naram
Hello Jenisha,

Assuming that you are getting this value from /etc/passwd., try to change
you command

 tail -1 /etc/passwd | awk '{split($0,a,":"); print a[1]}'

On Mon, Jul 6, 2020 at 6:35 PM Dick Visser  wrote:

> you should either use set_fact, or register. Both doesn't make sense.
>
> On Mon, 6 Jul 2020 at 13:44, Jenisha T  wrote:
> >
> > Hi
> > Could you pls help me with the splitting value from the list. I need to
> extract first value anil before ('':')
> >
> >  grep_atm.stdout_lines output below
> >
> > ok: [localhost] => {
> > "msg": "anil:x:500:500:Anil:/home/anil:/bin/bash
> > "
> > }
> >
> > I tried,
> > - set_fact:
> >user_name: "{{ grep_atm.stdout_lines }}"
> > register: user_name.split(':')[0]
> >  - debug:
> > var: user_name.split(':')[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 ansible-project+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/42fb2917-8336-42a2-979a-44573e91fd77n%40googlegroups.com
> .
>
>
>
> --
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
>
> --
> 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/CAL8fbwMo1%3D9XhddQY_BDaREzKLRGS_xDvZbtu1o5UCj0R1h%3Duw%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/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com.


Re: [ansible-project] How to split value from list

2020-07-06 Thread Dick Visser
you should either use set_fact, or register. Both doesn't make sense.

On Mon, 6 Jul 2020 at 13:44, Jenisha T  wrote:
>
> Hi
> Could you pls help me with the splitting value from the list. I need to 
> extract first value anil before ('':')
>
>  grep_atm.stdout_lines output below
>
> ok: [localhost] => {
> "msg": "anil:x:500:500:Anil:/home/anil:/bin/bash
> "
> }
>
> I tried,
> - set_fact:
>user_name: "{{ grep_atm.stdout_lines }}"
> register: user_name.split(':')[0]
>  - debug:
> var: user_name.split(':')[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 ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/42fb2917-8336-42a2-979a-44573e91fd77n%40googlegroups.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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/CAL8fbwMo1%3D9XhddQY_BDaREzKLRGS_xDvZbtu1o5UCj0R1h%3Duw%40mail.gmail.com.


Re: [ansible-project] How to split value from list

2020-07-06 Thread T. JENISHA
It supports only for the database. My output in register
Best Regards
Jenisha T
Whatsapp: +91 07598087866





On Mon, 6 Jul 2020 at 17:19, Dick Visser  wrote:

> Based on your data, look at this module:
> https://docs.ansible.com/ansible/latest/modules/getent_module.html
>
> On Mon, 6 Jul 2020 at 13:44, Jenisha T  wrote:
> >
> > Hi
> > Could you pls help me with the splitting value from the list. I need to
> extract first value anil before ('':')
> >
> >  grep_atm.stdout_lines output below
> >
> > ok: [localhost] => {
> > "msg": "anil:x:500:500:Anil:/home/anil:/bin/bash
> > "
> > }
> >
> > I tried,
> > - set_fact:
> >user_name: "{{ grep_atm.stdout_lines }}"
> > register: user_name.split(':')[0]
> >  - debug:
> > var: user_name.split(':')[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 ansible-project+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/42fb2917-8336-42a2-979a-44573e91fd77n%40googlegroups.com
> .
>
>
>
> --
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
>
> --
> 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/CAL8fbwNuqWXVNjms%3DaAcLs%2BppZitE%3DrzLjdP9fQJDdsDq-jXuw%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/CAAGhZYhiDdDCRrGkKOeOKOUMwj1NNL%2BtxUCmURvyM4yxktyrvA%40mail.gmail.com.


Re: [ansible-project] How to split value from list

2020-07-06 Thread Dick Visser
Based on your data, look at this module:
https://docs.ansible.com/ansible/latest/modules/getent_module.html

On Mon, 6 Jul 2020 at 13:44, Jenisha T  wrote:
>
> Hi
> Could you pls help me with the splitting value from the list. I need to 
> extract first value anil before ('':')
>
>  grep_atm.stdout_lines output below
>
> ok: [localhost] => {
> "msg": "anil:x:500:500:Anil:/home/anil:/bin/bash
> "
> }
>
> I tried,
> - set_fact:
>user_name: "{{ grep_atm.stdout_lines }}"
> register: user_name.split(':')[0]
>  - debug:
> var: user_name.split(':')[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 ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/42fb2917-8336-42a2-979a-44573e91fd77n%40googlegroups.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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/CAL8fbwNuqWXVNjms%3DaAcLs%2BppZitE%3DrzLjdP9fQJDdsDq-jXuw%40mail.gmail.com.


[ansible-project] How to split value from list

2020-07-06 Thread Jenisha T
Hi 
Could you pls help me with the splitting value from the list. I need to 
extract first value* anil *before ('':')

* grep_atm.stdout_lines* output below

ok: [localhost] => {
"msg": "*anil*:x:500:500:Anil:/home/anil:/bin/bash
"
}

I tried,
- set_fact:  
   user_name: "{{ grep_atm.stdout_lines }}"
register: user_name.split(':')[0]  
 - debug:
var: user_name.split(':')[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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/42fb2917-8336-42a2-979a-44573e91fd77n%40googlegroups.com.


[ansible-project] Conditionals using Ansible_facts.disks from the win_disk_facts

2020-07-06 Thread Adam Dyson
Hello world!

Hopefully a relatively simple one, I am attempting to add a when condition 
on a task that will only happen if a certain disk exists on the machine. I 
want the following task to only take place if Ansible facts finds a disk 
with the number 4. however I am struggling to find the right syntax. Has 
anyone done this and know the answer?

- name: Create Partition
  win_partition:
   drive_letter:F
   partition_size: '-1'
   Disk_Number: 4
   state: present
  when:
  - Ansible_facts.disks[4]



-- 
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/4497f2d8-d308-4964-80b9-34342a94efefo%40googlegroups.com.


[ansible-project] Re: action plugin: modify task_vars?

2020-07-06 Thread Gregory Christy
I've reposted this question here: 
https://groups.google.com/forum/#!topic/ansible-devel/Lyz0cCvmJvc

-- 
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/e27735f1-29b1-4e09-ad5e-ded504880136o%40googlegroups.com.