Re: [ansible-project] Issue creating symbolic link

2024-01-11 Thread harry devine
Got it!  That cleared up my confusion and it's working now.  I.appreciate
you guys setting me straight!

Thanks,
Harry

On Thu, Jan 11, 2024, 3:17 PM Dick Visser  wrote:

>
>
> On Thu, 11 Jan 2024 at 20:50, Todd Lewis  wrote:
>
>> dest: "{{ '/usr/share/' + guacamole_tomcat +
>> '/.guacamole/guacamole.properties' }}"
>>
>
> With the strings defined outside the jinja block, it's a bit clearer:
>
> dest: "/usr/share/{{ guacamole_tomcat }}/.guacamole/guacamole.properties"
>
>
>
>
>
>
> --
> 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/CAF8BbLbmLiXwsYSVwUNGMgAo5YLJn434rQJr%3Dt%2BW3aZvVOFawg%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/CALYKJ24LhR6ht--5hkpt3z9brC6wujMHuOUCK4cyjhE2PZP3CA%40mail.gmail.com.


Re: [ansible-project] Retrieving items from a dictionary

2023-09-28 Thread harry devine
Thank you Vladimir!  I had already gotten the selectattr piece working but
the length check was the missing piece.  All good now.

Thanks,
Harry

On Wed, Sep 27, 2023, 3:32 PM Vladimir Botka  wrote:

> Map the attribute
>
>   dn: "{{ ansible_mounts|
>   selectattr('device', 'contains', 'nas-server.example.com')|
>   map(attribute='device') }}"
>
> If you want to skip empty lists test the length
>
>   - debug:
>   var: dn
> when: dn|length > 0
>
> --
> 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/CALYKJ26GFhRywku%3DSCMnsPsJ%2BifP888zPGHBQYv7AEwGxEQdwQ%40mail.gmail.com.


Re: [ansible-project] Re: Accessing contents of a fact in a loop

2021-12-03 Thread harry devine
I set it as a fact using your suggestion:
user_find.json.result.result|map(attribute='uid')|flatten

Harry

On Fri, Dec 3, 2021, 5:08 PM Todd Lewis  wrote:

> I don't see where you're setting uid, the debug step, or its output. All I
> see is that
>
>loop:
>  - "{{ uid }}"
>
> is only producing one invocation of the task with the desired values all
> glommed into one string.
> Please show your input code and resulting output. I suspect you're somehow
> producing a string rather than a list, but with nothing to look at, it's
> hard to know.
> On Friday, December 3, 2021 at 4:32:01 PM UTC-5 lift...@gmail.com wrote:
>
>> That works, but when I try to then call the IPA user_show API, which
>> takes the UID as a parameter, the entire list generated is sent in.
>>
>>   - name: Run user_show from IDM API using previously stored session
>> cookie
>> uri:
>>   url: "https://{{idmfqdn}}/ipa/session/json;
>>   method: POST
>>   headers:
>> Cookie: "{{ login.set_cookie }}"
>> Referer: "https://{{idmfqdn}}/ipa;
>> Content-Type: "application/json"
>> Accept: "application/json"
>>   body_format: json
>>   body: "{\"method\": \"user_show\",\"params\": [[ \"{{ item
>> }}\"],{\"all\": true,\"version\": \"{{ api_vers }}\"}]}"
>> register: user_show
>> loop:
>> - "{{ uid }}"
>>
>> TASK [Run user_show from IDM API using previously stored session cookie]
>> *
>> ok: [localhost] => (item=[u'user1', u'user2', u'user3'])
>>
>>
>> "invocation": {
>> "module_args": {
>> "attributes": null,
>> "backup": null,
>> "body": {
>> "method": "user_show",
>> "params": [
>> [
>> "[u'user1', u'user2', u'user3']"
>> ],
>> {
>> "all": true,
>> "version": "2.237"
>> }
>> ]
>> },
>>
>> "message": "[u'user1', u'user2', u'user3']: user not found
>>
>> So, why does the debug print appear to print each UID out, but when I try
>> to reference them in the loop, they are sent over as 1 big string?
>>
>> Thanks,
>> Harry
>> On Friday, December 3, 2021 at 4:17:14 PM UTC-5 uto...@gmail.com wrote:
>>
>>> I really want to love Ansible, but the fact that such a simple data
>>> manipulation completely eludes the newbie doesn't help. Worse, that I've
>>> done this (or equivalent) dozens of times and it still takes me as long as
>>> it does to come up with a working demo ... [sigh].
>>>
>>> Anyway, here's a working demo, assuming I got your initial data shaped
>>> right. Good luck.
>>>
>>> ---
>>> - name: Demo for processing user_find IPA API results
>>>   hosts: localhost
>>>   vars:
>>> user_find:
>>>   json:
>>> result:
>>>   result:
>>> - dn:
>>> "uid=harry.devine,cn=users,cn=accounts,dc=example,dc=com"
>>>   gidnumber: [ "1" ]
>>>   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: [ "(800) 867-5309" ]
>>>   uid: [ "harry.devine" ]
>>>   uidnumber: [ "" ]
>>> - dn:
>>> "uid=marve.devine,cn=users,cn=accounts,dc=example,dc=com"
>>>   gidnumber: [ "1" ]
>>>   givenname: [ "Marve" ]
>>>   homedirectory: [ "/home/marve.devine" ]
>>>   krbcanonicalname: [ "marve@example.com" ]
>>>   krbprincipalname: [ "marve@example.com" ]
>>>   loginshell: [ "/bin/bash" ]
>>>   mail: [ "marve@example.com" ]
>>>   nsaccountlock: false
>>>   sn: [ "Devine" ]
>>>   telephonenumber: [ "(800) 867-5309" ]
>>>   uid: [ "marve.devine" ]
>>>   uidnumber: [ "" ]
>>>
>>>   tasks:
>>> - name: Look at user_find.json.result.result
>>>   debug:
>>> msg: "{{ user_find.json.result.result | to_json }}"
>>>
>>> - name: Stash the uids with set_fact
>>>   set_fact:
>>> demo_uids: "{{
>>> user_find.json.result.result|map(attribute='uid')|flatten }}"
>>>
>>> - name: Look at our set fact
>>>   debug:
>>> msg: "{{ demo_uids }}"
>>>
>>> - name: Or just loop over directly; no need to do a set_fact
>>>   debug:
>>> msg: "{{ item }}"
>>>   loop: "{{
>>> 

Re: [ansible-project] Cannot source /etc/lsb-release

2021-09-27 Thread harry devine
You should use the full path to the source executable. "which source"
should give you that.

Harry

On Mon, Sep 27, 2021, 1:04 PM 'Neil Young' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> Hi,
>
> I'm banging my head trying to make this simple statement work:
>
> - name: Get Ubuntu version definitions
>   ansible.builtin.shell: source /etc/lsb-release
>
> But whatever I do I get this:
>
> TASK [Get Ubuntu version definitions]
> 
>
> fatal: [server1]: FAILED! => {"changed": true, "cmd": "source
> /etc/lsb-release", "delta": "0:00:00.002579", "end": "2021-09-27
> 17:02:32.565396", "msg": "non-zero return code", "rc": 127, "start":
> "2021-09-27 17:02:32.562817", "stderr": "/bin/sh: 1: source: not found",
> "stderr_lines": ["/bin/sh: 1: source: not found"], "stdout": "",
> "stdout_lines": []}
>
>
> This is most likely because I run at elevated permissions.
>
> What can I do in order to make this work?
>
> TIA
>
> --
> 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/fe78c00b-ac97-4960-a70b-449b0e1fcf41n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALYKJ26F_M0tF3qCf5KqrhJnoMw-YPBHYv5HXPb_tUvNb%3DnoGA%40mail.gmail.com.


Re: [ansible-project] Generating Report After Executing Playbook Tasks

2021-01-08 Thread harry devine
I've done this by using a template. But I don't have access to my work
system to get you an example. I can get one later or over the weekend if
you'd like.

Harry

On Fri, Jan 8, 2021, 6:27 PM aksain bhati  wrote:

> That make sense but still  any suggestion on generating report
>
>
> On Saturday, January 9, 2021 at 2:49:04 AM UTC+5:30 dick@geant.org
> wrote:
>
>> Create a single playbook that includes the other ones.
>>
>> On Fri, 8 Jan 2021 at 21:07, aksain bhati  wrote:
>> >
>> >
>> > Hello,
>> > can you please help me to generate a final report after running
>> playbook
>> > I have different playbooks for execution and I want a single report
>> file for all.
>> > So that non-technical team can review the output.
>> > Please tell if it is possible in CSV format.
>> >
>> > --
>> > 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/6ce0c54f-0465-4241-a29d-0ab97432e4e2n%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/dc3fb386-15ce-4c18-98d0-4b38ba8d7f9bn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALYKJ26iqnKPEXaRpFuzShNK0CUsR%3Dab%2BgAs8uJDZKJXe5zpRQ%40mail.gmail.com.


Re: [ansible-project] Date in a Jinja template

2020-12-08 Thread harry devine
Thank you!  That worked very well.

Harry

On Tue, Dec 8, 2020, 9:49 AM Dick Visser  wrote:

> I think now() is naive, i.e. it does not know about time zones.
> If you need time zones, then I'd give 'ansible_date_time' a try.
>
> On Tue, 8 Dec 2020 at 15:20, lift...@gmail.com  wrote:
> >
> > I generate a report using a Jinja template file from one of my playbooks
> and mail that file to several users.  In it, I am putting the current date
> and time as follows:
> >
> > Date generated: {{ now(false, '%m/%d/%Y %I:%M:%S') }}
> > ---
> > {% for i in play_hosts | sort %}
> > Host: {{ i }}
> >   Rebooted: {{ hostvars[i]['rebooted']['rebooted'] }}
> >   Total reboot time: {{ hostvars[i]['rebooted']['elapsed'] }} seconds
> > ---
> > {% endfor %}
> >
> > When I get the email, the date is correct but the time is 7 hours off.
> For example, the report was generated and mailed at 10:40:00am yesterday,
> but the time listed via the Jinja template above was 03:40:00.
> >
> > Any ideas on how to get the time be in the current timezone?
> >
> > 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-project+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/8d957e26-0a8b-40bd-9dd4-f7b4f3297a29n%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/CAL8fbwPQfChKV3PA-9Tj-A0AM0u%3DygcWYQcoc0BdjGfXN3q0_w%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/CALYKJ24JqoRMX5X%2B8tNMwJ-a22OB-km1pT70pL6NsBwiVMF1eQ%40mail.gmail.com.


Re: [ansible-project] Using 2 different users in one playbook

2020-12-02 Thread harry devine
Didn't work. I get "incorrect su password " still.

Harry

On Wed, Dec 2, 2020, 11:38 AM Daniel Caillibaud  wrote:

> Le 02/12/20 à  6h39, "lift...@gmail.com"  a écrit :
> > We have a playbook we're trying to implement that will stop an Oracle
> > database via a script, reboot the server, then restart Oracle via a
> > script.  The stop/start of Oracle needs to be run as the oracle user,
> and
> > the reboot needs to be done as root.
> >
> > When we run the playbook, we enter our normal user credentials that has
> > sudo access, but when we try to switch as the oracle user in the
> > playbook, we get "incorrect su password".
>
> I'm noob with ansible, but why trying su method (vs sudo) ?
>
> --
> Daniel
>
> - Tu sais pourquoi Bruce Lee ?
> - Parce qu'on a lui a appris à lire.
>
> --
> 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/20201202173747.09309d12%40quad
> .
>

-- 
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/CALYKJ24cA6QO8XJRagiFn%3DAANXpFY-0YCpkwugpT%2B728WeHRfg%40mail.gmail.com.


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  <mailto:dick.vis...@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>  > <mailto:lifte...@gmail.com>> wrote:
> > >
> > > So now I'm getting this:
> > >
> > > User Emails:
> > >
> > > Date generated: 11/13/2020 11:23:32
> > > [u'us...@example.com <mailto:u%27us...@example.com>',
> u'us...@example.com <mailto:u%27us...@example.com>']
> > >
> > > Harry
> > >
> > > On Friday, November 13, 2020 at 11:13:27 AM UTC-5
> dick@geant.org <mailto:dick@geant.org> wrote:
> > >>
> > >> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com  lift...@gmail.com>  > <mailto: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 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.


[ansible-project] Re: Using fact as loop control in Jinja2 template

2020-06-23 Thread harry devine
Perfect  Exactly what I needed. 

Thank you very much!
Harry

On Tuesday, June 23, 2020 at 2:52:38 PM UTC-4, harry devine wrote:
>
> I have a playbook that will use the user_find API call against our FreeIPA 
> server to retrieve a list of all users.  What I'm trying to do is get the 
> total count, then use that count in my j2 file.  I'm getting the count as 
> follows:
>
> - name: Set IDM facts
>   set_fact:
> idmcount: "{{ userfind.json.result.count|int }}"
>
> - name: Output data
>   template:
> src: uid.csv.j2
> dest: uid.csv
>
>
> In my j2 file, I've tried 2 different things:
>
> Option 1:
> {% for i in idmcount %}
> {{ i }}
> {% endfor %}
>
> This prints the count as strings (the value is 1740):
> 1
> 7
> 4
> 0
>
> Option 2:
> {% for i in {{ idmcount }} %}
> {{ i }}
> {% endfor %}
>
> This gives me the following error:
> fatal: [localhost]: FAILED! => {"changed": false, "msg": "AnsibleError: 
> template error while templating string: expected token ':', got '}'. 
> String: {% for i in {{ idmcount }} %}\n{{ i }}\n{% endfor %}\n"}
>
> So how do I use that count as a loop control variable?
>
> 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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7c6ace1f-1050-49d9-a140-56d3ce7520d9o%40googlegroups.com.


[ansible-project] Re: Using fact as loop control in Jinja2 template

2020-06-23 Thread harry devine
Thank you!  That worked well.  I must've really been over thinking it.  
However, this does lead to another question:  now I'm putting in the actual 
content as follows:

{% for i in range(1, idmcount|int +1) %}
{{ users[i].uid }},{{ users[i].uidnumber }}
{% endfor %}

This works fine, but the values appear to be in (what I think) is the json 
format.  For example:

[u'name1'],[u'']

How do I strip out the "u'" and have just:
name,

Thanks,
Harry
On Tuesday, June 23, 2020 at 2:52:38 PM UTC-4, harry devine wrote:
>
> I have a playbook that will use the user_find API call against our FreeIPA 
> server to retrieve a list of all users.  What I'm trying to do is get the 
> total count, then use that count in my j2 file.  I'm getting the count as 
> follows:
>
> - name: Set IDM facts
>   set_fact:
> idmcount: "{{ userfind.json.result.count|int }}"
>
> - name: Output data
>   template:
> src: uid.csv.j2
> dest: uid.csv
>
>
> In my j2 file, I've tried 2 different things:
>
> Option 1:
> {% for i in idmcount %}
> {{ i }}
> {% endfor %}
>
> This prints the count as strings (the value is 1740):
> 1
> 7
> 4
> 0
>
> Option 2:
> {% for i in {{ idmcount }} %}
> {{ i }}
> {% endfor %}
>
> This gives me the following error:
> fatal: [localhost]: FAILED! => {"changed": false, "msg": "AnsibleError: 
> template error while templating string: expected token ':', got '}'. 
> String: {% for i in {{ idmcount }} %}\n{{ i }}\n{% endfor %}\n"}
>
> So how do I use that count as a loop control variable?
>
> 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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3f29473b-32e2-4e64-a0f3-f446d4156a2co%40googlegroups.com.


[ansible-project] Using fact as loop control in Jinja2 template

2020-06-23 Thread harry devine
I have a playbook that will use the user_find API call against our FreeIPA 
server to retrieve a list of all users.  What I'm trying to do is get the 
total count, then use that count in my j2 file.  I'm getting the count as 
follows:

- name: Set IDM facts
  set_fact:
idmcount: "{{ userfind.json.result.count|int }}"

- name: Output data
  template:
src: uid.csv.j2
dest: uid.csv


In my j2 file, I've tried 2 different things:

Option 1:
{% for i in idmcount %}
{{ i }}
{% endfor %}

This prints the count as strings (the value is 1740):
1
7
4
0

Option 2:
{% for i in {{ idmcount }} %}
{{ i }}
{% endfor %}

This gives me the following error:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "AnsibleError: 
template error while templating string: expected token ':', got '}'. 
String: {% for i in {{ idmcount }} %}\n{{ i }}\n{% endfor %}\n"}

So how do I use that count as a loop control variable?

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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a1c3ce58-af3c-4f84-bad2-9cfbbbaf2fb2o%40googlegroups.com.


[ansible-project] Running Ruby 2.6 from /etc/profile.d via Ansible Playbook in RHEL 7

2020-06-04 Thread harry devine
I have a role I'm testing that will install Redmine (www.redmine.org) on to 
a RHEL 7.8 machine.  Redmine requires Ruby >= 2.3.  So I'm installing Ruby 
2.6.2 via the rhel-server-rhscl-7-rpms repository.  If I log into the 
machine manually and check the Ruby version, its 2.6.2.  However, when I 
connect via my Ansible playbook, Ruby is the default 2.0, so I can't get 
any of the Ruby Gems to install since the version is too old.

Here's the relevant plays/errors:
The /etc/profile.d/enableruby26.sh, as installed by another role i wrote 
that installs Ruby 2.6.2 and uploads this script to /etc/profile.d:

#!/bin/bash
source scl_source enable rh-ruby26

Play:
- name: Make sure to run the newer Ruby if necessary
  shell: source /etc/profile.d/enableruby26.sh
  when: ansible_os_family == 'RedHat' and 
ansible_distribution_major_version == '7'


Errors:
TASK [redmine : Verify Ruby version] 
***
changed: [role-test]

TASK [redmine : Print Ruby version] 

ok: [role-test] => {
"msg": "ruby 2.0.0p648 (2015-12-16) [x86_64-linux]"
}

TASK [redmine : Obtain gem path] 
***
changed: [role-test]

TASK [redmine : Print gem path] 

ok: [role-test] => {
"msg": "/bin/gem"
}

TASK [redmine : Install latest Bundler gem (RHEL 7)] 
***
fatal: [role-test]: FAILED! => {"changed": false, "cmd": 
"/opt/rh/rh-ruby26/root/usr/bin/gem query --remote -n '^bundler$'", "msg": 
"/opt/rh/rh-ruby26/root/usr/bin/ruby: error while loading shared libraries: 
libruby.so.2.6: cannot open shared object file: No such file or directory", 
"rc": 127, "stderr": "/opt/rh/rh-ruby26/root/usr/bin/ruby: error while 
loading shared libraries: libruby.so.2.6: cannot open shared object file: 
No such file or directory\n", "stderr_lines": 
["/opt/rh/rh-ruby26/root/usr/bin/ruby: error while loading shared 
libraries: libruby.so.2.6: cannot open shared object file: No such file or 
directory"], "stdout": "", "stdout_lines": []}

So, how do I get the /etc/profile.d/enableruby26.sh to run and have its 
variables available within my Ansible playbook?

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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d5eff318-a054-4109-88ef-2a3ebffa0eb7%40googlegroups.com.


Re: [ansible-project] loop query

2020-05-30 Thread harry devine
I think you should have:

dev: “{{ item}}”
loop:
  - /dev/sda1

Harry

On Sat, May 30, 2020 at 1:17 PM Kannappan M  wrote:

> Hi  Team,
>
> Recently  i  came to  know that  with.list  is  getting  retired ,  so
> what it is the  replacement  of it.
>
>  For  eg using the  filesystem module   i need to  format the  list of
> disc  please let me know which format  is  correct  first  one or  the
> second one
>
>-name:Format the disk
> filesystem:
>   fstype: xfs
>   dev:
> - /dev/sda1
> - /dev/sdb1
> - /dev/sdc1
> - /dev/sdd1
> - /dev/sde1
>
>
>-name:Format the disk
> filesystem:
>   fstype: xfs
>   dev:
>name:
> - /dev/sda1
> - /dev/sdb1
> - /dev/sdc1
> - /dev/sdd1
> - /dev/sde1
>
> --
> 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/87b602b4-aceb-4087-b5e9-96ee49e83cbd%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALYKJ25a_ejWgRcASMkyxbEJt7Sv1Ww6s%3DTM4XAEPFdcj1j5mA%40mail.gmail.com.


Re: [ansible-project] installing windows updates on windows hosts

2020-05-13 Thread harry devine
Your “hosts” line needs to be before the - name line.

Harry

On Wed, May 13, 2020 at 6:37 PM Tony Wong  wrote:

> ---
> - name: Install all critical and security updates
>   hosts: all
>   win_updates:
> category_names:
> - CriticalUpdates
> - SecurityUpdates
> state: installed
>   register: update_result
>
> - name: Reboot host if required
>   win_reboot:
>   when: update_result.reboot_required
>
>
>
>
> but getting this
>
>
> ERROR! 'win_updates' is not a valid attribute for a Play
>
> The error appears to be in
> '/home/tony/windows/install_windows_updates.yml': line 2, column 3, but may
> be elsewhere in the file depending on the exact syntax problem.
>
> The offending line appears to be:
>
> ---
> - name: Install all critical and security updates
>   ^ here
>
> --
> 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/ad2e6e39-2858-42dc-836a-9edb29f22736%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALYKJ24mh2PodagyQFM%3DtezR_Mhde0roun5wQi%2B3NPFxa79_pg%40mail.gmail.com.


[ansible-project] Re: Adding task output to a file in a loop

2020-05-13 Thread harry devine
OK, I'm finally getting back to this.  I failed to mention that I'm trying 
to query our LDAP server, which is Red Hat IDM (based off of FreeIPA).  
Here's what I have so far but its not working:

---
- hosts: ldap
  gather_facts: no
  become: yes
  become_method: sudo

  tasks:

   - name: Obtain Kerberos Ticket on Tower
 command: /usr/bin/kinit admin@ldap -k -t /var/lib/awx/admin.keytab
 delegate_to: tower_server

   - name: Obtain Kerberos Ticket from LDAP
 command: /usr/bin/kinit admin@ldap -k -t /root/admin.keytab

   - name: Get password entries from getent
 getent:
   database: password

   - name: Set User facts
 set_fact:
   uid_list: "{{ getent_passwd | dict2items | json_query('[].{user:key, 
uid: to_number(value[1])}) }}"

   - name: Set Attribute facts
 set_fact:
   uid_list: "{{ uid_list | json_query('[?uid >= `1000`]) | 
json_query('[?uid <= `1010`]') | sort(attribute='uid') | list }}"

   - name: Add to CSV template
 template:
   src: uid.csv.j2
   dest: uid.csv

Template:

User ID Inventory (generated on $[(datetime.datetime.today().date())]
{% for item in uid_list %}
{{ item.user }},{{ item.uid }}
{% endfor %}

When I run the playbook, I get the following error:

 [root@tower ~]#ansible-playbook uid_inventory.yml -K --check
BECOME password:

PLAY [ldap] 


TASK [Obtain Kerberos Ticket on Tower] 
**

TASK [Obtain Kerberos Ticket on LDAP] 
*

TASK [Get password entries from getent] 
***
fatal: [ldap]: FAILED! => {"ansible_facts": 
{"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, 
"msg": "Missing arguments, or database unknown."}

PLAY RECAP 

ldap   : ok=0changed=0unreachable=0failed=1skipped=2
rescued=0ignored=0

Any thoughts/ideas?

Thanks,
Harry

On Wednesday, May 6, 2020 at 3:41:55 PM UTC-4, harry devine wrote:
>
> I have a shell script that I'm trying to convert to Ansible.  It currently 
> is similar to the following:
>
> for uid in {1000..6500}
>   user = ipa user-find --uid=$uid --raw |grep uid: | awk '{print $2}'
>   echo "user,uid" >> uid.csv
> do
>
> How do I accomplish this in Ansible?  I know I can use the shell module 
> with a loop similar to the following:
>
> - name: Get user name based on the UID
>   shell: "set -o pipefail && /bin/ipa user-find --uid={{ uid }} --raw | 
> grep uid: | awk '{print $2}'"
>   register: output
>   loop:  {{ range(1000, 6500, 1) | list }}
>
> But how can I have each iteration add the values I need to a file?  I know 
> that I can use lineinfile, but I need to have it do this for each iteration 
> of the loop.
>
> 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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/eb72e245-6e5d-48d6-a42c-a50405b0b512%40googlegroups.com.


Re: [ansible-project] Adding task output to a file in a loop

2020-05-07 Thread harry devine
Each time through the loop, will the registered output overwrite the
previous values?

Harry

On Wed, May 6, 2020 at 11:51 PM Brian Coca  wrote:

> I would use a template , you can use  the  registered results in a for
> loop inside jinja2.
>
>
>
> --
> --
> Brian Coca
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CACVha7fqrKTqfZKfWVT1ckTve-9m5n0GBEzYbt5SRKrmvPPU%3Dg%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/CALYKJ251BANPT2x%3D1vjCe-YNc6M9AsH%2BkzdAciBoB_qgeNQ%3D_g%40mail.gmail.com.


[ansible-project] Adding task output to a file in a loop

2020-05-06 Thread harry devine
I have a shell script that I'm trying to convert to Ansible.  It currently 
is similar to the following:

for uid in {1000..6500}
  user = ipa user-find --uid=$uid --raw |grep uid: | awk '{print $2}'
  echo "user,uid" >> uid.csv
do

How do I accomplish this in Ansible?  I know I can use the shell module 
with a loop similar to the following:

- name: Get user name based on the UID
  shell: "set -o pipefail && /bin/ipa user-find --uid={{ uid }} --raw | 
grep uid: | awk '{print $2}'"
  register: output
  loop:  {{ range(1000, 6500, 1) | list }}

But how can I have each iteration add the values I need to a file?  I know 
that I can use lineinfile, but I need to have it do this for each iteration 
of the loop.

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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7fe7c4dc-a1af-413c-962a-adcfe98a6a5a%40googlegroups.com.


[ansible-project] Iterating ansible_mounts and adding items to a list

2020-04-13 Thread harry devine
I'm trying to come up a way to iterate through ansible_mounts and, if one 
of the mounts is over 80% used, add that to a list that i can print out 
later and possibly email it.  Here's what I have so far:

---
- hosts: localhost
  gather_facts: no
  become: yes
  become_method: sudo

  pre_tasks:
- setup:
filter: 'ansible_mounts'

  tasks:

   - name: Show the mounts and disk usage
 debug:
   msg: "Disk usage: {{ item.mount }} is {{ (100 * ((item.size_total - 
item.size_available)/item.size_total))| float | round(1, 'common') }}%"
 when: "(100 * ((item.size_total - 
item.size_available)/item.size_total)) > 80"
 with_items:
   - "{{ ansible_mounts }}"
 loop_control:
   label: "{{ item.mount }}"

This works, but I'm not sure how to add it to a list.  I'm doing this on 
localhost for how to get the idea solid, then I should be able to run it on 
other hosts.  Any ideas on how to accomplish this?

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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ddef7136-4919-4082-a7e9-f4a6e1fb9751%40googlegroups.com.


[ansible-project] Unexpected parameter type in new Ansible role

2020-03-09 Thread harry devine
I'm trying to create a role that will update Satellite content views using 
the Foreman/Katello modules.  Here's what the role tree looks like:

 [root@server1 /etc/ansible/roles/foreman_content_views]#tree
.
├── defaults
│   └── main.yml
├── tasks
│   ├── clean_cv.yml
│   └── main.yml
└── vars
└── main.yml

3 directories, 4 files

If I check the syntax on each YML file using "ansible-playbook 
--syntax-check" they check out fine.  But when I run the main playbook, I 
get the following error after I include the role:

PLAY [Manage Satellite Content Views] 
**

TASK [Manage Satellite Content Views] 
**
ERROR! unexpected parameter type in action: 

The error appears to be in 
'/etc/ansible/roles/foreman_content_views/tasks/main.yml': line 1, column 
3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Playbook to perform a repo sync from the sat server
  ^ here

Here's the main playbook I'm running to start the run:
---
- name: "Manage Satellite Content Views"
  hosts: server1
  gather_facts: no

  tasks:
- name: "Manage Satellite Content Views"
  include_role:
name: "foreman_content_views"

The main.yml under tasks is as follows:

- name: Playbook to perform a repo sync from the sat server
  hosts: localhost

  tasks:
  # Sync all repositories
  - name: Get all repositories
foreman_search_facts:
  username: "{{sat_user}}"
  password: "{{sat_passwd}}"
  server_url: "https://{{sat_server_fqdn}};
  resource: repositories
  validate_certs: "{{validate_sat_cert}}"
register: repositories


Any ideas on what could be going on?

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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0d3ab447-7a8a-4cb8-86e1-1cb12365649b%40googlegroups.com.


Re: [ansible-project] Sum a list of items received

2020-03-03 Thread harry devine
I did a "pip install -U jinja2", then "pip install jinja2", and it appears 
to have installed 2.11.1.  Now the playbook runs, so that must've been it.  

Now I need to figure out how to check the other 2 gluster volumes at the 
same time, then do each gluster server 1 at a time.  But that's another 
topic that I won't go into here.  Yet.

Thanks,
Harry

On Tuesday, March 3, 2020 at 9:14:34 AM UTC-5, harry devine wrote:
>
> My system is RHEL 7.7.  The version of jinja2 is 2.7.2 and there isn't a 
> newer version available:
>
>  [root@server1 ~]#rpm -qa python-jinja2
> python-jinja2-2.7.2-4.el7.noarch
>
> Harry
>
> On Tuesday, March 3, 2020 at 8:38:23 AM UTC-5, Felix Fontein wrote:
>>
>> Hi, 
>>
>> > Well, I'm obviously completely misunderstanding something.  Here's 
>> > what the playbook looks like: 
>> > [...] 
>> > fatal: [server1]: FAILED! => {"msg": "The conditional check 
>> > 'home_heal_status.glusterfs.heal_info | 
>> > selectattr('no_of_entries','ne','0') | list | count == 0' failed. The 
>> > error was: no test named 'ne'"} 
>> > 
>> > Sure looks like 'ne' doesn't exist to me! 
>>
>> you might have an older Jinja2 version installed. IIRC the 'ne' test 
>> was not present in every version. 
>>
>> Cheers, 
>> Felix 
>>
>>
>>
>>

-- 
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/7c637bfb-b3cb-4586-8b03-9bfa6085e59d%40googlegroups.com.


Re: [ansible-project] Sum a list of items received

2020-03-03 Thread harry devine
My system is RHEL 7.7.  The version of jinja2 is 2.7.2 and there isn't a 
newer version available:

 [root@server1 ~]#rpm -qa python-jinja2
python-jinja2-2.7.2-4.el7.noarch

Harry

On Tuesday, March 3, 2020 at 8:38:23 AM UTC-5, Felix Fontein wrote:
>
> Hi, 
>
> > Well, I'm obviously completely misunderstanding something.  Here's 
> > what the playbook looks like: 
> > [...] 
> > fatal: [server1]: FAILED! => {"msg": "The conditional check 
> > 'home_heal_status.glusterfs.heal_info | 
> > selectattr('no_of_entries','ne','0') | list | count == 0' failed. The 
> > error was: no test named 'ne'"} 
> > 
> > Sure looks like 'ne' doesn't exist to me! 
>
> you might have an older Jinja2 version installed. IIRC the 'ne' test 
> was not present in every version. 
>
> Cheers, 
> Felix 
>
>
>
>

-- 
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/9d0a6c74-0901-47c5-a3b2-204fa436db8b%40googlegroups.com.


Re: [ansible-project] Sum a list of items received

2020-03-03 Thread harry devine
Well, I'm obviously completely misunderstanding something.  Here's what the 
playbook looks like:

---
- hosts: gluster
  become: yes
  become_method: sudo
  gather_facts: no

  tasks:

  - name: Find out the healing status of /home
gluster_heal_info:
  name: home
  status_filter: self-heal
register: home_heal_status
until: home_heal_status.glusterfs.heal_info | 
selectattr('no_of_entries','ne','0') | list | count == 0
retries: 5
delay: 10

  - name: Test if we can continue
ping:

And here's the error I get:

fatal: [server1]: FAILED! => {"msg": "The conditional check 
'home_heal_status.glusterfs.heal_info | 
selectattr('no_of_entries','ne','0') | list | count == 0' failed. The error 
was: no test named 'ne'"}

Sure looks like 'ne' doesn't exist to me!

Harry


On Monday, March 2, 2020 at 4:41:08 PM UTC-5, Kai Stian Olstad wrote:
>
> On Mon, Mar 02, 2020 at 01:26:28PM -0800, harry devine wrote: 
> > Is there a "not equal to" jinja filter?  All of the documentation I find 
> > shows there's an 'equalto' but I can't seem to find any "no equalto" 
> > equivalent.  Even a greater than would work but I can't find anything 
> like 
> > that either. 
>
> There is not a "not equal to" filter or an "equalto" filer. 
> But you have a "not equal to" _test_ 
> https://jinja.palletsprojects.com/en/2.10.x/templates/#ne 
> As used in Daniels example 
>
> and an "equal to" _test_ 
> https://jinja.palletsprojects.com/en/2.10.x/templates/#eq 
>
> Greater then _test_ is called gt 
> https://jinja.palletsprojects.com/en/2.10.x/templates/#gt 
>
> All the _tests_ is here 
>
> https://jinja.palletsprojects.com/en/2.10.x/templates/#list-of-builtin-tests 
>
> -- 
> Kai Stian Olstad 
>

-- 
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/d42cd5a3-d150-4e68-85d4-bb58d4d06443%40googlegroups.com.


Re: [ansible-project] Sum a list of items received

2020-03-02 Thread harry devine
Is there a "not equal to" jinja filter?  All of the documentation I find 
shows there's an 'equalto' but I can't seem to find any "no equalto" 
equivalent.  Even a greater than would work but I can't find anything like 
that either.

Harry

On Monday, March 2, 2020 at 11:49:09 AM UTC-5, Daniel Whitley wrote:
>
> Hey Harry-
> That's insightful information about heal_info actually being a list of 
> dicts.  With that being said, while you CAN create a sum (one such way is 
> something like {{ heal_info | map(attribute='no_of_entries') | map('int') | 
> sum() }}), I still question if that is truly necessary.  It sounds to me as 
> if all you care about is waiting until 
> <https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#retrying-a-task-until-a-condition-is-met>
>  
> no_of_entries is 0 for every brick.  Using your initial task, I wonder if 
> this untested pseudo-code could be modified for your needs:
>
>   - name: Find out the healing status of /home
> gluster_heal_info:
>   name: home
>   status_filter: self-heal
> register: home_heal_status
> until: home_heal_status.glusterfs.heal_info | 
> selectattr('no_of_entries','ne','0') | list | count == 0
> retries: 5
>     delay: 10
>
> Hopefully this is helpful.
> -Daniel
>
> On Mon, Mar 2, 2020 at 9:30 AM harry devine  > wrote:
>
>>
>>
>> On Thursday, February 27, 2020 at 1:44:39 PM UTC-5, harry devine wrote:
>>>
>>> Hey Daniel!  This stem from ticket #02582900. Since the stance from 
>>> Support is “we don’t debug playbooks”, I care here. 
>>>
>>> Their suggestion was to make sure that no healing operation was going 
>>> on, stop Gluster, do the “yum update “, then restart Gluster & move to the 
>>> next server. 
>>>
>>> So what I’m trying to accomplish is start with server1, wait for any 
>>> healing operations on our 3 volumes to finish, stop/update/start then move 
>>> to the next. I’m sure this will lead to a “workflow template” 
>>> discussion/approach, but right now this is my starting point. 
>>>
>>> Thanks,
>>> Harry
>>>
>>> On Thu, Feb 27, 2020 at 12:48 PM Daniel Whitley >> > wrote:
>>>
>>>> Hey Harry-
>>>> I saw this over my lunch break and thought I'd ask if it really matters 
>>>> (meaning, do you use it later or something) what the count/sum is or if 
>>>> you 
>>>> just want to wait until something is true (such as the number of "heals" 
>>>> is 
>>>> 0).  If the count doesn't really matter, I wonder if you could take 
>>>> advantage of until 
>>>> <https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#retrying-a-task-until-a-condition-is-met>
>>>>  
>>>> in your "Find out the healing status of /home" task?  It looks like the 
>>>> gluster_heal_info 
>>>> <https://docs.ansible.com/ansible/latest/modules/gluster_heal_info_module.html>
>>>>  
>>>> module returns a list of files in "heal_info" so you may just want to wait 
>>>> "until" that list is empty before moving on to the next task?  I've not 
>>>> tried this nor ever used the module.  I also realize it doesn't address 
>>>> the 
>>>> question you asked, but you should be used to that from me at this point. 
>>>> :)
>>>> -Daniel
>>>>
>>>>
>>>> On Thu, Feb 27, 2020 at 9:38 AM harry devine >>> > wrote:
>>>>
>>>>> I'm using the gluster_heal_info module to check the heal status of a 
>>>>> gluster volume.  What I'd like to do is gather the "no_of_entries" 
>>>>> parameter, sum them up, and it if it is 0, move to the next step of 
>>>>> stopping gluster on that server, update it, and restart the service.  The 
>>>>> playbook below is my initial test to see how to grab that information.  
>>>>> It 
>>>>> is giving me the following error:
>>>>>
>>>>>  [root@test-server ~]#ansible-playbook gluster_heal_info.yml --limit 
>>>>> storage1.tc.secure-ose.faa.gov -K
>>>>> BECOME password:
>>>>>
>>>>> PLAY [gluster] 
>>>>> *
>>>>>
>>>>> TASK [Find out the healing status of /home] 
>>>>> 

Re: [ansible-project] Sum a list of items received

2020-03-02 Thread harry devine


On Thursday, February 27, 2020 at 1:44:39 PM UTC-5, harry devine wrote:
>
> Hey Daniel!  This stem from ticket #02582900. Since the stance from 
> Support is “we don’t debug playbooks”, I care here. 
>
> Their suggestion was to make sure that no healing operation was going on, 
> stop Gluster, do the “yum update “, then restart Gluster & move to the next 
> server. 
>
> So what I’m trying to accomplish is start with server1, wait for any 
> healing operations on our 3 volumes to finish, stop/update/start then move 
> to the next. I’m sure this will lead to a “workflow template” 
> discussion/approach, but right now this is my starting point. 
>
> Thanks,
> Harry
>
> On Thu, Feb 27, 2020 at 12:48 PM Daniel Whitley  
> wrote:
>
>> Hey Harry-
>> I saw this over my lunch break and thought I'd ask if it really matters 
>> (meaning, do you use it later or something) what the count/sum is or if you 
>> just want to wait until something is true (such as the number of "heals" is 
>> 0).  If the count doesn't really matter, I wonder if you could take 
>> advantage of until 
>> <https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#retrying-a-task-until-a-condition-is-met>
>>  
>> in your "Find out the healing status of /home" task?  It looks like the 
>> gluster_heal_info 
>> <https://docs.ansible.com/ansible/latest/modules/gluster_heal_info_module.html>
>>  
>> module returns a list of files in "heal_info" so you may just want to wait 
>> "until" that list is empty before moving on to the next task?  I've not 
>> tried this nor ever used the module.  I also realize it doesn't address the 
>> question you asked, but you should be used to that from me at this point. :)
>> -Daniel
>>
>>
>> On Thu, Feb 27, 2020 at 9:38 AM harry devine  wrote:
>>
>>> I'm using the gluster_heal_info module to check the heal status of a 
>>> gluster volume.  What I'd like to do is gather the "no_of_entries" 
>>> parameter, sum them up, and it if it is 0, move to the next step of 
>>> stopping gluster on that server, update it, and restart the service.  The 
>>> playbook below is my initial test to see how to grab that information.  It 
>>> is giving me the following error:
>>>
>>>  [root@test-server ~]#ansible-playbook gluster_heal_info.yml --limit 
>>> storage1.tc.secure-ose.faa.gov -K
>>> BECOME password:
>>>
>>> PLAY [gluster] 
>>> *
>>>
>>> TASK [Find out the healing status of /home] 
>>> 
>>> ok: [gluster1]
>>>
>>> TASK [set_fact] 
>>> 
>>> fatal: [gluster1]: FAILED! => {"msg": "Unexpected templating type error 
>>> occurred on ({{ home_heal_status.glusterfs.heal_info | 
>>> sum(attribute='no_of_entries', start=[]) }}): can only concatenate list 
>>> (not \"AnsibleUnsafeText\") to list"}
>>>
>>>
>>> I'm not too familiar with jinja2 templates yet, so I'm sure I'm not 
>>> doing something correct.  Can anyone point me in the right direction?
>>>
>>> Thanks,
>>> Harry
>>>
>>> ---
>>> - hosts: gluster
>>>   become: yes
>>>   become_method: sudo
>>>   gather_facts: no
>>>
>>>   tasks:
>>>
>>>   - name: Find out the healing status of /home
>>> gluster_heal_info:
>>>   name: home
>>>   status_filter: self-heal
>>> register: home_heal_status
>>>
>>>   - set_fact:
>>>   home_heal_entries: "{{ home_heal_status.glusterfs.heal_info | 
>>> sum(attribute='no_of_entries', start=[]) }}"
>>>   - debug:
>>>   msg: "Heal entries: {{ home_heal_entries }}"
>>>
>>> -- 
>>>
>>> -- 
>> 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-proje

Re: [ansible-project] Sum a list of items received

2020-02-27 Thread harry devine
Hey Daniel!  This stem from ticket #02582900. Since the stance from Support
is “we don’t debug playbooks”, I care here.

Their suggestion was to make sure that no healing operation was going on,
stop Gluster, do the “yum update “, then restart Gluster & move to the next
server.

So what I’m trying to accomplish is start with server1, wait for any
healing operations on our 3 volumes to finish, stop/update/start then move
to the next. I’m sure this will lead to a “workflow template”
discussion/approach, but right now this is my starting point.

Thanks,
Harry

On Thu, Feb 27, 2020 at 12:48 PM Daniel Whitley 
wrote:

> Hey Harry-
> I saw this over my lunch break and thought I'd ask if it really matters
> (meaning, do you use it later or something) what the count/sum is or if you
> just want to wait until something is true (such as the number of "heals" is
> 0).  If the count doesn't really matter, I wonder if you could take
> advantage of until
> <https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#retrying-a-task-until-a-condition-is-met>
> in your "Find out the healing status of /home" task?  It looks like the
> gluster_heal_info
> <https://docs.ansible.com/ansible/latest/modules/gluster_heal_info_module.html>
> module returns a list of files in "heal_info" so you may just want to wait
> "until" that list is empty before moving on to the next task?  I've not
> tried this nor ever used the module.  I also realize it doesn't address the
> question you asked, but you should be used to that from me at this point. :)
> -Daniel
>
>
> On Thu, Feb 27, 2020 at 9:38 AM harry devine  wrote:
>
>> I'm using the gluster_heal_info module to check the heal status of a
>> gluster volume.  What I'd like to do is gather the "no_of_entries"
>> parameter, sum them up, and it if it is 0, move to the next step of
>> stopping gluster on that server, update it, and restart the service.  The
>> playbook below is my initial test to see how to grab that information.  It
>> is giving me the following error:
>>
>>  [root@test-server ~]#ansible-playbook gluster_heal_info.yml --limit
>> storage1.tc.secure-ose.faa.gov -K
>> BECOME password:
>>
>> PLAY [gluster]
>> *
>>
>> TASK [Find out the healing status of /home]
>> 
>> ok: [gluster1]
>>
>> TASK [set_fact]
>> 
>> fatal: [gluster1]: FAILED! => {"msg": "Unexpected templating type error
>> occurred on ({{ home_heal_status.glusterfs.heal_info |
>> sum(attribute='no_of_entries', start=[]) }}): can only concatenate list
>> (not \"AnsibleUnsafeText\") to list"}
>>
>>
>> I'm not too familiar with jinja2 templates yet, so I'm sure I'm not doing
>> something correct.  Can anyone point me in the right direction?
>>
>> Thanks,
>> Harry
>>
>> ---
>> - hosts: gluster
>>   become: yes
>>   become_method: sudo
>>   gather_facts: no
>>
>>   tasks:
>>
>>   - name: Find out the healing status of /home
>> gluster_heal_info:
>>   name: home
>>   status_filter: self-heal
>> register: home_heal_status
>>
>>   - set_fact:
>>   home_heal_entries: "{{ home_heal_status.glusterfs.heal_info |
>> sum(attribute='no_of_entries', start=[]) }}"
>>   - debug:
>>   msg: "Heal entries: {{ home_heal_entries }}"
>>
>> --
>>
>> --
> 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/CA%2BM63kcQw_UTUMW%2BmLXd0uNv3Bgowfdy9yP_v%2B55yW9cKkKN6A%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CA%2BM63kcQw_UTUMW%2BmLXd0uNv3Bgowfdy9yP_v%2B55yW9cKkKN6A%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALYKJ26a02xq6HdogAF4jXKY9V542CysVm37vSnJgVvA9y7r8A%40mail.gmail.com.


[ansible-project] Sum a list of items received

2020-02-27 Thread harry devine
I'm using the gluster_heal_info module to check the heal status of a 
gluster volume.  What I'd like to do is gather the "no_of_entries" 
parameter, sum them up, and it if it is 0, move to the next step of 
stopping gluster on that server, update it, and restart the service.  The 
playbook below is my initial test to see how to grab that information.  It 
is giving me the following error:

 [root@test-server ~]#ansible-playbook gluster_heal_info.yml --limit 
storage1.tc.secure-ose.faa.gov -K
BECOME password:

PLAY [gluster] 
*

TASK [Find out the healing status of /home] 

ok: [gluster1]

TASK [set_fact] 

fatal: [gluster1]: FAILED! => {"msg": "Unexpected templating type error 
occurred on ({{ home_heal_status.glusterfs.heal_info | 
sum(attribute='no_of_entries', start=[]) }}): can only concatenate list 
(not \"AnsibleUnsafeText\") to list"}


I'm not too familiar with jinja2 templates yet, so I'm sure I'm not doing 
something correct.  Can anyone point me in the right direction?

Thanks,
Harry

---
- hosts: gluster
  become: yes
  become_method: sudo
  gather_facts: no

  tasks:

  - name: Find out the healing status of /home
gluster_heal_info:
  name: home
  status_filter: self-heal
register: home_heal_status

  - set_fact:
  home_heal_entries: "{{ home_heal_status.glusterfs.heal_info | 
sum(attribute='no_of_entries', start=[]) }}"
  - debug:
  msg: "Heal entries: {{ home_heal_entries }}"

-- 
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/aaeba2b2-5b21-4f9e-9784-5721a9aa66e2%40googlegroups.com.


Re: [ansible-project] Templating error with Ansible 2.9 or higher

2020-02-24 Thread harry devine
ews : debug] 


TASK [satellite6_manage_content_views : Remove previous content view 
version] 
*

TASK [satellite6_manage_content_views : debug] 


TASK [satellite6_manage_content_views : Obtain latest RHEL7 content view 
data] 

included: 
/etc/ansible/roles/satellite6_manage_content_views/tasks/get_content_views.yml 
for test-server

TASK [satellite6_manage_content_views : Obtain content view ID] 
***
ok: [test-server]

TASK [satellite6_manage_content_views : debug] 


TASK [satellite6_manage_content_views : Build list of content views to 
remove] 

included: 
/etc/ansible/roles/satellite6_manage_content_views/tasks/build_cv_keep_list.yml 
for test-server

TASK [satellite6_manage_content_views : Create list of content view version 
names] 

ok: [test-server]

TASK [satellite6_manage_content_views : debug] 


TASK [satellite6_manage_content_views : Output vars used in building the 
custom facts] 

fatal: [test-server]: FAILED! => {"msg": "Error in jmespath.search in 
json_query filter plugin:\n'cv_ver_names_jq' is undefined"}

TASK [satellite6_manage_content_views : Set statistics output] 

ok: [test-server]

TASK [satellite6_manage_content_views : Report content view changes] 
**
ok: [test-server] => {
"msg": [
"Total content views published: 1",
"Content views published:",
[
"RHEL7"
],
"Total composite content views published: 0",
"Composite content views published:",
[],
"Total content view promotions: 1",
"Content views promoted:",
[
"RHEL7 was promoted to Production"
],
"Total composite content view component updates: 0",
"Composite content view components updated:",
[],
"Total content view versions removed: 0",
"Content view versions removed:",
[]
]
}

PLAY RECAP 

test-server : ok=45   changed=2unreachable=0failed=1    skipped=28  
 rescued=0ignored=0

Thanks,
Harry

On Friday, February 21, 2020 at 5:42:04 PM UTC-5, Hugo Gonzalez wrote:
>
>
>
> On 2/19/20 8:02 AM, harry devine wrote:
>
> I'm using the Satellite6 Content Views role found here:  
> https://galaxy.ansible.com/ahuffman/satellite6_manage_content_views.  It 
> works on Ansible up to 2.8.6, but any version after that gives the 
> following error: 
>
> TASK [satellite6_manage_content_views : Set content view remove list] 
> 
> fatal: [test-server]: FAILED! => {"msg": "Unexpected templating type error 
> occurred on ({{ cv_ver_names | difference(cv_keep_list) }}): coercing to 
> Unicode: need string or buffer, dict found"}
>
> I filed an issue on the author's Github repo in October when Ansible 2.9 
> rc5 was automatically installed on my system, but nothing has been done 
> with it since I filed it.  I'd like to try and fix it myself, but I don't 
> understand what the error means or is doing.  Here's the YAML code that's 
> being executed when it fails:
>
>
> All the debug statements you put in the code will set you see if the lists 
> you're trying to get t

[ansible-project] Templating error with Ansible 2.9 or higher

2020-02-19 Thread harry devine
I'm using the Satellite6 Content Views role found here:  
https://galaxy.ansible.com/ahuffman/satellite6_manage_content_views.  It 
works on Ansible up to 2.8.6, but any version after that gives the 
following error:

TASK [satellite6_manage_content_views : Set content view remove list] 

fatal: [test-server]: FAILED! => {"msg": "Unexpected templating type error 
occurred on ({{ cv_ver_names | difference(cv_keep_list) }}): coercing to 
Unicode: need string or buffer, dict found"}

I filed an issue on the author's Github repo in October when Ansible 2.9 
rc5 was automatically installed on my system, but nothing has been done 
with it since I filed it.  I'd like to try and fix it myself, but I don't 
understand what the error means or is doing.  Here's the YAML code that's 
being executed when it fails:


---
- name: "Create list of content view version names"
  set_fact:
cv_ver_names: "{{ cv_qry.json.results[0] | json_query(cv_ver_names_jq ) 
| sort(attribute='id',reverse=True) }}"
  vars:
cv_ver_names_jq: "versions[*].{name: version, id: id}"

- debug:
var: "cv_ver_names"
verbosity: "1"

- name: "Set content view version keep list"
  set_fact:
cv_keep_list: "{{ keep_qry }}"
  vars:
keep_count: ":{{ cv.keep_content_view_versions_count }}"
keep_qry: "{{ '{{' }} cv_ver_names[{{ keep_count }}] {{ '}}' }}"

- debug:
var: "cv_keep_list"
verbosity: "1"

- name: "Set content view remove list"
  set_fact:
cv_remove_list: "{{ cv_ver_names | difference(cv_keep_list) }}"

- debug:
var: "cv_remove_list"
verbosity: "1"

Any help would be appreciated.

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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/48cf5321-f37a-4c56-a642-e5de05c2d080%40googlegroups.com.


[ansible-project] Re: Sending output from a completed job via the mail module

2019-09-05 Thread harry devine
I'll admit, this playbook is running in Ansible Tower, which is where I'm 
getting tower_id from.  I know that I could reach out to Red Hat for Tower 
questions, but in the past I've had them reject my support requests for 
these types of questions.  They say that they don't support with any 
playbook code/authoring, which is why I was reaching out here.

I tried the URI module and got the same error.  Basically, I want to email 
the stdout of a playbook, so do I need to spawn a new playbook to do that?

Thanks,
Harry

On Thursday, September 5, 2019 at 12:22:16 PM UTC-4, Cade Lambert wrote:
>
> Couple of things:
>
> 1. Ansible has a uri module for API calls, it'll do the same thing but 
> best practice is to use a module if there's one available.
> 2. Where are you getting tower_id from?  It looks like it's undefined.
> 3. Are you kicking the template off with an API call too?  That'd be the 
> best way, then register the results and parse out the job ID from those 
> results.
>
> Something like
> - API call to initiate template and register results into variable1
> - API call to get the job output, using the variable to parse the job ID, 
> then register those results to variable2
> - Mail module to email the contents of variable2
>

-- 
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/e37d3ecb-629c-4753-8435-d21fa8c7ac13%40googlegroups.com.


[ansible-project] Sending output from a completed job via the mail module

2019-09-05 Thread harry devine
We have a playbook where, once its completed, we'd like to email the stdout 
to certain users.  Right now I am testing with the command module in the 
playbook as follows:

- name: Get job output
  command: curl -k -u admin:{{ tower_pass }}  -X GET 
https:///api/v2/jobs/{{ tower_id }}/stdout/
  register: output

-name: Print output
  debug:
msg: "{{ output.stdout }}"

Obviously it doesn't work or else I wouldn't be posting this.  The error I 
get is:

The task includes an option with an undefined variable. The error was: 
'tower_id' is undefined\n\nThe error appears to be in 
'/var/lib/awx/projects/tsose/tsose_uptime.yml': line 15, column 6, but 
may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe 
offending line appears to be:\n\n\n   - name: Get job output\n ^ here\n

Any ideas on how we can get a job's stdout via the API once the job is 
completed?

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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a77b3edf-582c-435c-9339-f72b86bca8c1%40googlegroups.com.


[ansible-project] Attaching/detaching storage domains

2019-08-27 Thread harry devine
We have a Red Hat RHV setup that uses NFS for its storage.  We are moving 
to a Red Hat Hyperconverged solution that uses GlusterFS for its storage.  
We have a Data domain called Migrate that we use to move the VM disks from 
the NFS storage domain to this NFS migrate domain.

What we'd like to do is, via an Ansible Playbook, attach the Migrate domain 
to RHV, move the disk(s) to it, put the Migrate domain back in maintenance, 
detach it, then attach it on the Hyperconverged setup, then import the VM 
and move the disk(s) to the Gluster storage domain.

Anyone have any examples of how to do this?  I'm reading up about 
ovirt_storage_domain at docs.ansible.com, but it seems like the examples 
are very generic.

Thanks for any ideas!
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0e3a5193-9e50-477e-a633-bce038dd5a05%40googlegroups.com.


[ansible-project] Re: Erroneous playbook failure

2019-08-14 Thread harry devine
Anyone have any ideas?



On Monday, August 12, 2019 at 7:40:28 AM UTC-4, harry devine wrote:
>
> We have a playbook that runs every night that will do a "yum update" on 
> all of our servers, then performs an "aide --update" to keep AIDE up to 
> date.  Whenever a difference is found, Ansible flags it as a fatal error.  
> The msg is "non zero return code" and the rc value is 7.
>
> Here'a sample of the output:
>
> AIDE 0.15.1 found differences between database and filesystem!! Start 
> timestamp: 2019-08-12 02:39:23 Summary: Total number of files: 188094 Added 
> files: 137 Removed files: 4 Changed files: 16 
> --- Added files: 
> --- added: 
> /bin/insights-client added: /bin/insights-client-run added: 
> /bin/redhat-access-insights added: /bin/sha1hmac added: /bin/sha256hmac 
> added: /bin/sha384hmac added: /bin/sha512hmac added: 
> /boot/initramfs-3.10.0-957.21.2.el7.x86_64.img.bak added: 
> /etc/cron.daily/aide.check added: /etc/insights-client added: 
> /etc/insights-client/.cache.json added: 
> /etc/insights-client/.cache.json.asc added: /etc/insights-client/.exp.sed 
> added: /etc/insights-client/.fallback.json added: 
> /etc/insights-client/.fallback.json.asc added: 
> /etc/insights-client/.insights-core-gpg-sig.etag added: 
> /etc/insights-client/.insights-core.etag added: 
> /etc/insights-client/.last-upload.results added: 
> /etc/insights-client/.lastupload added: /etc/insights-client/.registered 
> added: /etc/insights-client/cert-api.access.redhat.com.pem added: 
> /etc/insights-client/insights-client.conf added: 
> /etc/insights-client/machine-id added: 
> /etc/insights-client/redhattools.pub.gpg added: 
> /etc/insights-client/rpm.egg added: /etc/insights-client/rpm.egg.asc added: 
> /etc/pki/entitlement/7834364010455541223-key.pem added: 
> /etc/pki/entitlement/7834364010455541223.pem added: 
> /etc/redhat-access-insights added: /etc/redhat-access-insights/.lastupload 
> added: /etc/redhat-access-insights/.registered added: 
> /etc/redhat-access-insights/machine-id added: 
> /etc/redhat-access-insights/redhat-access-insights.conf added: 
> /etc/redhat-access-insights/redhat-access-insights.cron added: 
> /etc/sysctl.d/99-tcpsack.conf added: /etc/system-fips added: 
> /etc/systemd/system/multi-user.target.wants/insights-client.timer added: 
> /lib/dracut/dracut.conf.d/40-fips.conf added: /lib/dracut/modules.d/01fips 
> added: /lib/dracut/modules.d/01fips/fips-boot.sh added: 
> /lib/dracut/modules.d/01fips/fips-noboot.sh added: 
> /lib/dracut/modules.d/01fips/fips.sh added: 
> /lib/dracut/modules.d/01fips/module-setup.sh added: 
> /lib/python2.7/site-packages/insights_client added: 
> /lib/python2.7/site-packages/insights_client/__init__.py added: 
> /lib/python2.7/site-packages/insights_client/__init__.pyc added: 
> /lib/python2.7/site-packages/insights_client/__init__.pyo added: 
> /lib/python2.7/site-packages/insights_client/constants.py added: 
> /lib/python2.7/site-packages/insights_client/constants.pyc added: 
> /lib/python2.7/site-packages/insights_client/constants.pyo added: 
> /lib/python2.7/site-packages/insights_client/major_version.py added: 
> /lib/python2.7/site-packages/insights_client/major_version.pyc added: 
> /lib/python2.7/site-packages/insights_client/major_version.pyo added: 
> /lib/python2.7/site-packages/insights_client/run.py added: 
> /lib/python2.7/site-packages/insights_client/run.pyc added: 
> /lib/python2.7/site-packages/insights_client/run.pyo added: 
> /lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info added: 
> /lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info/PKG-INFO 
> added: 
> /lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info/SOURCES.txt 
> added: 
> /lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info/dependency_links.txt
>  
> added: 
> /lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info/entry_points.txt
>  
> added: 
> /lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info/requires.txt
>  
> added: 
> /lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info/top_level.txt
>  
> added: /lib/systemd/system/insights-client.service added: 
> /lib/systemd/system/insights-client.timer added: /lib64/hmaccalc added: 
> /lib64/hmaccalc/sha1hmac.hmac added: /lib64/hmaccalc/sha256hmac.hmac added: 
> /lib64/hmaccalc/sha384hmac.hmac added: /lib64/hmaccalc/sha512hmac.hmac 
> added: /root/.ansible added: /root/.ansible/tmp added: 
> /root/.cache/imsettings/log.bak added: /root/.gnupg/trustdb.gpg added: 
> /root/.local/share/gvfs-metadata/root added: 
> /root/.local/share/gvfs-metadata/root-bf61d634.

[ansible-project] Erroneous playbook failure

2019-08-12 Thread harry devine
We have a playbook that runs every night that will do a "yum update" on all 
of our servers, then performs an "aide --update" to keep AIDE up to date.  
Whenever a difference is found, Ansible flags it as a fatal error.  The msg 
is "non zero return code" and the rc value is 7.

Here'a sample of the output:

AIDE 0.15.1 found differences between database and filesystem!! Start 
timestamp: 2019-08-12 02:39:23 Summary: Total number of files: 188094 Added 
files: 137 Removed files: 4 Changed files: 16 
--- Added files: 
--- added: 
/bin/insights-client added: /bin/insights-client-run added: 
/bin/redhat-access-insights added: /bin/sha1hmac added: /bin/sha256hmac 
added: /bin/sha384hmac added: /bin/sha512hmac added: 
/boot/initramfs-3.10.0-957.21.2.el7.x86_64.img.bak added: 
/etc/cron.daily/aide.check added: /etc/insights-client added: 
/etc/insights-client/.cache.json added: 
/etc/insights-client/.cache.json.asc added: /etc/insights-client/.exp.sed 
added: /etc/insights-client/.fallback.json added: 
/etc/insights-client/.fallback.json.asc added: 
/etc/insights-client/.insights-core-gpg-sig.etag added: 
/etc/insights-client/.insights-core.etag added: 
/etc/insights-client/.last-upload.results added: 
/etc/insights-client/.lastupload added: /etc/insights-client/.registered 
added: /etc/insights-client/cert-api.access.redhat.com.pem added: 
/etc/insights-client/insights-client.conf added: 
/etc/insights-client/machine-id added: 
/etc/insights-client/redhattools.pub.gpg added: 
/etc/insights-client/rpm.egg added: /etc/insights-client/rpm.egg.asc added: 
/etc/pki/entitlement/7834364010455541223-key.pem added: 
/etc/pki/entitlement/7834364010455541223.pem added: 
/etc/redhat-access-insights added: /etc/redhat-access-insights/.lastupload 
added: /etc/redhat-access-insights/.registered added: 
/etc/redhat-access-insights/machine-id added: 
/etc/redhat-access-insights/redhat-access-insights.conf added: 
/etc/redhat-access-insights/redhat-access-insights.cron added: 
/etc/sysctl.d/99-tcpsack.conf added: /etc/system-fips added: 
/etc/systemd/system/multi-user.target.wants/insights-client.timer added: 
/lib/dracut/dracut.conf.d/40-fips.conf added: /lib/dracut/modules.d/01fips 
added: /lib/dracut/modules.d/01fips/fips-boot.sh added: 
/lib/dracut/modules.d/01fips/fips-noboot.sh added: 
/lib/dracut/modules.d/01fips/fips.sh added: 
/lib/dracut/modules.d/01fips/module-setup.sh added: 
/lib/python2.7/site-packages/insights_client added: 
/lib/python2.7/site-packages/insights_client/__init__.py added: 
/lib/python2.7/site-packages/insights_client/__init__.pyc added: 
/lib/python2.7/site-packages/insights_client/__init__.pyo added: 
/lib/python2.7/site-packages/insights_client/constants.py added: 
/lib/python2.7/site-packages/insights_client/constants.pyc added: 
/lib/python2.7/site-packages/insights_client/constants.pyo added: 
/lib/python2.7/site-packages/insights_client/major_version.py added: 
/lib/python2.7/site-packages/insights_client/major_version.pyc added: 
/lib/python2.7/site-packages/insights_client/major_version.pyo added: 
/lib/python2.7/site-packages/insights_client/run.py added: 
/lib/python2.7/site-packages/insights_client/run.pyc added: 
/lib/python2.7/site-packages/insights_client/run.pyo added: 
/lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info added: 
/lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info/PKG-INFO 
added: 
/lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info/SOURCES.txt 
added: 
/lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info/dependency_links.txt
 
added: 
/lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info/entry_points.txt
 
added: 
/lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info/requires.txt 
added: 
/lib/python2.7/site-packages/insights_client-3.0.3-py2.7.egg-info/top_level.txt 
added: /lib/systemd/system/insights-client.service added: 
/lib/systemd/system/insights-client.timer added: /lib64/hmaccalc added: 
/lib64/hmaccalc/sha1hmac.hmac added: /lib64/hmaccalc/sha256hmac.hmac added: 
/lib64/hmaccalc/sha384hmac.hmac added: /lib64/hmaccalc/sha512hmac.hmac 
added: /root/.ansible added: /root/.ansible/tmp added: 
/root/.cache/imsettings/log.bak added: /root/.gnupg/trustdb.gpg added: 
/root/.local/share/gvfs-metadata/root added: 
/root/.local/share/gvfs-metadata/root-bf61d634.log added: 
/root/.local/share/gvfs-metadata/uuid-a128602d-0ebd-4c04-9260-4e8096c041f8-6ebc08c3.log
 
added: /root/.local/share/keyrings added: 
/root/.local/share/keyrings/login.keyring added: 
/root/.local/share/keyrings/user.keystore added: /root/.ssh/known_hosts 
added: /root/fips_part1.sh added: /root/fips_part2.sh added: /root/temp 
added: /root/temp/gpg.conf added: /root/temp/pubring.gpg added: 
/root/temp/secring.gpg added: /root/temp/trustdb.gpg added: 
/usr/bin/insights-client added: /usr/bin/insights-client-run added: