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

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

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

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

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

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

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

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

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

[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

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

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

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,

[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

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

[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

[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

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,

[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

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

[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: "{{

[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

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

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.

[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

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

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:

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

[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

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,

[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

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

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

[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

[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

[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

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

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

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:

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

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

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