[ansible-project] Iterating through stdout_lines (jinja formatted data) and returning data

2019-01-29 Thread John Harmon
I wish to automate user removal from nagios.  This can be done via their 
REST api; however, I first need to find the user, grab their user_id, and 
then I can perform the delete based on the user_id.  Their API returns the 
info in jinja format.  I don't know how to iterate through the output, find 
the username, and grab the correlating user_id.  For example, how can I 
obtain the user_id for the user: somegal?

My playbook:
---
- hosts: nagios
  gather_facts: false

  tasks:
- name: Get nagios user info
  shell: 'curl -XGET 
"http://nagios/nagiosxi/api/v1/system/user?apikey==1"'
  register: nagios_userid

- debug:
var: nagios_userid.stdout_lines

Partial output:
ok: [nagios] => {
"nagios_userid": {
"changed": true,
"cmd": "curl -XGET 
\"http://nagios/nagiosxi/api/v1/system/user?apikey==1\"",
"delta": "0:00:00.263619",
"end": "2019-01-29 12:54:17.693892",
"failed": false,
"rc": 0,
...
   "stdout_lines": [
"{",
"\"records\": 27,",
"\"users\": [",
"{",
"\"user_id\": \"37\",",
"\"username\": \"someguy\",",
"\"name\": \"Some Guy\",",
"\"email\": \"s...@example.com\",",
"\"enabled\": \"1\"",
"},",
"{",
"\"user_id\": \"36\",",
"\"username\": \"somegal\",",
"\"name\": \"Some Gal\",",
"\"email\": \"s...@example.com\",",
"\"enabled\": \"1\"",
"},",
"{",
"\"user_id\": \"34\",",
"\"username\": \"gpyle\",",
"\"name\": \"Gomer Pyle\",",
"\"email\": \"gp...@example.com\",",
"\"enabled\": \"1\"",
"},",




-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dd4c1b8c-d5cb-434b-b577-a563f09fd8e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Iterating through stdout_lines (jinja formatted data) and returning data

2019-01-29 Thread John Harmon
Thank you... much easier than what I was doing.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f39303c0-3c68-4eaa-883e-30df777155cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Change password using script

2019-01-29 Thread Kai Stian Olstad

On 29.01.2019 19:33, boncalo mihai wrote:

Still could use if i found out what's wrong with using rc since the
syntax is the same as on ansible website


Most modules doesn't return rc and copy is one of them
https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#rc

You can always use this to show what a module is returning.

- debug: var=

--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/768dbf84f5b193e900f9555d6db04036%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Tags in loop

2019-01-29 Thread Karl Auer
What kind of tag? Do you mean an ansible tag, or a tag for e.g. Amazon
resources?

If you mean Ansible tags, I do not know.

If you mean AWS tags, most resource modules provide a "tags" attribute, if
the resource supports tags. Some resources (generally those with IDs) can
be tagged using the ec2_tag module.

Regards, K.


On Tue, Jan 29, 2019 at 11:25 PM Rafael Tomelin 
wrote:

> Hi dear,
>
> I need create tag in my role, this example:
>
> vars/main.yml
> name_variable:
> tags:
>key1: value1
>key2: value2
>
> in tasks
> taks/main.yml
>
> - name: name my task
>   user: name
>   tags:
>  tags from vars
>
>
> how can create this tags?
>
>
> --
> Atenciosamente,
>
> Rafael Tomelin
> Tel.: 51-84104084
> Skype: rafael.tomelin
>
> LPI ID: LPI000191271
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGEUqbBU%2BN0Byj2aLUDLRwCPgLcYN8X%2BA9yMTns4F5QL0okezQ%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Karl Auer

Email  : ka...@2pisoftware.com
Website: http://2pisoftware.com

GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2B%2BT08S%3DyOXkTpApiE1om%3D8DcpnT%2Bp8673ZyQshSqeoTAd%2B8iQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Change password using script

2019-01-29 Thread boncalo mihai
Thanks Kai, I searched for more information on rc but the
documentation is poor. Thank you for the information!

On Tue, Jan 29, 2019 at 8:44 PM Kai Stian Olstad
 wrote:
>
> On 29.01.2019 19:33, boncalo mihai wrote:
> > Still could use if i found out what's wrong with using rc since the
> > syntax is the same as on ansible website
>
> Most modules doesn't return rc and copy is one of them
> https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#rc
>
> You can always use this to show what a module is returning.
>
> - debug: var=
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/768dbf84f5b193e900f9555d6db04036%40olstad.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAOK917R6NaZibf_RCJgcuwgSOASEKV3B2D3AqzKWQkNX1ZS0vQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Iterating through stdout_lines (jinja formatted data) and returning data

2019-01-29 Thread Kai Stian Olstad

On 29.01.2019 21:19, John Harmon wrote:
I wish to automate user removal from nagios.  This can be done via 
their
REST api; however, I first need to find the user, grab their user_id, 
and
then I can perform the delete based on the user_id.  Their API returns 
the

info in jinja format.


It's not Jinja, its JSON.



I don't know how to iterate through the output, find
the username, and grab the correlating user_id.  For example, how can I
obtain the user_id for the user: somegal?

My playbook:
---
- hosts: nagios
  gather_facts: false

  tasks:
- name: Get nagios user info
  shell: 'curl -XGET
"http://nagios/nagiosxi/api/v1/system/user?apikey=key>=1"'

  register: nagios_userid


You should use the uri module since it gives you the result in .json
Never used Nagios api, but looks like is just a ordinary REST api.
So this should work.

  - name: Get nagios user infouri:
url: http://nagios/nagiosxi/api/v1/system/user?apikey=
headers:
  Content-Type: application/json
register: nagios_userid

Then you can use nagios_userid.json as an ordinary variable in Ansible.


--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c63ba3a7130f80e080a87a8c809bdb52%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Running yum updates with ansible

2019-01-29 Thread Jonathan Lozada De La Matta
I had a similar issue before with centos but, it was more like a limit (
for example 4 ) of kernels that could be install at the moment but, the
current running kernel was uninstalled and the new one did not install
correctly so the system hanged during booting.

On Tue, Jan 29, 2019 at 10:50 AM S C Rigler  wrote:

> I've seen this also.  When the new kernel installs there is a post
> transaction scriplet to build the initrd.  In some cases it doesn't
> build correctly (I see it fail maybe 1-5% of the time) and you'll get
> a panic when the system reboots.  I don't know that I've seen enough
> to blame it on Ansible, though.
>
> --Steve
>
> On Mon, Jan 28, 2019 at 5:02 PM 'Chris Bidwell - NOAA Federal' via
> Ansible Project  wrote:
> >
> > Hey all,
> >
> > So I've done a lot of yum updates with ansible and several times I get
> issues where partial updates are run and it says it's been completed,
> however, I reboot and I'm in a kernel panic because the new kernel didn't
> update properly so I have to revert to the previous kernel and remove the
> newest and reinstall it again.  I also often wind up with transactions that
> haven't been completed.Has anyone experienced this before?
> >
> > Thanks!
> > Chris
> >
> > --
> > 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 post to this group, send email to ansible-project@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAHKi8CgQ87cs0toXZ4pqefZjoA_Yv0mc89DcMLYih7j6nVHgew%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAFbiokfshO7ytXf3RxojLac34PvgMTA%3DDdz3M_igQ7zLakFJxA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Jonathan lozada de la matta

AUTOMATION PRACTICE

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BJkQ-rEp86OHruqn40Tfi-C3jSkbEjkiHJzK7c-ACmt1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Running yum updates with ansible

2019-01-29 Thread Jonathan Lozada De La Matta
well like mentioned this is not ansible specific so i suggest you research
more into the OS side.

On Tue, Jan 29, 2019 at 12:25 PM 'Chris Bidwell - NOAA Federal' via Ansible
Project  wrote:

> So does anyone have any recommendations on how to alleviate this problem?
> Perhaps some sort of delay before exiting or something?
>
> On Tue, Jan 29, 2019 at 8:54 AM Jonathan Lozada De La Matta <
> jloza...@redhat.com> wrote:
>
>> I had a similar issue before with centos but, it was more like a limit (
>> for example 4 ) of kernels that could be install at the moment but, the
>> current running kernel was uninstalled and the new one did not install
>> correctly so the system hanged during booting.
>>
>> On Tue, Jan 29, 2019 at 10:50 AM S C Rigler  wrote:
>>
>>> I've seen this also.  When the new kernel installs there is a post
>>> transaction scriplet to build the initrd.  In some cases it doesn't
>>> build correctly (I see it fail maybe 1-5% of the time) and you'll get
>>> a panic when the system reboots.  I don't know that I've seen enough
>>> to blame it on Ansible, though.
>>>
>>> --Steve
>>>
>>> On Mon, Jan 28, 2019 at 5:02 PM 'Chris Bidwell - NOAA Federal' via
>>> Ansible Project  wrote:
>>> >
>>> > Hey all,
>>> >
>>> > So I've done a lot of yum updates with ansible and several times I get
>>> issues where partial updates are run and it says it's been completed,
>>> however, I reboot and I'm in a kernel panic because the new kernel didn't
>>> update properly so I have to revert to the previous kernel and remove the
>>> newest and reinstall it again.  I also often wind up with transactions that
>>> haven't been completed.Has anyone experienced this before?
>>> >
>>> > Thanks!
>>> > Chris
>>> >
>>> > --
>>> > 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 post to this group, send email to ansible-project@googlegroups.com.
>>> > To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAHKi8CgQ87cs0toXZ4pqefZjoA_Yv0mc89DcMLYih7j6nVHgew%40mail.gmail.com
>>> .
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> 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 post to this group, send email to ansible-project@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAFbiokfshO7ytXf3RxojLac34PvgMTA%3DDdz3M_igQ7zLakFJxA%40mail.gmail.com
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>>
>> Jonathan lozada de la matta
>>
>> AUTOMATION PRACTICE
>>
>>
>>
>>
>> --
>> 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 post to this group, send email to ansible-project@googlegroups.com.
>>
> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BJkQ-rEp86OHruqn40Tfi-C3jSkbEjkiHJzK7c-ACmt1w%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAHKi8Cipf75nDoKznxkO%2Bz1stTMZMDOPSk%3DdsP6XaN9niH7wtQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 

Jonathan lozada de la matta

AUTOMATION PRACTICE

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BLfY7Pp9FX4YJd9ZsZTu3WuPDFWy6S-bTL7GPiCf%2BgnSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Change password using script

2019-01-29 Thread boncalo mihai
Still could use if i found out what's wrong with using rc since the
syntax is the same as on ansible website

On Tue, Jan 29, 2019 at 8:32 PM boncalo mihai  wrote:
>
> Issue solved, used "is succeeded" for validation instead of rc == 1
>
> On Tue, Jan 29, 2019 at 6:26 PM boncalo mihai  wrote:
> >
> > Hi guys,
> >
> > I kinda feel ashamed asking this kind of questions but I'm currently
> > still learning Ansible, only started a week ago and I have to complete
> > this as a part of a personal project that I will present.
> >
> > I wrote a simple playbook for changing passwords on linux systems,
> > will have to add module for windows later but now the issue is with
> > AIX systems.
> > User module isn't working for AIX, I tried things from internet but no
> > success so I wrote a script that changes the password on AIX with 2
> > arguments, user and password---> as a result the password is changed
> > for that user.
> > What I have to do in the playbook is to run copy and run this script
> > on the remote server with the password and user that I give give using
> > -e when the remote system is AIX:
> >
> > - name: User configuration
> >   remote_user: root
> >   hosts: "{{ hosts }}"
> >
> >   tasks:
> > - name: Password change Linux
> >   user:
> > name: root
> > state: present
> > update_password: always
> > password: "{{ admin_password | password_hash('sha512') }}"
> > shell: /bin/bash
> >
> > - name: Copy pw change script AIX
> >   copy:
> > src: /root/docker/centos7-ansible/chpas.sh
> > dest: /tmp/chpas.sh
> > mode: 0777
> >   register: script_copy
> >   when: ansible_distribution == 'AIX'
> >
> > - name: Execute pw change AIX script
> >   command: /tmp/chpas.sh root "{{ admin_password }}"
> >   when: (ansible_distribution == 'AIX') and
> > (script_copy.rc == 1)
> >   register: script_execute
> >
> > - name: Clear files
> >   file:
> > path: '/tmp/chpas.sh'
> > state: absent
> >   when: (ansible_distribution == 'AIX') and
> > (script_execute.rc== 1)
> >
> >
> > the error is :
> >
> >
> > TASK [Gathering Facts]
> > ***
> > ok: [ansible_aix]
> >
> > TASK [Password change Linux]
> > *
> > changed: [ansible_aix] => {"append": false, "changed": true,
> > "comment": "", "group": 0, "home": "/root", "move_home": false,
> > "name": "root", "password": "NOT_LOGGING_PASSWORD", "shell":
> > "/bin/bash", "state": "present", "uid": 0}
> >
> > TASK [Copy pw change script AIX]
> > *
> > ok: [ansible_aix] => {"changed": false, "checksum":
> > "d434aee957d8a46a41f92f76936ebcf53848dc1b", "dest": "/tmp/chpas.sh",
> > "gid": 0, "group": "system", "mode": "0777", "owner": "root", "path":
> > "/tmp/chpas.sh", "size": 458, "state": "file", "uid": 0}
> >
> > TASK [Execute pw change AIX script]
> > **
> > fatal: [ansible_aix]: FAILED! => {"msg": "The conditional check
> > '(ansible_distribution == 'AIX') and (script_copy.rc == 1)' failed.
> > The error was: error while evaluating conditional
> > ((ansible_distribution == 'AIX') and (script_copy.rc == 1)): 'dict
> > object' has no attribute 'rc'\n\nThe error appears to have been in
> > '/root/docker/centos7-ansible/chpass.yml': line 22, column 7, but
> > may\nbe elsewhere in the file depending on the exact syntax
> > problem.\n\nThe offending line appears to be:\n\n\n- name: Execute
> > pw change AIX script\n  ^ here\n"}
> > to retry, use: --limit @/root/docker/centos7-ansible/chpass.retry
> >
> > PLAY RECAP 
> > ***
> > ansible_aix: ok=3changed=1unreachable=0failed=1
> >
> > Attached the yml file since I don't think the code is well aligned after 
> > paste.
> >
> > Thank you very much,
> > Mihai.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this 

[ansible-project] Re: Change password using script

2019-01-29 Thread boncalo mihai
Issue solved, used "is succeeded" for validation instead of rc == 1

On Tue, Jan 29, 2019 at 6:26 PM boncalo mihai  wrote:
>
> Hi guys,
>
> I kinda feel ashamed asking this kind of questions but I'm currently
> still learning Ansible, only started a week ago and I have to complete
> this as a part of a personal project that I will present.
>
> I wrote a simple playbook for changing passwords on linux systems,
> will have to add module for windows later but now the issue is with
> AIX systems.
> User module isn't working for AIX, I tried things from internet but no
> success so I wrote a script that changes the password on AIX with 2
> arguments, user and password---> as a result the password is changed
> for that user.
> What I have to do in the playbook is to run copy and run this script
> on the remote server with the password and user that I give give using
> -e when the remote system is AIX:
>
> - name: User configuration
>   remote_user: root
>   hosts: "{{ hosts }}"
>
>   tasks:
> - name: Password change Linux
>   user:
> name: root
> state: present
> update_password: always
> password: "{{ admin_password | password_hash('sha512') }}"
> shell: /bin/bash
>
> - name: Copy pw change script AIX
>   copy:
> src: /root/docker/centos7-ansible/chpas.sh
> dest: /tmp/chpas.sh
> mode: 0777
>   register: script_copy
>   when: ansible_distribution == 'AIX'
>
> - name: Execute pw change AIX script
>   command: /tmp/chpas.sh root "{{ admin_password }}"
>   when: (ansible_distribution == 'AIX') and
> (script_copy.rc == 1)
>   register: script_execute
>
> - name: Clear files
>   file:
> path: '/tmp/chpas.sh'
> state: absent
>   when: (ansible_distribution == 'AIX') and
> (script_execute.rc== 1)
>
>
> the error is :
>
>
> TASK [Gathering Facts]
> ***
> ok: [ansible_aix]
>
> TASK [Password change Linux]
> *
> changed: [ansible_aix] => {"append": false, "changed": true,
> "comment": "", "group": 0, "home": "/root", "move_home": false,
> "name": "root", "password": "NOT_LOGGING_PASSWORD", "shell":
> "/bin/bash", "state": "present", "uid": 0}
>
> TASK [Copy pw change script AIX]
> *
> ok: [ansible_aix] => {"changed": false, "checksum":
> "d434aee957d8a46a41f92f76936ebcf53848dc1b", "dest": "/tmp/chpas.sh",
> "gid": 0, "group": "system", "mode": "0777", "owner": "root", "path":
> "/tmp/chpas.sh", "size": 458, "state": "file", "uid": 0}
>
> TASK [Execute pw change AIX script]
> **
> fatal: [ansible_aix]: FAILED! => {"msg": "The conditional check
> '(ansible_distribution == 'AIX') and (script_copy.rc == 1)' failed.
> The error was: error while evaluating conditional
> ((ansible_distribution == 'AIX') and (script_copy.rc == 1)): 'dict
> object' has no attribute 'rc'\n\nThe error appears to have been in
> '/root/docker/centos7-ansible/chpass.yml': line 22, column 7, but
> may\nbe elsewhere in the file depending on the exact syntax
> problem.\n\nThe offending line appears to be:\n\n\n- name: Execute
> pw change AIX script\n  ^ here\n"}
> to retry, use: --limit @/root/docker/centos7-ansible/chpass.retry
>
> PLAY RECAP 
> ***
> ansible_aix: ok=3changed=1unreachable=0failed=1
>
> Attached the yml file since I don't think the code is well aligned after 
> paste.
>
> Thank you very much,
> Mihai.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAOK917S%3DjbiH2Awh7tG3Uo0hVjHaK4ro-UMOjZeXByOugJOjPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Running yum updates with ansible

2019-01-29 Thread 'Chris Bidwell - NOAA Federal' via Ansible Project
So does anyone have any recommendations on how to alleviate this problem?
Perhaps some sort of delay before exiting or something?

On Tue, Jan 29, 2019 at 8:54 AM Jonathan Lozada De La Matta <
jloza...@redhat.com> wrote:

> I had a similar issue before with centos but, it was more like a limit (
> for example 4 ) of kernels that could be install at the moment but, the
> current running kernel was uninstalled and the new one did not install
> correctly so the system hanged during booting.
>
> On Tue, Jan 29, 2019 at 10:50 AM S C Rigler  wrote:
>
>> I've seen this also.  When the new kernel installs there is a post
>> transaction scriplet to build the initrd.  In some cases it doesn't
>> build correctly (I see it fail maybe 1-5% of the time) and you'll get
>> a panic when the system reboots.  I don't know that I've seen enough
>> to blame it on Ansible, though.
>>
>> --Steve
>>
>> On Mon, Jan 28, 2019 at 5:02 PM 'Chris Bidwell - NOAA Federal' via
>> Ansible Project  wrote:
>> >
>> > Hey all,
>> >
>> > So I've done a lot of yum updates with ansible and several times I get
>> issues where partial updates are run and it says it's been completed,
>> however, I reboot and I'm in a kernel panic because the new kernel didn't
>> update properly so I have to revert to the previous kernel and remove the
>> newest and reinstall it again.  I also often wind up with transactions that
>> haven't been completed.Has anyone experienced this before?
>> >
>> > Thanks!
>> > Chris
>> >
>> > --
>> > 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 post to this group, send email to ansible-project@googlegroups.com.
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAHKi8CgQ87cs0toXZ4pqefZjoA_Yv0mc89DcMLYih7j6nVHgew%40mail.gmail.com
>> .
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> 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 post to this group, send email to ansible-project@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAFbiokfshO7ytXf3RxojLac34PvgMTA%3DDdz3M_igQ7zLakFJxA%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
>
> Jonathan lozada de la matta
>
> AUTOMATION PRACTICE
>
>
>
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BJkQ-rEp86OHruqn40Tfi-C3jSkbEjkiHJzK7c-ACmt1w%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAHKi8Cipf75nDoKznxkO%2Bz1stTMZMDOPSk%3DdsP6XaN9niH7wtQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Running yum updates with ansible

2019-01-29 Thread 'Chris Bidwell - NOAA Federal' via Ansible Project
Well if I run it manually, I don't have any issues.  I'll look into it
further.  Thanks again.

On Tue, Jan 29, 2019 at 10:48 AM Jonathan Lozada De La Matta <
jloza...@redhat.com> wrote:

> well like mentioned this is not ansible specific so i suggest you research
> more into the OS side.
>
> On Tue, Jan 29, 2019 at 12:25 PM 'Chris Bidwell - NOAA Federal' via
> Ansible Project  wrote:
>
>> So does anyone have any recommendations on how to alleviate
>> this problem?  Perhaps some sort of delay before exiting or something?
>>
>> On Tue, Jan 29, 2019 at 8:54 AM Jonathan Lozada De La Matta <
>> jloza...@redhat.com> wrote:
>>
>>> I had a similar issue before with centos but, it was more like a limit (
>>> for example 4 ) of kernels that could be install at the moment but, the
>>> current running kernel was uninstalled and the new one did not install
>>> correctly so the system hanged during booting.
>>>
>>> On Tue, Jan 29, 2019 at 10:50 AM S C Rigler  wrote:
>>>
 I've seen this also.  When the new kernel installs there is a post
 transaction scriplet to build the initrd.  In some cases it doesn't
 build correctly (I see it fail maybe 1-5% of the time) and you'll get
 a panic when the system reboots.  I don't know that I've seen enough
 to blame it on Ansible, though.

 --Steve

 On Mon, Jan 28, 2019 at 5:02 PM 'Chris Bidwell - NOAA Federal' via
 Ansible Project  wrote:
 >
 > Hey all,
 >
 > So I've done a lot of yum updates with ansible and several times I
 get issues where partial updates are run and it says it's been completed,
 however, I reboot and I'm in a kernel panic because the new kernel didn't
 update properly so I have to revert to the previous kernel and remove the
 newest and reinstall it again.  I also often wind up with transactions that
 haven't been completed.Has anyone experienced this before?
 >
 > Thanks!
 > Chris
 >
 > --
 > 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 post to this group, send email to ansible-project@googlegroups.com
 .
 > To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/CAHKi8CgQ87cs0toXZ4pqefZjoA_Yv0mc89DcMLYih7j6nVHgew%40mail.gmail.com
 .
 > For more options, visit https://groups.google.com/d/optout.

 --
 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 post to this group, send email to ansible-project@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/CAFbiokfshO7ytXf3RxojLac34PvgMTA%3DDdz3M_igQ7zLakFJxA%40mail.gmail.com
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>> --
>>>
>>> Jonathan lozada de la matta
>>>
>>> AUTOMATION PRACTICE
>>>
>>>
>>>
>>>
>>> --
>>> 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 post to this group, send email to ansible-project@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BJkQ-rEp86OHruqn40Tfi-C3jSkbEjkiHJzK7c-ACmt1w%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> 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 post to this group, send email to ansible-project@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAHKi8Cipf75nDoKznxkO%2Bz1stTMZMDOPSk%3DdsP6XaN9niH7wtQ%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
>
> Jonathan lozada de la matta
>
> AUTOMATION PRACTICE
>
>
>
>
> --
> 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.

Re: [ansible-project] Running yum updates with ansible

2019-01-29 Thread S C Rigler
I've seen this also.  When the new kernel installs there is a post
transaction scriplet to build the initrd.  In some cases it doesn't
build correctly (I see it fail maybe 1-5% of the time) and you'll get
a panic when the system reboots.  I don't know that I've seen enough
to blame it on Ansible, though.

--Steve

On Mon, Jan 28, 2019 at 5:02 PM 'Chris Bidwell - NOAA Federal' via
Ansible Project  wrote:
>
> Hey all,
>
> So I've done a lot of yum updates with ansible and several times I get issues 
> where partial updates are run and it says it's been completed, however, I 
> reboot and I'm in a kernel panic because the new kernel didn't update 
> properly so I have to revert to the previous kernel and remove the newest and 
> reinstall it again.  I also often wind up with transactions that haven't been 
> completed.Has anyone experienced this before?
>
> Thanks!
> Chris
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CAHKi8CgQ87cs0toXZ4pqefZjoA_Yv0mc89DcMLYih7j6nVHgew%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFbiokfshO7ytXf3RxojLac34PvgMTA%3DDdz3M_igQ7zLakFJxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Extract the output to excel files

2019-01-29 Thread sajal tiwari
You can check Napalm ansible module for extracting information mentioned by 
you.

On Tuesday, January 29, 2019 at 7:51:05 PM UTC+5:30, Kefi Ammar wrote:
>
> Hello everyone,
>
> I am new to Ansible and I am using it for network operations. So, I am 
> extracting informations from network devices (software versions, platforms, 
> hostnames, interfaces, system infos,...) and they are presented in a messy 
> way that makes it hard to read or organise especially for an important 
> number of devices.
>
> I am asking if there is modules or something that Ansible can do to 
> extract these informations to an excel file or maybe in a .csv file that 
> can be structured. Anyone has an experience with the management and health 
> check of network devices (Cisco and Juniper) using Ansible could help me 
> out.
>
> I am using Ansible 2.7.5
>
> Thank you.
>
> Best regards,
> Ammar
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3080187a-984a-4f81-8913-35de98dd7b73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Running yum updates with ansible

2019-01-29 Thread boncalo mihai
I know this is an ansible group but you could attach dmesg output if you
get one after the kernel fails to boot. Check/var/log/boot-(date)
/var/log/dmesg /var/log/yum.log ...you can start from there.
Also I don't know if you're logging ansible actions every time, but you
could find answers there.

On Tue, Jan 29, 2019 at 8:14 PM 'Chris Bidwell - NOAA Federal' via Ansible
Project  wrote:

> Well if I run it manually, I don't have any issues.  I'll look into it
> further.  Thanks again.
>
> On Tue, Jan 29, 2019 at 10:48 AM Jonathan Lozada De La Matta <
> jloza...@redhat.com> wrote:
>
>> well like mentioned this is not ansible specific so i suggest you
>> research more into the OS side.
>>
>> On Tue, Jan 29, 2019 at 12:25 PM 'Chris Bidwell - NOAA Federal' via
>> Ansible Project  wrote:
>>
>>> So does anyone have any recommendations on how to alleviate
>>> this problem?  Perhaps some sort of delay before exiting or something?
>>>
>>> On Tue, Jan 29, 2019 at 8:54 AM Jonathan Lozada De La Matta <
>>> jloza...@redhat.com> wrote:
>>>
 I had a similar issue before with centos but, it was more like a limit
 ( for example 4 ) of kernels that could be install at the moment but, the
 current running kernel was uninstalled and the new one did not install
 correctly so the system hanged during booting.

 On Tue, Jan 29, 2019 at 10:50 AM S C Rigler  wrote:

> I've seen this also.  When the new kernel installs there is a post
> transaction scriplet to build the initrd.  In some cases it doesn't
> build correctly (I see it fail maybe 1-5% of the time) and you'll get
> a panic when the system reboots.  I don't know that I've seen enough
> to blame it on Ansible, though.
>
> --Steve
>
> On Mon, Jan 28, 2019 at 5:02 PM 'Chris Bidwell - NOAA Federal' via
> Ansible Project  wrote:
> >
> > Hey all,
> >
> > So I've done a lot of yum updates with ansible and several times I
> get issues where partial updates are run and it says it's been completed,
> however, I reboot and I'm in a kernel panic because the new kernel didn't
> update properly so I have to revert to the previous kernel and remove the
> newest and reinstall it again.  I also often wind up with transactions 
> that
> haven't been completed.Has anyone experienced this before?
> >
> > Thanks!
> > Chris
> >
> > --
> > 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 post to this group, send email to
> ansible-project@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAHKi8CgQ87cs0toXZ4pqefZjoA_Yv0mc89DcMLYih7j6nVHgew%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAFbiokfshO7ytXf3RxojLac34PvgMTA%3DDdz3M_igQ7zLakFJxA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>


 --

 Jonathan lozada de la matta

 AUTOMATION PRACTICE




 --
 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 post to this group, send email to ansible-project@googlegroups.com.

>>> To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BJkQ-rEp86OHruqn40Tfi-C3jSkbEjkiHJzK7c-ACmt1w%40mail.gmail.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>> --
>>> 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 post to this group, send email to ansible-project@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAHKi8Cipf75nDoKznxkO%2Bz1stTMZMDOPSk%3DdsP6XaN9niH7wtQ%40mail.gmail.com
>>> 

[ansible-project] Change password using script

2019-01-29 Thread boncalo mihai
Hi guys,

I kinda feel ashamed asking this kind of questions but I'm currently
still learning Ansible, only started a week ago and I have to complete
this as a part of a personal project that I will present.

I wrote a simple playbook for changing passwords on linux systems,
will have to add module for windows later but now the issue is with
AIX systems.
User module isn't working for AIX, I tried things from internet but no
success so I wrote a script that changes the password on AIX with 2
arguments, user and password---> as a result the password is changed
for that user.
What I have to do in the playbook is to run copy and run this script
on the remote server with the password and user that I give give using
-e when the remote system is AIX:

- name: User configuration
  remote_user: root
  hosts: "{{ hosts }}"

  tasks:
- name: Password change Linux
  user:
name: root
state: present
update_password: always
password: "{{ admin_password | password_hash('sha512') }}"
shell: /bin/bash

- name: Copy pw change script AIX
  copy:
src: /root/docker/centos7-ansible/chpas.sh
dest: /tmp/chpas.sh
mode: 0777
  register: script_copy
  when: ansible_distribution == 'AIX'

- name: Execute pw change AIX script
  command: /tmp/chpas.sh root "{{ admin_password }}"
  when: (ansible_distribution == 'AIX') and
(script_copy.rc == 1)
  register: script_execute

- name: Clear files
  file:
path: '/tmp/chpas.sh'
state: absent
  when: (ansible_distribution == 'AIX') and
(script_execute.rc== 1)


the error is :


TASK [Gathering Facts]
***
ok: [ansible_aix]

TASK [Password change Linux]
*
changed: [ansible_aix] => {"append": false, "changed": true,
"comment": "", "group": 0, "home": "/root", "move_home": false,
"name": "root", "password": "NOT_LOGGING_PASSWORD", "shell":
"/bin/bash", "state": "present", "uid": 0}

TASK [Copy pw change script AIX]
*
ok: [ansible_aix] => {"changed": false, "checksum":
"d434aee957d8a46a41f92f76936ebcf53848dc1b", "dest": "/tmp/chpas.sh",
"gid": 0, "group": "system", "mode": "0777", "owner": "root", "path":
"/tmp/chpas.sh", "size": 458, "state": "file", "uid": 0}

TASK [Execute pw change AIX script]
**
fatal: [ansible_aix]: FAILED! => {"msg": "The conditional check
'(ansible_distribution == 'AIX') and (script_copy.rc == 1)' failed.
The error was: error while evaluating conditional
((ansible_distribution == 'AIX') and (script_copy.rc == 1)): 'dict
object' has no attribute 'rc'\n\nThe error appears to have been in
'/root/docker/centos7-ansible/chpass.yml': line 22, column 7, but
may\nbe elsewhere in the file depending on the exact syntax
problem.\n\nThe offending line appears to be:\n\n\n- name: Execute
pw change AIX script\n  ^ here\n"}
to retry, use: --limit @/root/docker/centos7-ansible/chpass.retry

PLAY RECAP 
***
ansible_aix: ok=3changed=1unreachable=0failed=1

Attached the yml file since I don't think the code is well aligned after paste.

Thank you very much,
Mihai.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAOK917SELxhHC%2Bmzg_yeNhTNWuFQ9ZPYb3wOxhGVxzDR4u9Gow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


chpass.yml
Description: Binary data


[ansible-project] Re: Calling a variable within a variable within a jinja pipe filter

2019-01-29 Thread John Harmon


On Tuesday, January 29, 2019 at 3:51:07 PM UTC-7, John Harmon wrote:
>
>  Still trying to figure out how to keep the set_fact from failing when 
> passing in a non-existent user.  If you have ideas for that, please let me 
> know.
>

ignore_errors: yes works with set_fact  

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3318823a-9132-4f3b-881f-01c27e489c0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Tags in loop

2019-01-29 Thread Rafael Tomelin
Hi,

This tag in ansible.  I need set key and value (- key: value), but in variable.

On Tue, Jan 29, 2019 at 7:36 PM Karl Auer  wrote:
>
> What kind of tag? Do you mean an ansible tag, or a tag for e.g. Amazon 
> resources?
>
> If you mean Ansible tags, I do not know.
>
> If you mean AWS tags, most resource modules provide a "tags" attribute, if 
> the resource supports tags. Some resources (generally those with IDs) can be 
> tagged using the ec2_tag module.
>
> Regards, K.
>
>
> On Tue, Jan 29, 2019 at 11:25 PM Rafael Tomelin  
> wrote:
>>
>> Hi dear,
>>
>> I need create tag in my role, this example:
>>
>> vars/main.yml
>> name_variable:
>> tags:
>>key1: value1
>>key2: value2
>>
>> in tasks
>> taks/main.yml
>>
>> - name: name my task
>>   user: name
>>   tags:
>>  tags from vars
>>
>>
>> how can create this tags?
>>
>>
>> --
>> Atenciosamente,
>>
>> Rafael Tomelin
>> Tel.: 51-84104084
>> Skype: rafael.tomelin
>>
>> LPI ID: LPI000191271
>>
>> --
>> 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 post to this group, send email to ansible-project@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/CAGEUqbBU%2BN0Byj2aLUDLRwCPgLcYN8X%2BA9yMTns4F5QL0okezQ%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Karl Auer
>
> Email  : ka...@2pisoftware.com
> Website: http://2pisoftware.com
>
> GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
> Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CA%2B%2BT08S%3DyOXkTpApiE1om%3D8DcpnT%2Bp8673ZyQshSqeoTAd%2B8iQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Atenciosamente,

Rafael Tomelin
Tel.: 51-84104084
Skype: rafael.tomelin

LPI ID: LPI000191271

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAGEUqbCX98-Nw_B18MkgSCu87o5oSmHvKdttg4YqnL8%2BB4K8bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] merging specific group_vars without changing global behavior

2019-01-29 Thread Adam E
In my environment i have a group_vars structure something like the 
following:
[global:children]
datacenter1


[datacenter1:children]
network_zone1
network_zone2


[network_zone1]
server1


[network_zone2]
server2


so using a simple case where I want to add entries to /etc/hosts (although 
there are other use cases, this just seemed the simplest to demonstrate)
I want to be able to set group_vars within each group that get 
merged/appended together for processing by my role.  However 
since the default ansible behavior is not to merge and I don't really want 
to change the default.
therefore I was thinking about doing something like this:

[global:vars]
linux_hosts_entries_global:
  - { ip: 123.124.125.125, names: [backup_server]} 


[datacenter1:vars]
linux_hosts_entries_dc1:
  - { ip: 123.124.125.126, names: [dc1_server]} 


[network_zone1:vars]
linux_hosts_entries_z1:
  - { ip: 123.124.125.125, names: [z1_server]}


Then I could do something like below to loop through the variables to get a 
merged list.   
- name: "debug2"
  debug:
msg: "value is: {{ lookup('vars', item) }} "
  loop: "{{ hostvars[inventory_hostname] | select('match', 
'^linux_hosts_entries') |list  }}"


or in the case of a template, you could do something like this:
{% set linux_hosts_merged_entries =  hostvars[inventory_hostname] | select(
'match', '^linux_hosts_entries') |list %}
{% for groupvar_name in linux_hosts_merged_entries %}
  {% set host_entries = lookup('vars', groupvar_name) %}
  {% for host_entry in host_entries %}
{{ host_entry.ip }} {{ host_entry.names | join(' ') }}
  {% endfor %}
{% endfor %}


I was wondering how others are handling similar use cases?  is there a 
simpler solution?
This strategy seems to work quite well.

I am aware of combine/union filters, however these require that you know 
the names of the variables ahead of time.  I like that in this model I can 
add additional variables later without affecting the existing setup.

I also created a PR to simplify further by adding regex support 
 to the lookup vars plugin.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e04a6e1f-4edc-4e0c-9660-26ff8c8ebd8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Tags in loop

2019-01-29 Thread Karl Auer
Great! Then I just told you how to do it.

vars:
   mytags:
  fred: frederick
  rod: roderick

- module_whatever:
 [...]
 tags: "{{ mytags }}"
 [...]

Or if you have the IDs of the resources you want to tag, use the ec2_tag
module.

Regards, K.


On Wed, Jan 30, 2019 at 10:27 AM Rafael Tomelin 
wrote:

> Hi,
>
> This tag in ansible.  I need set key and value (- key: value), but in
> variable.
>
> On Tue, Jan 29, 2019 at 7:36 PM Karl Auer  wrote:
> >
> > What kind of tag? Do you mean an ansible tag, or a tag for e.g. Amazon
> resources?
> >
> > If you mean Ansible tags, I do not know.
> >
> > If you mean AWS tags, most resource modules provide a "tags" attribute,
> if the resource supports tags. Some resources (generally those with IDs)
> can be tagged using the ec2_tag module.
> >
> > Regards, K.
> >
> >
> > On Tue, Jan 29, 2019 at 11:25 PM Rafael Tomelin <
> rafael.tome...@gmail.com> wrote:
> >>
> >> Hi dear,
> >>
> >> I need create tag in my role, this example:
> >>
> >> vars/main.yml
> >> name_variable:
> >> tags:
> >>key1: value1
> >>key2: value2
> >>
> >> in tasks
> >> taks/main.yml
> >>
> >> - name: name my task
> >>   user: name
> >>   tags:
> >>  tags from vars
> >>
> >>
> >> how can create this tags?
> >>
> >>
> >> --
> >> Atenciosamente,
> >>
> >> Rafael Tomelin
> >> Tel.: 51-84104084
> >> Skype: rafael.tomelin
> >>
> >> LPI ID: LPI000191271
> >>
> >> --
> >> 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 post to this group, send email to ansible-project@googlegroups.com.
> >> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGEUqbBU%2BN0Byj2aLUDLRwCPgLcYN8X%2BA9yMTns4F5QL0okezQ%40mail.gmail.com
> .
> >> For more options, visit https://groups.google.com/d/optout.
> >
> >
> >
> > --
> > Karl Auer
> >
> > Email  : ka...@2pisoftware.com
> > Website: http://2pisoftware.com
> >
> > GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
> > Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA
> >
> > --
> > 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 post to this group, send email to ansible-project@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CA%2B%2BT08S%3DyOXkTpApiE1om%3D8DcpnT%2Bp8673ZyQshSqeoTAd%2B8iQ%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Atenciosamente,
>
> Rafael Tomelin
> Tel.: 51-84104084
> Skype: rafael.tomelin
>
> LPI ID: LPI000191271
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGEUqbCX98-Nw_B18MkgSCu87o5oSmHvKdttg4YqnL8%2BB4K8bw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Karl Auer

Email  : ka...@2pisoftware.com
Website: http://2pisoftware.com

GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2B%2BT08QVVcjwLxDCDTOuZc0_sLc9s9upM-06_zo-RZnZnE3Yxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Calling a variable within a variable within a jinja pipe filter

2019-01-29 Thread John Harmon
I am trying to do two things:

1.  Call a variable while trying to set_fact within a jinja pipe filter
2.  Prevent fails when the user isn't found

- name: "Find the user_id for {{ user }}"
  set_fact:
uid: "{{ 
(userinfo.json.users|selectattr('username','match','MYVAR')|list|first).user_id 
}}"

If this is possible, what is the proper syntax for the variable MYVAR?  
Everything I am trying fails.

In addition, I can't use "failed_when: false" with the above and get it to 
work (ie passing in a non-existent user into MYVAR)--it seems to get 
ignored and ansible exits with a failure.  What would be the proper way to 
prevent this from failing Ansible when the user isn't found?

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/add4c262-3690-4417-8db0-decc34cb666f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Calling a variable within a variable within a jinja pipe filter

2019-01-29 Thread John Harmon
 Still trying to figure out how to keep the set_fact from failing when 
passing in a non-existent user.  If you have ideas for that, please let me 
know.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6a807a37-a5dc-43d2-9045-f99cf1751340%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ERROR! Problem running vault password script /root/.vault_pass ([Errno 8] Exec format error). If this is not a script, remove the executable bit from the file

2019-01-29 Thread Jason Yu
I got the following error when I ran an ansible script from a docker 
container. It looks like the executable bit needs to be reset. I am using 
docker for windows which is running on my windows 10 desktop. Could anyone 
help me with it ?

amazon-ebs: Running local shell script: /tmp/packer-shell828359150
amazon-ebs:  [WARNING]: Error in vault password file loading (default): 
Problem running
amazon-ebs: vault password script /root/.vault_pass ([Errno 8] Exec 
format error). If this
amazon-ebs: is not a script, remove the executable bit from the file.
amazon-ebs: ERROR! Problem running vault password script 
/root/.vault_pass ([Errno 8] Exec format error). If this is not a script, 
remove the executable bit from the file.
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Cleaning up any extra volumes...
==> amazon-ebs: No volumes to clean up, skipping
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/61adcabf-c169-421f-a78c-eb1e5508db95%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Extract the output to excel files

2019-01-29 Thread Diptajeet Khan
Hi Kefi,

Ansible I believe natively doesn't support write back to Excel. You can use
some python scripts to write back facts/results from ansible to excel
though. Actually that's what I am also doing with Cisco Nexus devices.

About Napalm, need to explore if it really can write back to excel.

BR

On Tue, Jan 29, 2019, 9:27 PM sajal tiwari  You can check Napalm ansible module for extracting information mentioned
> by you.
>
> On Tuesday, January 29, 2019 at 7:51:05 PM UTC+5:30, Kefi Ammar wrote:
>>
>> Hello everyone,
>>
>> I am new to Ansible and I am using it for network operations. So, I am
>> extracting informations from network devices (software versions, platforms,
>> hostnames, interfaces, system infos,...) and they are presented in a messy
>> way that makes it hard to read or organise especially for an important
>> number of devices.
>>
>> I am asking if there is modules or something that Ansible can do to
>> extract these informations to an excel file or maybe in a .csv file that
>> can be structured. Anyone has an experience with the management and health
>> check of network devices (Cisco and Juniper) using Ansible could help me
>> out.
>>
>> I am using Ansible 2.7.5
>>
>> Thank you.
>>
>> Best regards,
>> Ammar
>>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/3080187a-984a-4f81-8913-35de98dd7b73%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CADFvbzk8qwtfgpdyFAXLgvhon8dTgndz1NVVj-2gSc95O6vh8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Calling a variable within a variable within a jinja pipe filter

2019-01-29 Thread John Harmon
Figured it out.  I just call the variable with nothing else:

- name: "Find the user_id for {{ user }}"
  set_fact:
uid: "{{ 
(userinfo.json.users|selectattr('username','match',MYVAR)|list|first).user_id 
}}"


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6b7977b6-61f4-48af-ba79-f44fba9238b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ERROR! Problem running vault password script /root/.vault_pass ([Errno 8] Exec format error). If this is not a script, remove the executable bit from the file

2019-01-29 Thread Dick Visser
The error is pretty clear.
Vault files are either executable and expected to output the password upon
execution, or they’re not executable and then ansible will use the file
contents as the password.

You seem to have a vault file that contains the password but that also has
the executable bit set for some reason.
You need to remove that so it’s not treated as an executable any more.

Dick

On Wed, 30 Jan 2019 at 00:35, Jason Yu  wrote:

> I got the following error when I ran an ansible script from a docker
> container. It looks like the executable bit needs to be reset. I am using
> docker for windows which is running on my windows 10 desktop. Could anyone
> help me with it ?
>
> amazon-ebs: Running local shell script: /tmp/packer-shell828359150
> amazon-ebs:  [WARNING]: Error in vault password file loading
> (default): Problem running
> amazon-ebs: vault password script /root/.vault_pass ([Errno 8] Exec
> format error). If this
> amazon-ebs: is not a script, remove the executable bit from the file.
> amazon-ebs: ERROR! Problem running vault password script
> /root/.vault_pass ([Errno 8] Exec format error). If this is not a script,
> remove the executable bit from the file.
> ==> amazon-ebs: Terminating the source AWS instance...
> ==> amazon-ebs: Cleaning up any extra volumes...
> ==> amazon-ebs: No volumes to clean up, skipping
> ==> amazon-ebs: Deleting temporary security group...
> ==> amazon-ebs: Deleting temporary keypair...
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/61adcabf-c169-421f-a78c-eb1e5508db95%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

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


Re: [ansible-project] Ansible - save config - Small business SG 500

2019-01-29 Thread Jean berjonneau
Hello, 

thanks for your answer, actually when i do this with "show clock" it works 
fine. 
Taking your advice i tried, this is my ne
 - name: IOS | Datadump + Show run
ios_config:
  authorize: yes
  provider: "{{ provider }}"
  commands:
- terminal datadump
register: showrun

And it answered back with more errors than before

The full traceback is:
Traceback (most recent call last):
  File 
"/root/.ansible/tmp/ansible-tmp-1548834885.34-267057542623206/AnsiballZ_ios_config.py"
, line 113, in 
_ansiballz_main()
  File 
"/root/.ansible/tmp/ansible-tmp-1548834885.34-267057542623206/AnsiballZ_ios_config.py"
, line 105, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File 
"/root/.ansible/tmp/ansible-tmp-1548834885.34-267057542623206/AnsiballZ_ios_config.py"
, line 48, in invoke_module
imp.load_module('__main__', mod, module, MOD_DESC)
  File "/tmp/ansible_ios_config_payload_5TvH1X/__main__.py", line 541, in 

  File "/tmp/ansible_ios_config_payload_5TvH1X/__main__.py", line 472, in 
main
  File "/tmp/ansible_ios_config_payload_5TvH1X/__main__.py", line 333, in 
edit_config_or_macro
  File 
"/tmp/ansible_ios_config_payload_5TvH1X/ansible_ios_config_payload.zip/ansible/module_utils/connection.py"
, line 173, in __rpc__
ansible.module_utils.connection.ConnectionError: operation requires 
privilege escalation


fatal: [BX-COM-SW6]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n  File 
\"/root/.ansible/tmp/ansible-tmp-1548834885.34-267057542623206/AnsiballZ_ios_config.py\",
 
line 113, in \n_ansiballz_main()\n  File 
\"/root/.ansible/tmp/ansible-tmp-1548834885.34-267057542623206/AnsiballZ_ios_config.py\",
 
line 105, in _ansiballz_main\ninvoke_module(zipped_mod, temp_path, 
ANSIBALLZ_PARAMS)\n  File 
\"/root/.ansible/tmp/ansible-tmp-1548834885.34-267057542623206/AnsiballZ_ios_config.py\",
 
line 48, in invoke_module\nimp.load_module('__main__', mod, module, 
MOD_DESC)\n  File \"/tmp/ansible_ios_config_payload_5TvH1X/__main__.py\", 
line 541, in \n  File 
\"/tmp/ansible_ios_config_payload_5TvH1X/__main__.py\", line 472, in main\n 
 File \"/tmp/ansible_ios_config_payload_5TvH1X/__main__.py\", line 333, in 
edit_config_or_macro\n  File 
\"/tmp/ansible_ios_config_payload_5TvH1X/ansible_ios_config_payload.zip/ansible/module_utils/connection.py\",
 
line 173, in __rpc__\nansible.module_utils.connection.ConnectionError: 
operation requires privilege escalation\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ba3903bb-1080-4273-b177-b90fa6de8fc9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Parsing json output from uri module

2019-01-29 Thread cortado
Thanks for the reply Matt but debugging with that option lends:

TASK [output] 
*

fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an 
undefined variable. The error was: 'dict object' has no attribute 
'APIImplementationInfo'\n\nThe error appears to have been in 
'/Users/tony/foo2.yml': line 40, column 5, but may\nbe elsewhere in the 
file depending on the exact syntax problem.\n\nThe offending line appears 
to be:\n\n\n  - name: output\n^ here\n"}

On Tuesday, January 29, 2019 at 8:52:22 AM UTC-6, Matt Martz wrote:
>
> Probably something such as:
>
> - debug:
> msg: "{{ 
> apis.json.APIImplementationInfo|selectattr('AnonymousAccessAllowed')|list 
> }}"
>
> On Tue, Jan 29, 2019 at 7:50 AM cortado > 
> wrote:
>
>> If anyone has a suggestion I'd appreciate it.  This is driving me bonkers 
>> and i'm sure I am missing some basic understanding.
>>
>> Thanks
>>
>> On Saturday, January 26, 2019 at 10:04:13 AM UTC-6, cortado wrote:
>>>
>>>
>>>
>>> I'm trying to parse the output of a uri request that I have saved in a 
>>> variable named "apis".  Ultimately i will want to match several items when 
>>> AnonymousAccessAllowed=true but I'm not having success.  Any help would be 
>>> appreciated.
>>>
>>> If i debug "{{apis.json}}" this is the output.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> TASK [debut apis] 
>>> **
>>>
>>> ok: [localhost] => {
>>>
>>> "msg": {
>>>
>>> "APIImplementationInfo": [
>>>
>>> {
>>>
>>> "APIOwnedImplementation": true,
>>>
>>> "APIVersionID": 
>>> "799285b2-ac87-44be-8f61-342b96ffba2c.travelportAPI",
>>>
>>> "AnonymousAccessAllowed": false,
>>>
>>> "EndpointAccessAutoApproved": true,
>>>
>>> "ImplementationCode": "Live",
>>>
>>> "Pattern": "com.akana.pattern.proxy",
>>>
>>> "ServiceKey": 
>>> "uddi:5988b66a-ff7f-11e6-8674-d0288b15863d"
>>>
>>> },
>>>
>>> {
>>>
>>> "APIOwnedImplementation": true,
>>>
>>> "APIVersionID": 
>>> "799285b2-ac87-44be-8f61-342b96ffba2c.travelportAPI",
>>>
>>> "AnonymousAccessAllowed": true,
>>>
>>> "EndpointAccessAutoApproved": true,
>>>
>>> "ImplementationCode": "Sandbox",
>>>
>>> "Pattern": "com.akana.pattern.proxy",
>>>
>>> "ServiceKey": 
>>> "uddi:3ebe224d-506b-11e7-ba06-98021d1b1c3f"
>>>
>>> }
>>>
>>> ]
>>>
>>> }
>>>
>>> }
>>>
>>> This is the relevant parts of the playbook.  I've commented out the when 
>>> condition but get an undefined variable in the test task.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>   - name: debut apis
>>>
>>> debug:
>>>
>>>   msg: "{{apis.json}}"
>>>
>>>
>>>
>>>   - name: init fact
>>>
>>> set_fact:
>>>
>>>   anon: "[]"
>>>
>>>
>>>
>>>   - name: test
>>>
>>> set_fact:
>>>
>>>   anon: “{{anon}} + [ {{item.AnonymousAccessAllowed}} ]"
>>>
>>> #when: item.AnonymousAccessAllowed | search(“true”)
>>>
>>> with_items: “{{apis.json.APIImplementationInfo}}”
>>>
>>>
>>>
>>>   - name: output
>>>
>>> debug:
>>>
>>>   msg: “{{anon}}”
>>>
>>>
>>>
>>>
>>> -- 
>> 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 post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/49e324c4-099f-4656-bce9-12f33abe349d%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4317a482-56f6-465a-a2d5-92c3a5e2eab9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible GCE Instance Start and Stop - LibcloudError - job did not complete in 180 seconds

2019-01-29 Thread bo.mannarino
We have (GCP)  GCE instance start and instance stop playbooks.Tonight's 
execution was the stop of 8  GCE instances at once.  The main script is 
kicked off and the playbooks run in background. 

We are seeing this error -   
An exception occurred during task execution. To see the full traceback, use 
-vvv. The error was: libcloud.common.types.LibcloudError: 

We assume this may be related to needing some tuning, but, we are not 
exactly sure where or what.  Can anyone help here ?

THanks  BAM

_

This message is for the designated recipient only and may contain privileged, 
proprietary
or otherwise private information. If you have received it in error, please 
notify the sender
immediately and delete the original. Any other use of the email by you is 
prohibited.

Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk 
- Portuguese - Chinese
Svenska: 
http://www.cardinalhealth.com/en/support/terms-and-conditions-english.html

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7f8b8846-036a-4d91-9881-c37c6f0484c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Extract the output to excel files

2019-01-29 Thread bikram40
Hi Kefi,

You can do something like this. echo your result and redirect the result to
a csv. Later open with excel.

- name: Output Information to CSV file

  shell: echo {{inventory_hostname}}, {{ difference_7010.stdout }}>>
 mismatched_qos.csv

  delegate_to: localhost


Thanks.

Bikram

On Tue, Jan 29, 2019 at 6:21 AM Kefi Ammar  wrote:

> Hello everyone,
>
> I am new to Ansible and I am using it for network operations. So, I am
> extracting informations from network devices (software versions, platforms,
> hostnames, interfaces, system infos,...) and they are presented in a messy
> way that makes it hard to read or organise especially for an important
> number of devices.
>
> I am asking if there is modules or something that Ansible can do to
> extract these informations to an excel file or maybe in a .csv file that
> can be structured. Anyone has an experience with the management and health
> check of network devices (Cisco and Juniper) using Ansible could help me
> out.
>
> I am using Ansible 2.7.5
>
> Thank you.
>
> Best regards,
> Ammar
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/2bffd8b6-febc-4d5a-80c6-5c7975db7274%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEFfMJR16ywEiWAbtjEhEEkXZ7qtuKJ-apEwNJYNOZH8ODsyDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] simple kubernetes application deployment using Ansible AWX ? Any body tried that ?

2019-01-29 Thread Kylix3511
Did any one you knows how to deploy small or simple “hello world” 
application in Kubernetes using Ansible AWX ? I’m trying to do it … i dont 
know where to start or how to beings with it. If you have any thoughts or 
help. Please advise. 

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d3ec8e79-fcbf-400d-97f6-50bf42fd8ca4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Running yum updates with ansible

2019-01-29 Thread 'Chris Bidwell' via Ansible Project
Using the latest of 2.7.

On January 28, 2019 4:06:55 PM MST, Jonathan Lozada De La Matta 
 wrote:
>what version of ansible are you using?
>
>On Mon, Jan 28, 2019 at 6:02 PM 'Chris Bidwell - NOAA Federal' via
>Ansible
>Project  wrote:
>
>> Hey all,
>>
>> So I've done a lot of yum updates with ansible and several times I
>get
>> issues where partial updates are run and it says it's been completed,
>> however, I reboot and I'm in a kernel panic because the new kernel
>didn't
>> update properly so I have to revert to the previous kernel and remove
>the
>> newest and reinstall it again.  I also often wind up with
>transactions that
>> haven't been completed.Has anyone experienced this before?
>>
>> Thanks!
>> Chris
>>
>> --
>> 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 post to this group, send email to
>ansible-project@googlegroups.com.
>> To view this discussion on the web visit
>>
>https://groups.google.com/d/msgid/ansible-project/CAHKi8CgQ87cs0toXZ4pqefZjoA_Yv0mc89DcMLYih7j6nVHgew%40mail.gmail.com
>>
>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>-- 
>
>Jonathan lozada de la matta
>
>AUTOMATION PRACTICE
>
>-- 
>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 post to this group, send email to ansible-project@googlegroups.com.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/ansible-project/CAFYJA%2B%2B2Zrfn5pS4fudigASZGm35VaMUxAzZAgQUBDvFBxxLxw%40mail.gmail.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/F667BD03-46CC-4DD0-A752-0B11FC688390%40noaa.gov.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Access specific elements using with_items / with_subelememts

2019-01-29 Thread Saranya N
Hi Kai ,

M getting below error and I wonder why :(

Can't parse arg end=u'3\xa0stride=2' as integer .


Also please help me understand this, 

My first app is parent of second and 
Second app is parent of Remaining apps i.e from 3rd app onwards .

So I think I'll need the above task twice with different sequence number to 
achieve the two conditions ?


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e6222f49-681f-40a9-9448-a920433bf158%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Extract the output to excel files

2019-01-29 Thread Kefi Ammar
Hello everyone,

I am new to Ansible and I am using it for network operations. So, I am 
extracting informations from network devices (software versions, platforms, 
hostnames, interfaces, system infos,...) and they are presented in a messy 
way that makes it hard to read or organise especially for an important 
number of devices.

I am asking if there is modules or something that Ansible can do to extract 
these informations to an excel file or maybe in a .csv file that can be 
structured. Anyone has an experience with the management and health check 
of network devices (Cisco and Juniper) using Ansible could help me out.

I am using Ansible 2.7.5

Thank you.

Best regards,
Ammar

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2bffd8b6-febc-4d5a-80c6-5c7975db7274%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Custom library placed within a role not found for multiple-play playbook

2019-01-29 Thread Yassen Damyanov
Hi all,

We have a multi-play playbook like this:


---
- name: Play One
  hosts: all
  roles:
- role.one
  tags: [tagone]

- name: Play Two
  hosts: group1
  roles:
- role.two
- role.three
  tags: [tagtwo]

- name: Play Three
  hosts: group2
  roles:
- role.four
- role.five
  tags: [tagthree]


 
The behavior that puzzles us is: *role.five* has a custom module stored in 
a *./library/* folder within the role itself (as the module is specific to 
that role and used only by it). When the playbook contains several plays, 
the custom module is NOT found, which we find unexpected.

If the playbook contains only the last play, like:


---
- name: Play Three
  hosts: group2
  roles:
- role.four
- role.five



then everything works as expected, the custom module is found and working.

We are further puzzled by the result of  another try: if we move the 
*./library/* folder with the custom module into *role.four*, then the full 
play works fine (that is, while executing *role.five*, *ansible* finds the 
module).

Is this intended behavior?

We would appreciate any comments,
Thanks!
-YD

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b9c1f086-0b2b-4a23-9555-fc07aa1d00f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Parsing json output from uri module

2019-01-29 Thread cortado
If anyone has a suggestion I'd appreciate it.  This is driving me bonkers 
and i'm sure I am missing some basic understanding.

Thanks

On Saturday, January 26, 2019 at 10:04:13 AM UTC-6, cortado wrote:
>
>
>
> I'm trying to parse the output of a uri request that I have saved in a 
> variable named "apis".  Ultimately i will want to match several items when 
> AnonymousAccessAllowed=true but I'm not having success.  Any help would be 
> appreciated.
>
> If i debug "{{apis.json}}" this is the output.
>
>
>
>
>
>
>
>
>
> TASK [debut apis] 
> **
>
> ok: [localhost] => {
>
> "msg": {
>
> "APIImplementationInfo": [
>
> {
>
> "APIOwnedImplementation": true,
>
> "APIVersionID": 
> "799285b2-ac87-44be-8f61-342b96ffba2c.travelportAPI",
>
> "AnonymousAccessAllowed": false,
>
> "EndpointAccessAutoApproved": true,
>
> "ImplementationCode": "Live",
>
> "Pattern": "com.akana.pattern.proxy",
>
> "ServiceKey": "uddi:5988b66a-ff7f-11e6-8674-d0288b15863d"
>
> },
>
> {
>
> "APIOwnedImplementation": true,
>
> "APIVersionID": 
> "799285b2-ac87-44be-8f61-342b96ffba2c.travelportAPI",
>
> "AnonymousAccessAllowed": true,
>
> "EndpointAccessAutoApproved": true,
>
> "ImplementationCode": "Sandbox",
>
> "Pattern": "com.akana.pattern.proxy",
>
> "ServiceKey": "uddi:3ebe224d-506b-11e7-ba06-98021d1b1c3f"
>
> }
>
> ]
>
> }
>
> }
>
> This is the relevant parts of the playbook.  I've commented out the when 
> condition but get an undefined variable in the test task.
>
>
>
>
>
>
>
>
>
>   - name: debut apis
>
> debug:
>
>   msg: "{{apis.json}}"
>
>
>
>   - name: init fact
>
> set_fact:
>
>   anon: "[]"
>
>
>
>   - name: test
>
> set_fact:
>
>   anon: “{{anon}} + [ {{item.AnonymousAccessAllowed}} ]"
>
> #when: item.AnonymousAccessAllowed | search(“true”)
>
> with_items: “{{apis.json.APIImplementationInfo}}”
>
>
>
>   - name: output
>
> debug:
>
>   msg: “{{anon}}”
>
>
>
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/49e324c4-099f-4656-bce9-12f33abe349d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Block & rescue misconception

2019-01-29 Thread Sergio Fernandez
Hi all,

For the record, as I think this is not specifically documented in the
official documentation:

When using block inside a role, the correct syntax is:
---

- block:
  - name: Do stuff
[...]
tags:
  - tag
  - othertag
  - name: Do more stuff
[...]
tags:
  - tag
  - othertag
[...]
  rescue:
- name: Do some recevery stuff
  [...]
  tags:
- tag
- rescue
- name: Do more recovery stuff
  [...]
  tags:
- tag
- rescue

I've managed to do my stuff.

*Sergio Fernández*
SysAdmin and DevOps Engineer

*exoinvesting.com *

Email: *sergio.fernan...@exoinvesting.com
*
Phone:
*+34 679 51 25 22*
Follow me on *LinkedIn
*

Exo Investing Limited, trading under the name Exo Investing, is authorised
& regulated by the Financial Conduct Authority (FRN: 748161). Exo
Investing Limited
(formerly Finhub Technologies Limited)  is registered in England & Wales
with company number 10094765 and its registered office address at Spaces,
Citypoint, 1 Ropemaker St, London, EC2Y 9HT.

Confidentiality Notice: This e-mail message, including any attachments,
sent on behalf of Exo Investing Limited is for the sole use of the intended
recipient(s) and may contain confidential and privileged information. Any
unauthorized review, use, copying, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact the
sender by reply e-mail and destroy all copies of the original message.
Thank you.


On Tue, 29 Jan 2019 at 12:51, Sergio Fernandez <
sergio.fernan...@exoinvesting.com> wrote:

> HI,
>
> Si as far as I understand, and my tests points to int, a block & rescue is
> needed for every task in a role? Is not applicable to various tasks?
>
> Regards.
> *Sergio Fernández*
> SysAdmin and DevOps Engineer
>
> *exoinvesting.com *
>
> Email: *sergio.fernan...@exoinvesting.com
> *
> Phone:
> *+34 679 51 25 22*
> Follow me on *LinkedIn
> *
>
> Exo Investing Limited, trading under the name Exo Investing, is authorised
> & regulated by the Financial Conduct Authority (FRN: 748161). Exo Investing
> Limited (formerly Finhub Technologies Limited)  is registered in England
> & Wales with company number 10094765 and its registered office address at
> Spaces, Citypoint, 1 Ropemaker St, London, EC2Y 9HT.
>
> Confidentiality Notice: This e-mail message, including any attachments,
> sent on behalf of Exo Investing Limited is for the sole use of the
> intended recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, copying, disclosure or
> distribution is prohibited. If you are not the intended recipient, please
> contact the sender by reply e-mail and destroy all copies of the original
> message. Thank you.
>
>
> On Mon, 28 Jan 2019 at 18:19, Kai Stian Olstad <
> ansible-project+l...@olstad.com> wrote:
>
>> On 28.01.2019 17:52, sergio.fernan...@exoinvesting.com wrote:
>> > instance). But I don't know why the rescue tasks never runs.
>> >
>> > And the role deploy-api/tasks/main.yml looks like this:
>> >
>> > ---
>> > - block:
>> >   - name: Create .ssh path for user
>> > become: yes
>> > file:
>> >path: "{{ deploy_path }}/.ssh"
>> >owner: example
>> >group: example
>> >state: directory
>> >mode: 0700
>> > tags:
>> >   - backend
>> >   - ssh
>> >
>> >   - name: Upload RSA public key
>> > become: yes
>> > template:
>> >   src: 'templates/example-id_rsa.pub'
>> >   dest: "{{ deploy_path }}/.ssh/authorized_keys"
>> >   owner: example
>> >   group: example
>> >   mode: 0640
>> > tags:
>> >   - backend
>> >   - ssh
>> > [ ...More stuff... ]
>> >
>> > - rescue:
>>
>> Your syntax is wrong, rescue should not have a dash, check the
>> documentation for correct syntax
>> https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html
>>
>> --
>> Kai Stian Olstad
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/ansible-project/2s3HSs_Ke_4/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> ansible-project+unsubscr...@googlegroups.com.
>> To post to this group, send email to ansible-project@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/1e5e34a35809bb5b7cd8824e01f54b80%40olstad.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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

Re: [ansible-project] Re: Parsing json output from uri module

2019-01-29 Thread Matt Martz
Probably something such as:

- debug:
msg: "{{ 
apis.json.APIImplementationInfo|selectattr('AnonymousAccessAllowed')|list
}}"

On Tue, Jan 29, 2019 at 7:50 AM cortado  wrote:

> If anyone has a suggestion I'd appreciate it.  This is driving me bonkers
> and i'm sure I am missing some basic understanding.
>
> Thanks
>
> On Saturday, January 26, 2019 at 10:04:13 AM UTC-6, cortado wrote:
>>
>>
>>
>> I'm trying to parse the output of a uri request that I have saved in a
>> variable named "apis".  Ultimately i will want to match several items when
>> AnonymousAccessAllowed=true but I'm not having success.  Any help would be
>> appreciated.
>>
>> If i debug "{{apis.json}}" this is the output.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> TASK [debut apis]
>> **
>>
>> ok: [localhost] => {
>>
>> "msg": {
>>
>> "APIImplementationInfo": [
>>
>> {
>>
>> "APIOwnedImplementation": true,
>>
>> "APIVersionID":
>> "799285b2-ac87-44be-8f61-342b96ffba2c.travelportAPI",
>>
>> "AnonymousAccessAllowed": false,
>>
>> "EndpointAccessAutoApproved": true,
>>
>> "ImplementationCode": "Live",
>>
>> "Pattern": "com.akana.pattern.proxy",
>>
>> "ServiceKey": "uddi:5988b66a-ff7f-11e6-8674-d0288b15863d"
>>
>> },
>>
>> {
>>
>> "APIOwnedImplementation": true,
>>
>> "APIVersionID":
>> "799285b2-ac87-44be-8f61-342b96ffba2c.travelportAPI",
>>
>> "AnonymousAccessAllowed": true,
>>
>> "EndpointAccessAutoApproved": true,
>>
>> "ImplementationCode": "Sandbox",
>>
>> "Pattern": "com.akana.pattern.proxy",
>>
>> "ServiceKey": "uddi:3ebe224d-506b-11e7-ba06-98021d1b1c3f"
>>
>> }
>>
>> ]
>>
>> }
>>
>> }
>>
>> This is the relevant parts of the playbook.  I've commented out the when
>> condition but get an undefined variable in the test task.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>   - name: debut apis
>>
>> debug:
>>
>>   msg: "{{apis.json}}"
>>
>>
>>
>>   - name: init fact
>>
>> set_fact:
>>
>>   anon: "[]"
>>
>>
>>
>>   - name: test
>>
>> set_fact:
>>
>>   anon: “{{anon}} + [ {{item.AnonymousAccessAllowed}} ]"
>>
>> #when: item.AnonymousAccessAllowed | search(“true”)
>>
>> with_items: “{{apis.json.APIImplementationInfo}}”
>>
>>
>>
>>   - name: output
>>
>> debug:
>>
>>   msg: “{{anon}}”
>>
>>
>>
>>
>> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/49e324c4-099f-4656-bce9-12f33abe349d%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v858LrqHhKt%2BDf-FiPOHr0NcG_g%3DrbM-CPu5W5X24wA7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Block & rescue misconception

2019-01-29 Thread Sergio Fernandez
HI,

Si as far as I understand, and my tests points to int, a block & rescue is
needed for every task in a role? Is not applicable to various tasks?

Regards.
*Sergio Fernández*
SysAdmin and DevOps Engineer

*exoinvesting.com *

Email: *sergio.fernan...@exoinvesting.com
*
Phone:
*+34 679 51 25 22*
Follow me on *LinkedIn
*

Exo Investing Limited, trading under the name Exo Investing, is authorised
& regulated by the Financial Conduct Authority (FRN: 748161). Exo
Investing Limited
(formerly Finhub Technologies Limited)  is registered in England & Wales
with company number 10094765 and its registered office address at Spaces,
Citypoint, 1 Ropemaker St, London, EC2Y 9HT.

Confidentiality Notice: This e-mail message, including any attachments,
sent on behalf of Exo Investing Limited is for the sole use of the intended
recipient(s) and may contain confidential and privileged information. Any
unauthorized review, use, copying, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact the
sender by reply e-mail and destroy all copies of the original message.
Thank you.


On Mon, 28 Jan 2019 at 18:19, Kai Stian Olstad <
ansible-project+l...@olstad.com> wrote:

> On 28.01.2019 17:52, sergio.fernan...@exoinvesting.com wrote:
> > instance). But I don't know why the rescue tasks never runs.
> >
> > And the role deploy-api/tasks/main.yml looks like this:
> >
> > ---
> > - block:
> >   - name: Create .ssh path for user
> > become: yes
> > file:
> >path: "{{ deploy_path }}/.ssh"
> >owner: example
> >group: example
> >state: directory
> >mode: 0700
> > tags:
> >   - backend
> >   - ssh
> >
> >   - name: Upload RSA public key
> > become: yes
> > template:
> >   src: 'templates/example-id_rsa.pub'
> >   dest: "{{ deploy_path }}/.ssh/authorized_keys"
> >   owner: example
> >   group: example
> >   mode: 0640
> > tags:
> >   - backend
> >   - ssh
> > [ ...More stuff... ]
> >
> > - rescue:
>
> Your syntax is wrong, rescue should not have a dash, check the
> documentation for correct syntax
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html
>
> --
> Kai Stian Olstad
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/2s3HSs_Ke_4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/1e5e34a35809bb5b7cd8824e01f54b80%40olstad.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAOZL0C8%2B9yrk1F07iReNX-B-3bOORYmPELzjzf%2B3L7-VmpRkRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Porting playbooks from Ansible 2.4 to newer version

2019-01-29 Thread Lienj
Thanks all, you were right this was not a big amount of work.

Le lundi 31 décembre 2018 16:52:32 UTC+1, Lienj a écrit :
>
> Hi there,
> we have a bunch of playbooks and roles, all written in Ansible version >= 
> 2.4
> I need to audit all our playbooks in order to migrate to a more recent 
> version.
> There are a lot of changes from 2.4 to 2.5 mainly:
>
>- Loops (with_item vs loop)
>- Attributes inheritances
>
> I don't know how to handle that, do you have any methods for first 
> auditing what need to be changed and then ensure the changes are valid 
> (from a syntax point of view) ?
> Thanks.
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bf870a45-0cbc-4d81-8ee0-b582d050264d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Tags in loop

2019-01-29 Thread Rafael Tomelin
Hi dear,

I need create tag in my role, this example:

vars/main.yml
name_variable:
tags:
   key1: value1
   key2: value2

in tasks
taks/main.yml

- name: name my task
  user: name
  tags:
 tags from vars


how can create this tags?


-- 
Atenciosamente,

Rafael Tomelin
Tel.: 51-84104084
Skype: rafael.tomelin

LPI ID: LPI000191271

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAGEUqbBU%2BN0Byj2aLUDLRwCPgLcYN8X%2BA9yMTns4F5QL0okezQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Access specific elements using with_items / with_subelememts

2019-01-29 Thread Saranya N
I Hi Kai ,


I think this will make my 3rd app parent of 4th n so on..

I don't want that.

First is parent of second.
Second is parent of remaining all apps.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f38b37a8-2b29-407e-aae4-1ab0ad099f90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.