Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread Dan Linder
> Ultimately I'd like to figure out how to add a semicolon after each 
entry, 

This should do that; join with a semicolon not a newline: | join('; ') 

> then separate them into batches of 500 emails each 

Since you have the list already, you could use a `for` loop with an `if` 
test to insert a new-line to get the batches:

This should work assuming your full list of addresses is in `
list_of_addresses`:
{% for email_item in list_of_addresses %}{{ email_item }}{% if loop.index 
is divisibleby 500 %}{{ '\n' -}}{% else %};{% endif %}{% endfor %}
(note, all on one line)

All you need to do is replace the `list_of_addresses` with your YAML list 
of addresses and you should get your list broken into 500 element lines.

You can check your Jinja syntax by using this site: 
https://cryptic-cliffs-32040.herokuapp.com/
On Friday, November 13, 2020 at 11:51:32 AM UTC-6 lift...@gmail.com wrote:

> Perfect!  Exactly what I needed. Ultimately I'd like to figure out how to 
> add a semicolon after each entry, then separate them into batches of 500 
> emails each, but I can worry about that later. This works for now. 
>
> Thanks 
> Harry
>
> On Fri, Nov 13, 2020, 12:44 PM Stefan Hornburg (Racke)  
> wrote:
>
>> On 11/13/20 6:28 PM, harry devine wrote:
>> > So how do I get rid of the u?  What I ultimately wanted was JUST the 
>> email addresses. 
>> > 
>> > Harry 
>>
>> Join the list members into a string: | join('\n')
>>
>> Regards
>>  Racke
>>
>> > 
>> > On Fri, Nov 13, 2020, 12:15 PM Dick Visser > dick@geant.org>> wrote:
>> > 
>> > This is a simple list, which is what you wanted.
>> > 
>> > On Fri, 13 Nov 2020 at 17:28, lift...@gmail.com > lift...@gmail.com> > > > wrote:
>> > >
>> > > So now I'm getting this:
>> > >
>> > > User Emails:
>> > >
>> > > Date generated: 11/13/2020 11:23:32
>> > > [u'us...@example.com ', 
>> u'us...@example.com ']
>> > >
>> > > Harry
>> > >
>> > > On Friday, November 13, 2020 at 11:13:27 AM UTC-5 
>> dick@geant.org  wrote:
>> > >>
>> > >> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com > lift...@gmail.com> > > > wrote:
>> > >>
>> > >> >> >> >> > - name: Set User Email fact
>> > >> >> >> >> > set_fact:
>> > >> >> >> >> > user_list: "{{ user_find.json.result | 
>> json_query('result[].mail') | list | to_nice_yaml }}"
>> > >>
>> > >> Try adding a pipe expression to the query, and leave out the
>> > >> 'list|to_nice_yaml':
>> > >>
>> > >>
>> > >> set_fact:
>> > >> user_list: "{{ user_find.json.result | 
>> json_query('result[].mail[]') }}"
>> > >>
>> > >>
>> > >>
>> > >> Dick
>> > >
>> > > --
>> > > 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/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.com
>> > <
>> https://groups.google.com/d/msgid/ansible-project/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%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/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%40mail.gmail.com
>> > <
>> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%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/CALYKJ268J-TnW1RGcahzQGfBeU9dHRRX_giohJ0%3DXuC9gfK-6A%40mail.gmail.com
>> > <
>> https://groups.google.com/d/msgid/ansible-project/CALYKJ268J-TnW1RGcahzQGfBeU9dHRRX_giohJ0%3DXuC9gfK-6A%40mail.gmail.com?utm_medium=email_source=footer
>> >.
>>
>>
>> -- 
>> Ecommerce and Linux consulting + Perl and web application programming.
>> Debian and Sympa administration. Provisioning with Ansible.
>>
>> -- 

Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread harry devine
Perfect!  Exactly what I needed. Ultimately I'd like to figure out how to
add a semicolon after each entry, then separate them into batches of 500
emails each, but I can worry about that later. This works for now.

Thanks
Harry

On Fri, Nov 13, 2020, 12:44 PM Stefan Hornburg (Racke) 
wrote:

> On 11/13/20 6:28 PM, harry devine wrote:
> > So how do I get rid of the u?  What I ultimately wanted was JUST the
> email addresses.
> >
> > Harry
>
> Join the list members into a string: | join('\n')
>
> Regards
>  Racke
>
> >
> > On Fri, Nov 13, 2020, 12:15 PM Dick Visser  > wrote:
> >
> > This is a simple list, which is what you wanted.
> >
> > On Fri, 13 Nov 2020 at 17:28, lift...@gmail.com  lift...@gmail.com>  > > wrote:
> > >
> > > So now I'm getting this:
> > >
> > > User Emails:
> > >
> > > Date generated: 11/13/2020 11:23:32
> > > [u'us...@example.com ',
> u'us...@example.com ']
> > >
> > > Harry
> > >
> > > On Friday, November 13, 2020 at 11:13:27 AM UTC-5
> dick@geant.org  wrote:
> > >>
> > >> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com  lift...@gmail.com>  > > wrote:
> > >>
> > >> >> >> >> > - name: Set User Email fact
> > >> >> >> >> > set_fact:
> > >> >> >> >> > user_list: "{{ user_find.json.result |
> json_query('result[].mail') | list | to_nice_yaml }}"
> > >>
> > >> Try adding a pipe expression to the query, and leave out the
> > >> 'list|to_nice_yaml':
> > >>
> > >>
> > >> set_fact:
> > >> user_list: "{{ user_find.json.result |
> json_query('result[].mail[]') }}"
> > >>
> > >>
> > >>
> > >> Dick
> > >
> > > --
> > > 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/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/ansible-project/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%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/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%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/CALYKJ268J-TnW1RGcahzQGfBeU9dHRRX_giohJ0%3DXuC9gfK-6A%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/ansible-project/CALYKJ268J-TnW1RGcahzQGfBeU9dHRRX_giohJ0%3DXuC9gfK-6A%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/53e6fe8d-f14c-767f-51b6-de1445741d53%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/CALYKJ256Y%2BM4-c6K%3D3aS5n9ThXriD-n0yHkhpLC2ojuBZ%2B_j9w%40mail.gmail.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread Stefan Hornburg (Racke)
On 11/13/20 6:28 PM, harry devine wrote:
> So how do I get rid of the u?  What I ultimately wanted was JUST the email 
> addresses. 
> 
> Harry 

Join the list members into a string: | join('\n')

Regards
 Racke

> 
> On Fri, Nov 13, 2020, 12:15 PM Dick Visser  > wrote:
> 
> This is a simple list, which is what you wanted.
> 
> On Fri, 13 Nov 2020 at 17:28, lift...@gmail.com 
>   > wrote:
> >
> > So now I'm getting this:
> >
> > User Emails:
> >
> > Date generated: 11/13/2020 11:23:32
> > [u'us...@example.com ', 
> u'us...@example.com ']
> >
> > Harry
> >
> > On Friday, November 13, 2020 at 11:13:27 AM UTC-5 dick@geant.org 
>  wrote:
> >>
> >> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com 
>   > wrote:
> >>
> >> >> >> >> > - name: Set User Email fact
> >> >> >> >> > set_fact:
> >> >> >> >> > user_list: "{{ user_find.json.result | 
> json_query('result[].mail') | list | to_nice_yaml }}"
> >>
> >> Try adding a pipe expression to the query, and leave out the
> >> 'list|to_nice_yaml':
> >>
> >>
> >> set_fact:
> >> user_list: "{{ user_find.json.result | json_query('result[].mail[]') 
> }}"
> >>
> >>
> >>
> >> Dick
> >
> > --
> > 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/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%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/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%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/CALYKJ268J-TnW1RGcahzQGfBeU9dHRRX_giohJ0%3DXuC9gfK-6A%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/53e6fe8d-f14c-767f-51b6-de1445741d53%40linuxia.de.


OpenPGP_0x5B93015BFA2720F8.asc
Description: application/pgp-keys


OpenPGP_signature
Description: OpenPGP digital signature


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread harry devine
So how do I get rid of the u?  What I ultimately wanted was JUST the email
addresses.

Harry

On Fri, Nov 13, 2020, 12:15 PM Dick Visser  wrote:

> This is a simple list, which is what you wanted.
>
> On Fri, 13 Nov 2020 at 17:28, lift...@gmail.com 
> wrote:
> >
> > So now I'm getting this:
> >
> > User Emails:
> >
> > Date generated: 11/13/2020 11:23:32
> > [u'us...@example.com', u'us...@example.com']
> >
> > Harry
> >
> > On Friday, November 13, 2020 at 11:13:27 AM UTC-5 dick@geant.org
> wrote:
> >>
> >> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com 
> wrote:
> >>
> >> >> >> >> > - name: Set User Email fact
> >> >> >> >> > set_fact:
> >> >> >> >> > user_list: "{{ user_find.json.result |
> json_query('result[].mail') | list | to_nice_yaml }}"
> >>
> >> Try adding a pipe expression to the query, and leave out the
> >> 'list|to_nice_yaml':
> >>
> >>
> >> set_fact:
> >> user_list: "{{ user_find.json.result | json_query('result[].mail[]') }}"
> >>
> >>
> >>
> >> Dick
> >
> > --
> > 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/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%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/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%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/CALYKJ268J-TnW1RGcahzQGfBeU9dHRRX_giohJ0%3DXuC9gfK-6A%40mail.gmail.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread Dick Visser
This is a simple list, which is what you wanted.

On Fri, 13 Nov 2020 at 17:28, lift...@gmail.com  wrote:
>
> So now I'm getting this:
>
> User Emails:
>
> Date generated: 11/13/2020 11:23:32
> [u'us...@example.com', u'us...@example.com']
>
> Harry
>
> On Friday, November 13, 2020 at 11:13:27 AM UTC-5 dick@geant.org wrote:
>>
>> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com  wrote:
>>
>> >> >> >> > - name: Set User Email fact
>> >> >> >> > set_fact:
>> >> >> >> > user_list: "{{ user_find.json.result | 
>> >> >> >> > json_query('result[].mail') | list | to_nice_yaml }}"
>>
>> Try adding a pipe expression to the query, and leave out the
>> 'list|to_nice_yaml':
>>
>>
>> set_fact:
>> user_list: "{{ user_find.json.result | json_query('result[].mail[]') }}"
>>
>>
>>
>> Dick
>
> --
> 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/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%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/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%40mail.gmail.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread lift...@gmail.com
So now I'm getting this:

User Emails:

Date generated: 11/13/2020 11:23:32
[u'us...@example.com', u'us...@example.com']

Harry

On Friday, November 13, 2020 at 11:13:27 AM UTC-5 dick@geant.org wrote:

> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com  wrote:
>
> >> >> >> > - name: Set User Email fact
> >> >> >> > set_fact:
> >> >> >> > user_list: "{{ user_find.json.result | 
> json_query('result[].mail') | list | to_nice_yaml }}"
>
> Try adding a pipe expression to the query, and leave out the
> 'list|to_nice_yaml':
>
>
> set_fact:
> user_list: "{{ user_find.json.result | json_query('result[].mail[]') }}"
>
>
>
> Dick
>

-- 
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/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread Dick Visser
On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com  wrote:

>> >> >> > - name: Set User Email fact
>> >> >> > set_fact:
>> >> >> > user_list: "{{ user_find.json.result | json_query('result[].mail') | 
>> >> >> > list | to_nice_yaml }}"

Try adding a pipe expression to the query, and leave out the
'list|to_nice_yaml':


set_fact:
  user_list: "{{ user_find.json.result | json_query('result[].mail[]') }}"



Dick

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


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread lift...@gmail.com
Hope this works and helps:

TASK [Print user_find] 
*
ok: [localhost] => {
"msg": {
"cache_control": "no-cache, private",
"changed": false,
"connection": "close",
"content_security_policy": "frame-ancestors 'none'",
"content_type": "application/json; charset=utf-8",
"cookies": {},
"cookies_string": "",
"date": "Fri, 13 Nov 2020 15:41:31 GMT",
"elapsed": 2,
"failed": false,
"json": {
"error": null,
"id": null,
"principal": "ad...@example.com",
"result": {
"count": 1822,
"result": [
{
"dn": 
"uid=user1,cn=users,cn=accounts,dc=example,dc=com",
"gidnumber": [
"1"
],
"givenname": [
"User1"
],
"homedirectory": [
"/home/user1"
],
"krbcanonicalname": [
"us...@example.com"
],
"krbprincipalname": [
"us...@example.com"
],
"loginshell": [
"/bin/bash"
],
"mail": [
"us...@example.com"
],
"nsaccountlock": false,
"sn": [
"User"
],
"telephonenumber": [
"(555) 555-"
],
"uid": [
"user1"
],
"uidnumber": [
""
]
},
{
"dn": 
"uid=user2,cn=users,cn=accounts,dc=example,dc=com",
"gidnumber": [
"1"
],
"givenname": [
"User2"
],
"homedirectory": [
"/home/user2"
],
"krbcanonicalname": [
"us...@example.com"
],
"krbprincipalname": [
"us...@example.com"
],
"loginshell": [
"/bin/bash"
],
"mail": [
"us...@example.com"
],
"nsaccountlock": false,
"sn": [
"User"
],
"telephonenumber": [
"(555)555-5556"
],
"uid": [
"user2"
],
"uidnumber": [
""
]
},
}
],
"summary": "1822 users matched",
"truncated": false
},
"version": "4.6.8"
},
"msg": "OK (unknown bytes)",
"redirected": false,
"server": "Apache/2.4.6 (Red Hat Enterprise Linux) 
mod_auth_gssapi/1.5.1 mod_nss/1.0.14 NSS/3.28.4 mod_wsgi/3.4 Python/2.7.5",
"status": 200,
"transfer_encoding": "chunked",
"url": "https://auth.example.com/ipa/session/json;,
"vary": "Accept-Encoding",
"x_frame_options": "DENY"
}
}

Thanks,
Harry

On Friday, November 13, 2020 at 8:56:46 AM UTC-5 dick@geant.org wrote:

> At least something that is valid json with at least two iterations
> should be welcome.
>
> On Fri, 13 Nov 2020 at 14:53, lift...@gmail.com  wrote:
> >
> > There are over 1800 users. That's alot of data for me to redact. How 
> much longer of a sample would you like to see?
> >
> > Harry
> >
> > On Friday, November 13, 2020 at 8:49:37 AM UTC-5 dick@geant.org 
> wrote:
> >>
> >> that appears to be mutilated, can you post a longer piece so the
> >> iteration structure is intact ?
> >>
> >> On Fri, 13 Nov 2020 at 13:53, lift...@gmail.com  
> wrote:
> >> >
> >> > Here's a subset of user_find.json.result:
> >> >
> >> > TASK [Print user_find] 
> *
> >> > ok: [localhost] 

[ansible-project] Helm module issue.

2020-11-13 Thread Sebastian
Hi,
I'm trying to install Helm chart from the local file on the local Minikube 
instance but I'm constantly getting the same error:

fatal: [localhost]: FAILED! => { 
   "changed": false, 
   "command": "/usr/local/bin/helm --namespace=kube-system list 
--output=yaml --filter registrylocal", 
   "invocation": { 
   "module_args": { 
   "atomic": false, 
   "binary_path": null, 
   "chart_ref": "registry-1.3.0-1026.tgz", 
   "chart_repo_url": null, 
   "chart_version": null, 
   "create_namespace": false, 
   "disable_hook": false, 
   "force": false, 
   "kube_context": null, 
   "kubeconfig_path": null, 
   "purge": true, 
   "release_name": "registrylocal", 
   "release_namespace": "kube-system", 
   "release_state": "present", 
   "release_values": {}, 
   "replace": false, 
   "update_repo_cache": false, 
   "values_files": [], 
   "wait": false, 
   "wait_timeout": null 
   } 
   }, 
   "msg": "Failure when executing Helm command. Exited 1.\nstdout: 
\nstderr: Error: unknown flag: --filter\n", 
   "stderr": "Error: unknown flag: --filter\n", 
   "stderr_lines": [ 
   "Error: unknown flag: --filter" 
   ], 
   "stdout": "", 
   "stdout_lines": [] 
}

As a test I'm able to create a namespace against the same Minikube instance:
--- 
- hosts: localhost 
 connection: local 
 gather_facts: false 

 tasks: 
   - name: Create namespace. 
 community.kubernetes.k8s: 
   name: test
   api_version: v1 
   kind: Namespace 
   state: present 

   - name: Deploy local Registry chart 
 community.kubernetes.helm: 
   chart_ref: registry-1.3.0-1026.tgz 
   release_namespace: kube-system 
   release_name: registrylocal

For some reason it doesn't like `release_name` value, I've tried changing 
to `name` alias but it is returning the same error. Running Helm version is 
the same on both sides:
Client: {SemVer:"v2.14.3", 
GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"} 
Server: {SemVer:"v2.14.3", 
GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}

Any ideas what this could be?


-- 
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/e80438f6-fd68-4479-8e8e-119bed5cd75fn%40googlegroups.com.


[ansible-project] Re: Pinging Windows Host Now Returns Unexpected Error

2020-11-13 Thread dwiz
Thank or the input, I thought ping module was universal. Appreciate the 
response

On Wednesday, October 28, 2020 at 11:45:18 PM UTC-4 jbor...@gmail.com wrote:

> You need to use win_ping and not ping. It's trying to run Python code in a 
> PowerShell engine which fails.
>
> On Thursday, October 29, 2020 at 11:50:28 AM UTC+10 dwiz wrote:
>
>> This is verbose output: 
>>
>> ansible 2.9.11
>>   config file = /etc/ansible/ansible.cfg
>>   configured module search path = 
>> ['/home/ansible/.ansible/plugins/modules', 
>> '/usr/share/ansible/plugins/modules']
>>   ansible python module location = 
>> /home/ansible/.local/lib/python3.6/site-packages/ansible
>>   executable location = /home/ansible/.local/bin/ansible
>>   python version = 3.6.9 (default, Oct  8 2020, 12:12:24) [GCC 8.4.0]
>> Using /etc/ansible/ansible.cfg as config file
>> setting up inventory plugins
>> host_list declined parsing /etc/ansible/hosts as it did not pass its 
>> verify_file() method
>> script declined parsing /etc/ansible/hosts as it did not pass its 
>> verify_file() method
>> auto declined parsing /etc/ansible/hosts as it did not pass its 
>> verify_file() method
>> Parsed /etc/ansible/hosts inventory source with ini plugin
>> Loading callback plugin minimal of type stdout, v2.0 from 
>> /home/ansible/.local/lib/python3.6/site-packages/ansible/plugins/callback/minimal.py
>> META: ran handlers
>>  Attempting python interpreter discovery
>> < x.x.x.x  > ESTABLISH WINRM CONNECTION FOR USER: ansible on PORT 5985 TO 
>> x.x.x.x
>> EXEC (via pipeline wrapper)
>> Using module file 
>> /home/ansible/.local/lib/python3.6/site-packages/ansible/modules/system/ping.py
>> Pipelining is enabled.
>> EXEC (via pipeline wrapper)
>> [WARNING]: No python interpreters found for host  x.x.x.x   (tried 
>> ['/usr/bin/python', 'python3.7', 'python3.6', 'python3.5', 'python2.7', 
>> 'python2.6', '/usr/libexec/platform-python', '/usr/bin/python3', 'python'])
>> x.x.x.x | FAILED! => {
>> "ansible_facts": {
>> "discovered_interpreter_python": "/usr/bin/python"
>> },
>> "changed": false,
>> "module_stderr": "Exception calling \"Create\" with \"1\" 
>> argument(s): \"At line:4 char:21\r\n+ def _ansiballz_main():\r\n+  
>>~\r\nAn expression was expected after '('.\r\nAt line:13 
>> char:27\r\n+ except (AttributeError, OSError):\r\n+
>>~\r\nMissing argument in parameter list.\r\nAt line:15 char:7\r\n+  
>>if scriptdir is not None:\r\n+   ~\r\nMissing '(' after 'if' in if 
>> statement.\r\nAt line:22 char:7\r\n+ if sys.version_info < (3,):\r\n+  
>>  ~\r\nMissing '(' after 'if' in if statement.\r\nAt line:22 
>> char:30\r\n+ if sys.version_info < (3,):\r\n+  
>> ~\r\nMissing expression after ','.\r\nAt line:22 char:25\r\n+ if 
>> sys.version_info < (3,):\r\n+ ~\r\nThe '<' operator 
>> is reserved for future use.\r\nAt line:27 char:34\r\n+ def 
>> invoke_module(modlib_path, temp_path, json_params):\r\n+
>>   ~\r\nMissing argument in parameter list.\r\nAt line:28 
>> char:40\r\n+ z = zipfile.ZipFile(modlib_path, mode='a')\r\n+
>> ~\r\nMissing argument in parameter 
>> list.\r\nAt line:31 char:33\r\n+ zinfo = zipfile.ZipInfo()\r\n+
>>  ~\r\nAn expression was expected after 
>> '('.\r\nAt line:34 char:25\r\n+ z.writestr(zinfo, 
>> sitecustomize)\r\n+ ~\r\nMissing argument in 
>> parameter list.\r\nNot all parse errors were reported.  Correct the 
>> reported errors and try again.\"\r\nAt line:6 char:1\r\n+ $exec_wrapper = 
>> [ScriptBlock]::Create($split_parts[0])\r\n+ 
>> ~~\r\n+ 
>> CategoryInfo  : NotSpecified: (:) [], 
>> MethodInvocationException\r\n+ FullyQualifiedErrorId : 
>> ParseException\r\n \r\nThe expression after '&' in a pipeline element 
>> produced an object that was not valid. It must result in a command 
>> \r\nname, a script block, or a CommandInfo object.\r\nAt line:7 char:2\r\n+ 
>> &$exec_wrapper\r\n+  ~\r\n+ CategoryInfo  : 
>> InvalidOperation: (:) [], RuntimeException\r\n+ FullyQualifiedErrorId : 
>> BadExpression\r\n ",
>> "module_stdout": "",
>> "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
>> "rc": 1
>> }
>>
>>
>> On Wednesday, October 28, 2020 at 9:42:39 PM UTC-4 dwiz wrote:
>>
>>> Hello, 
>>>
>>> I am testing connection to my windows host. My host file is set up as 
>>> below. 
>>>
>>> [windows]
>>> X.X.X.X
>>>
>>> [windows:vars]
>>> ansible_user=
>>> ansible_password=
>>> ansible_connection=winrm
>>> ansible_port=5985
>>>
>>> I was able to connect to the host fine before but now when testing with, 
>>> 'ansible windows -m ping', I get the following error. I'm not sure what 
>>> could've change between my 

Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread Dick Visser
At least something that is valid json with at least two iterations
should be welcome.

On Fri, 13 Nov 2020 at 14:53, lift...@gmail.com  wrote:
>
> There are over 1800 users.  That's alot of data for me to redact.  How much 
> longer of a sample would you like to see?
>
> Harry
>
> On Friday, November 13, 2020 at 8:49:37 AM UTC-5 dick@geant.org wrote:
>>
>> that appears to be mutilated, can you post a longer piece so the
>> iteration structure is intact ?
>>
>> On Fri, 13 Nov 2020 at 13:53, lift...@gmail.com  wrote:
>> >
>> > Here's a subset of user_find.json.result:
>> >
>> > TASK [Print user_find] 
>> > *
>> > ok: [localhost] => {
>> > "msg": {
>> > "count": 1826,
>> > "result": [
>> > {
>> > "dn": "uid=harry.devine,cn=users,cn=example,dc=com",
>> > "gidnumber": [
>> > "9"
>> > ],
>> > "givenname": [
>> > "Harry"
>> > ],
>> > "homedirectory": [
>> > "/home/harry.devine"
>> > ],
>> > "krbcanonicalname": [
>> > "harry@example.com"
>> > ],
>> > "krbprincipalname": [
>> > "harry@example.com"
>> > ],
>> > "loginshell": [
>> > "/bin/bash"
>> > ],
>> > "mail": [
>> > "harry@example.com"
>> > ],
>> > "nsaccountlock": false,
>> > "sn": [
>> > "Devine"
>> > ],
>> > "telephonenumber": [
>> > "(609) 867-5309"
>> > ],
>> > "uid": [
>> > "harry.devine"
>> > ],
>> > "uidnumber": [
>> > "1000"
>> > ]
>> > },
>> > }
>> > ],
>> > "summary": "1826 users matched",
>> > "truncated": false
>> > }
>> >
>> > Thanks,
>> > Harry
>> >
>> > On Thursday, November 12, 2020 at 9:53:29 AM UTC-5 brae...@gmail.com wrote:
>> >>
>> >> On 11/12/20 3:49 PM, lift...@gmail.com wrote:
>> >> > I have a playbook where I am traversing our FreeIPA server and pulling 
>> >> > out each user's email address. I'm then putting
>> >> > that data into a text file using the template module:
>> >> >
>> >> > - name: Set User Email fact
>> >> > set_fact:
>> >> > user_list: "{{ user_find.json.result | json_query('result[].mail') | 
>> >> > list | to_nice_yaml }}"
>> >> >
>> >> > - name: Prepare report
>> >> > template:
>> >> > src: /root/emails.txt.j2
>> >> > dest: /root/emails.txt
>> >> > delegate_to: localhost
>> >> > run_once: true
>> >> >
>> >> > The j2 template:
>> >> >
>> >> > User Emails:
>> >> >
>> >> > Date generated: {{ now(false, '%m/%d/%Y %I:%M:%S') }}
>> >> > {{ user_list }}
>> >> >
>> >> > This returns the following in the text file:
>> >> >
>> >> > User Emails:
>> >> >
>> >> > Date generated: 11/12/2020 09:40:26
>> >> > - - us...@example.com
>> >> > - - us...@example.com
>> >> >
>> >> > How can I strip out the preceding dashes?
>> >>
>> >> Please post a sample of the JSON in user_find.json.result.
>> >>
>> >> Regards
>> >> Racke
>> >>
>> >> >
>> >> > Thanks,
>> >> > Harry
>> >> >
>> >> > --
>> >> > 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/c0bc1bea-edbe-4cc7-813e-81d5f484b8f7n%40googlegroups.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-proje...@googlegroups.com.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/ansible-project/96c45ddc-3628-47a2-ad04-a899eb7d9f5dn%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/884028a3-6206-4b0c-859f-e9f17b49342en%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 

[ansible-project] SSH authentication with multiple prompts

2020-11-13 Thread Florian LACOMMARE
Hello,

I would like to know if it possible to use some network modules (aireos for 
example) and connect to my device which is asking me multiples prompts 
(username and password).

The device behavior : 
When you try to ssh to the device, it's always working (no authentication 
required), and then the device ask for a username and then a password.

Here's the debug connection with ssh :

ssh 10.x.x.x -v
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /home/florian_lacommare/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 59: Applying options for *
debug1: Connecting to  10.x.x.x  [ 10.x.x.x ] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/florian_lacommare/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/florian_lacommare/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/florian_lacommare/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/florian_lacommare/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/florian_lacommare/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/florian_lacommare/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/florian_lacommare/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/florian_lacommare/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version CISCO_WLC
debug1: no match: CISCO_WLC
debug1: Authenticating to  10.x.x.x:22 as 'florian_lacommare'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha1
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: arcfour128 MAC: hmac-sha2-256 
compression: none
debug1: kex: client->server cipher: arcfour128 MAC: hmac-sha2-256 
compression: none
debug1: kex: diffie-hellman-group-exchange-sha1 need=32 dh_need=32
debug1: kex: diffie-hellman-group-exchange-sha1 need=32 dh_need=32
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<8192<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa 
SHA256:WUCImUIJ7TlGIvZV8ltINHMHkgLR48sGRCrKGZq7goo
debug1: Host ' 10.x.x.x  ' is known and matches the RSA host key.
debug1: Found key in /home/florian_lacommare/.ssh/known_hosts:22
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentication succeeded (none).
Authenticated to  10.x.x.x  ([ 10.x.x.x  ]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_ALL = en_US.UTF-8
debug1: Sending env LANG = en_US.UTF-8


(Cisco Controller) 
User: myusername
Password:**

Regards

-- 
This e-mail and any attachment are confidential and intended solely for the 
use of the individual to whom it is addressed. If you are not the intended 
recipient, please telephone or email the sender and delete this message and 
any attachment from your system. Unauthorized publication, use, 
dissemination, forwarding, printing or copying of this e-mail and its 
associated attachments is strictly prohibited.


http://disclaimer.carrefour.com/ 


Let's 
respect the environment together. Only print this message if necessary.

-- 
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/f3bb0ea6-6943-4d4d-9104-b8f744961901n%40googlegroups.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread lift...@gmail.com
There are over 1800 users.  That's alot of data for me to redact.  How much 
longer of a sample would you like to see?

Harry

On Friday, November 13, 2020 at 8:49:37 AM UTC-5 dick@geant.org wrote:

> that appears to be mutilated, can you post a longer piece so the
> iteration structure is intact ?
>
> On Fri, 13 Nov 2020 at 13:53, lift...@gmail.com  wrote:
> >
> > Here's a subset of user_find.json.result:
> >
> > TASK [Print user_find] 
> *
> > ok: [localhost] => {
> > "msg": {
> > "count": 1826,
> > "result": [
> > {
> > "dn": "uid=harry.devine,cn=users,cn=example,dc=com",
> > "gidnumber": [
> > "9"
> > ],
> > "givenname": [
> > "Harry"
> > ],
> > "homedirectory": [
> > "/home/harry.devine"
> > ],
> > "krbcanonicalname": [
> > "harry@example.com"
> > ],
> > "krbprincipalname": [
> > "harry@example.com"
> > ],
> > "loginshell": [
> > "/bin/bash"
> > ],
> > "mail": [
> > "harry@example.com"
> > ],
> > "nsaccountlock": false,
> > "sn": [
> > "Devine"
> > ],
> > "telephonenumber": [
> > "(609) 867-5309"
> > ],
> > "uid": [
> > "harry.devine"
> > ],
> > "uidnumber": [
> > "1000"
> > ]
> > },
> > }
> > ],
> > "summary": "1826 users matched",
> > "truncated": false
> > }
> >
> > Thanks,
> > Harry
> >
> > On Thursday, November 12, 2020 at 9:53:29 AM UTC-5 brae...@gmail.com 
> wrote:
> >>
> >> On 11/12/20 3:49 PM, lift...@gmail.com wrote:
> >> > I have a playbook where I am traversing our FreeIPA server and 
> pulling out each user's email address. I'm then putting
> >> > that data into a text file using the template module:
> >> >
> >> > - name: Set User Email fact
> >> > set_fact:
> >> > user_list: "{{ user_find.json.result | json_query('result[].mail') | 
> list | to_nice_yaml }}"
> >> >
> >> > - name: Prepare report
> >> > template:
> >> > src: /root/emails.txt.j2
> >> > dest: /root/emails.txt
> >> > delegate_to: localhost
> >> > run_once: true
> >> >
> >> > The j2 template:
> >> >
> >> > User Emails:
> >> >
> >> > Date generated: {{ now(false, '%m/%d/%Y %I:%M:%S') }}
> >> > {{ user_list }}
> >> >
> >> > This returns the following in the text file:
> >> >
> >> > User Emails:
> >> >
> >> > Date generated: 11/12/2020 09:40:26
> >> > - - us...@example.com
> >> > - - us...@example.com
> >> >
> >> > How can I strip out the preceding dashes?
> >>
> >> Please post a sample of the JSON in user_find.json.result.
> >>
> >> Regards
> >> Racke
> >>
> >> >
> >> > Thanks,
> >> > Harry
> >> >
> >> > --
> >> > 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/c0bc1bea-edbe-4cc7-813e-81d5f484b8f7n%40googlegroups.com
> >> > <
> https://groups.google.com/d/msgid/ansible-project/c0bc1bea-edbe-4cc7-813e-81d5f484b8f7n%40googlegroups.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/96c45ddc-3628-47a2-ad04-a899eb7d9f5dn%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/884028a3-6206-4b0c-859f-e9f17b49342en%40googlegroups.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread Dick Visser
that appears to be mutilated, can you post a longer piece so the
iteration structure is intact ?

On Fri, 13 Nov 2020 at 13:53, lift...@gmail.com  wrote:
>
> Here's a subset of user_find.json.result:
>
> TASK [Print user_find] 
> *
> ok: [localhost] => {
> "msg": {
> "count": 1826,
> "result": [
> {
> "dn": "uid=harry.devine,cn=users,cn=example,dc=com",
> "gidnumber": [
> "9"
> ],
> "givenname": [
> "Harry"
> ],
> "homedirectory": [
> "/home/harry.devine"
> ],
> "krbcanonicalname": [
> "harry.dev...@example.com"
> ],
> "krbprincipalname": [
> "harry.dev...@example.com"
> ],
> "loginshell": [
> "/bin/bash"
> ],
> "mail": [
> "harry.dev...@example.com"
> ],
> "nsaccountlock": false,
> "sn": [
> "Devine"
> ],
> "telephonenumber": [
> "(609) 867-5309"
> ],
> "uid": [
> "harry.devine"
> ],
> "uidnumber": [
> "1000"
> ]
> },
>   }
> ],
> "summary": "1826 users matched",
> "truncated": false
> }
>
> Thanks,
> Harry
>
> On Thursday, November 12, 2020 at 9:53:29 AM UTC-5 brae...@gmail.com wrote:
>>
>> On 11/12/20 3:49 PM, lift...@gmail.com wrote:
>> > I have a playbook where I am traversing our FreeIPA server and pulling out 
>> > each user's email address.  I'm then putting
>> > that data into a text file using the template module:
>> >
>> >   - name: Set User Email fact
>> > set_fact:
>> >   user_list: "{{ user_find.json.result | json_query('result[].mail') | 
>> > list | to_nice_yaml }}"
>> >
>> >   - name: Prepare report
>> > template:
>> >   src: /root/emails.txt.j2
>> >   dest: /root/emails.txt
>> > delegate_to: localhost
>> > run_once: true
>> >
>> > The j2 template:
>> >
>> > User Emails:
>> >
>> > Date generated: {{ now(false, '%m/%d/%Y %I:%M:%S') }}
>> > {{ user_list }}
>> >
>> > This returns the following in the text file:
>> >
>> > User Emails:
>> >
>> > Date generated: 11/12/2020 09:40:26
>> > -   - us...@example.com
>> > -   - us...@example.com
>> >
>> > How can I strip out the preceding dashes?
>>
>> Please post a sample of the JSON in user_find.json.result.
>>
>> Regards
>> Racke
>>
>> >
>> > Thanks,
>> > Harry
>> >
>> > --
>> > 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/c0bc1bea-edbe-4cc7-813e-81d5f484b8f7n%40googlegroups.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/96c45ddc-3628-47a2-ad04-a899eb7d9f5dn%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/CAL8fbwNiXQp3%2BcUrcwGcT0DLUofZXv3JAiRKvo5cuz2A5-Gemw%40mail.gmail.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread lift...@gmail.com
Here's a subset of user_find.json.result:

TASK [Print user_find] 
*
ok: [localhost] => {
"msg": {
"count": 1826,
"result": [
{
"dn": "uid=harry.devine,cn=users,cn=example,dc=com",
"gidnumber": [
"9"
],
"givenname": [
"Harry"
],
"homedirectory": [
"/home/harry.devine"
],
"krbcanonicalname": [
"harry.dev...@example.com"
],
"krbprincipalname": [
"harry.dev...@example.com"
],
"loginshell": [
"/bin/bash"
],
"mail": [
"harry.dev...@example.com"
],
"nsaccountlock": false,
"sn": [
"Devine"
],
"telephonenumber": [
"(609) 867-5309"
],
"uid": [
"harry.devine"
],
"uidnumber": [
"1000"
]
},
  }
],
"summary": "1826 users matched",
"truncated": false
}

Thanks,
Harry

On Thursday, November 12, 2020 at 9:53:29 AM UTC-5 brae...@gmail.com wrote:

> On 11/12/20 3:49 PM, lift...@gmail.com wrote:
> > I have a playbook where I am traversing our FreeIPA server and pulling 
> out each user's email address.  I'm then putting
> > that data into a text file using the template module:
> > 
> >   - name: Set User Email fact
> > set_fact:
> >   user_list: "{{ user_find.json.result | json_query('result[].mail') 
> | list | to_nice_yaml }}"
> > 
> >   - name: Prepare report
> > template:
> >   src: /root/emails.txt.j2
> >   dest: /root/emails.txt
> > delegate_to: localhost
> > run_once: true
> > 
> > The j2 template:
> > 
> > User Emails:
> > 
> > Date generated: {{ now(false, '%m/%d/%Y %I:%M:%S') }}
> > {{ user_list }}
> > 
> > This returns the following in the text file:
> > 
> > User Emails:
> > 
> > Date generated: 11/12/2020 09:40:26
> > -   - us...@example.com
> > -   - us...@example.com
> > 
> > How can I strip out the preceding dashes?
>
> Please post a sample of the JSON in user_find.json.result.
>
> Regards
> Racke
>
> > 
> > Thanks,
> > Harry
> > 
> > -- 
> > 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/c0bc1bea-edbe-4cc7-813e-81d5f484b8f7n%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/ansible-project/c0bc1bea-edbe-4cc7-813e-81d5f484b8f7n%40googlegroups.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/96c45ddc-3628-47a2-ad04-a899eb7d9f5dn%40googlegroups.com.


Re: [ansible-project] ansible-runner use of /etc/ansible

2020-11-13 Thread Vladimir Botka
On Thu, 12 Nov 2020 13:37:37 +
"Weatherby,Gerard"  wrote:

> If I’m understanding the ansible-runner documentation correctly, it does not 
> use /etc/ansible but requires a directory structure set up in a particular 
> way.

Not exactly. ansible-runner is a wrapper of *ansible* and
*ansible-playbook*
https://github.com/ansible/ansible-runner/blob/devel/ansible_runner/runner_config.py#L61
https://github.com/ansible/ansible-runner/blob/devel/ansible_runner/runner_config.py#L170
"""
Performs basic checks and then properly invokes
- prepare_inventory
- prepare_env
- prepare_command
It's also responsible for wrapping the command with the
proper ssh agent invocation and setting early ANSIBLE_
environment variables. """

This means, /etc/ansible is used by *ansible* and *ansible-playbook*
in the context of additional configuration by ansible-wrapper.

For example, ANSIBLE_STDOUT_CALLBACK is limited to *minimal* and
*awx_display* only.
https://github.com/ansible/ansible-runner/blob/devel/ansible_runner/runner_config.py#L227

if 'AD_HOC_COMMAND_ID' in self.env:
self.env['ANSIBLE_STDOUT_CALLBACK'] = 'minimal'
else:
self.env['ANSIBLE_STDOUT_CALLBACK'] = 'awx_display'

IMHO, the source runner_config.py is the only relevant reference to
resolve issues.

-- 
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/20201113105715.6dfdac70%40gmail.com.


pgppUqHR4Ydm8.pgp
Description: OpenPGP digital signature


Re: [ansible-project] [WARNING]: Unhandled error in Python interpreter....

2020-11-13 Thread Vladimir Botka
On Thu, 12 Nov 2020 15:13:37 -0800 (PST)
bill paxton  wrote:

> I have a task that works fine for Ansible 2.9.7, but fails when I upgrade 
> to 2.10.3.
> ...
> Data could not be sent to remote host "localhost". Make sure this host can 
> be reached over ssh: ssh: connect to host localhost port 22: Cannot assign 
> requested address

FWIW, I'm still on 2.9.6.

As a hint, try to find out why *ssh* connection plugin is used to
connect localhost. IMHO, the default is *local*. For example, testing
with no configuration of the connection ("cat hosts | grep
connection" shows nothing)

  shell> cat pb.yml
  - hosts: test_01
tasks:
  - debug:
  var: ansible_connection
  - debug:
  var: ansible_connection
delegate_to: localhost

gives

  TASK [debug] 
  ok: [test_01] =>
ansible_connection: ssh

  TASK [debug]
  ok: [test_01 -> localhost] =>
ansible_connection: local

See DEFAULT_TRANSPORT
https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-transport

"man ansible" says

  -v, --verbose
  verbose mode (-vvv for more, - to enable connection
  debugging)

For example

  shell> ansible-playbook pb.yml - | grep connection
  connection: smart
ansible_connection: ssh
ansible_connection: local

-- 
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/20201113093209.53e10381%40gmail.com.


pgpO0hkQWjAen.pgp
Description: OpenPGP digital signature


Re: [ansible-project] ansible-runner use of /etc/ansible

2020-11-13 Thread Lars Liedtke
Same here

Am 12.11.20 um 14:56 schrieb Stefan Hornburg (Racke):
> On 11/12/20 2:37 PM, Weatherby,Gerard wrote:
>> If I’m understanding the ansible-runner documentation correctly, it does not 
>> use /etc/ansible but requires a directory
>> structure set up in a particular way.
>>
>> If that is correct, is there a tool that converts /etc/ansible into the 
>> required directory structure?
> I never use /etc/ansible, but an inventory local to my playbook and a custom 
> ansible.cfg.
>
> Regards
>  Racke
>
>> -- 
>> *Gerard Weatherby* | Application Architect
>> NMRbox | Department of Molecular Biology and Biophysics | UConn Health
>> 263 Farmington Avenue, Farmington, CT 06030-6406
>> uchc.edu 
>>
>> -- 
>> 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/70003EFB-EE2F-424D-A8C5-4FD258C54D87%40uchc.edu
>> .
>
-- 
---
punkt.de GmbH
Lars Liedtke
.infrastructure

Kaiserallee 13a 
76133 Karlsruhe

Tel. +49 721 9109 500
https://infrastructure.punkt.de
i...@punkt.de

AG Mannheim 108285
Geschäftsführer: Jürgen Egeling, Daniel Lienert, Fabian Stein

-- 
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/d15373af-2766-d7f5-0ac8-70ec251c972a%40punkt.de.


Re: [ansible-project] How to automate ansible automation runs from Python?

2020-11-13 Thread Lars Liedtke
Hey,

I have worked with cookiecutter, and it is nice. Bear in mind though,
that the initial Project configuration needs some work and thought. But
when you have everything setup, then it can really cut your project
creation times.

I cannot not really advise you on how to do it, beacuse even though we
are using ansible everyone, has git their own small differences in
project setup. But the cookicutter doc is sufficient to adapt the tipps
given there to ansible. From there you have to see how you want to setup
everything and what works best for you.

Cheers

Lars

Am 12.11.20 um 18:00 schrieb radeck...@gmail.com:
> Hi All,
>
> I have some ansible role structure which I use through playbooks in
> one of my gitlab repositories. Every time a developer needs to add a
> new service which uses some role/-s I manually update the code (eg.
> add a playbook, add some entries to defaults/main.yml, whatever needed).
>
> I would like to automate this process from Python as this is our main
> language in our devops team. One of my dev coworkers passed me info
> about https://github.com/cookiecutter/cookiecutter and it seems quite
> reasonable. I am only wondering if there are other better options.
>
> Has anyone created this kind of a setup? Any hints?
>
> Thanks in advance & have a nice day!
>
> Best Regards,
> Rafal.
> -- 
> 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/534c3966-135f-4e34-95e3-06118e9e031an%40googlegroups.com
> .

-- 
---
punkt.de GmbH
Lars Liedtke
.infrastructure

Kaiserallee 13a 
76133 Karlsruhe

Tel. +49 721 9109 500
https://infrastructure.punkt.de
i...@punkt.de

AG Mannheim 108285
Geschäftsführer: Jürgen Egeling, Daniel Lienert, Fabian Stein

-- 
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/8be5377c-0672-b714-1e7f-088a59b92ab2%40punkt.de.