[ansible-project] Ansible template - Extract value from Dict

2018-08-16 Thread j1f0x
Hello I was not able to figure out how to access the 'vlan_name' wthin the jinja2 template. I've already tried a numerous filters, map, selectattr, ... but none of them seems to work. I could extract the key value items with a for loop but there must be another way to just select the vlan_n

Re: [ansible-project] Run a task based on variable defined or not

2018-08-16 Thread Sosys
Hi, have you tried to use "undefined" in the when statement ? === when: yourvarname is undefined On Fri, Aug 17, 2018 at 5:17 AM, Neetu wrote: > Hi Guys > > > Can some one here help me on how to run a task if a variable is undefined. > > > I want to check if a variable exists or not and regi

[ansible-project] Run a task based on variable defined or not

2018-08-16 Thread Neetu
Hi Guys Can some one here help me on how to run a task if a variable is undefined. I want to check if a variable exists or not and register that . If Variable exists I want to run a task. Has any one successfully done this ? -- You received this message because you are subscribed to the Go

Re: [ansible-project] git version not cloning branch

2018-08-16 Thread Jonathan Lozada De La Matta
you need to add version: centos On Thu, Aug 16, 2018 at 11:57 PM wrote: > hi, > I'm using the git module, specifying 'centos' as the version. 'centos' is > the name of a branch in my gitlab repo. > No errors, and the clone part works but always 'master' is what's left in > the destination. I sup

Re: [ansible-project] webserver secure

2018-08-16 Thread coach rhca
thanks Jonathan for reciprocating, i use the openssl on the OS to generate the pem file and then the crt file but i am checking on how to achieve this on ansible. just like a private self signed certificate for internal use for the webserver that will be provisioned. On Thu, Aug 16, 2018 at 10:49

[ansible-project] Transfer execute and delete script python via playbook

2018-08-16 Thread Drew Mullen
You can do this using the ansible script module https://docs.ansible.com/ansible/2.5/modules/script_module.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

Re: [ansible-project] nxos_facts - fails on a lot of versions.

2018-08-16 Thread Trishna Guha
Hi, You are getting this error on 5.2(1)N1(1) Nexus as JSON structured output is not supported on the device. Non structured output support for this module is added in 2.6. Please upgrade to Ansible 2.6.2. Thanks, On Tue, Aug 14, 2018 at 4:25 AM Jonathan Lozada De La Matta < jloza...@redhat.com>

[ansible-project] Transfer execute and delete script python via playbook

2018-08-16 Thread Drew Mullen
You can do this using the ansible script module https://docs.ansible.com/ansible/2.5/modules/script_module.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

[ansible-project] git version not cloning branch

2018-08-16 Thread jtim . arnold
hi, I'm using the git module, specifying 'centos' as the version. 'centos' is the name of a branch in my gitlab repo. No errors, and the clone part works but always 'master' is what's left in the destination. I suppose the code actually does a clone and then a checkout of the branch. So it looks

Re: [ansible-project] Please explain ec2_instance volumes config

2018-08-16 Thread Karl Auer
So: "System A" is the one you call "Master", and has public IP 18.191.161.9. It has the private IP address 172.31.20.219. "System B" is the one you call "Client", and has the private IP address 172.31.24.31. I know this because before you changed the prompt to "Client@", the prompt was "root@ip-1

[ansible-project] Ansible 2.6.3 is available

2018-08-16 Thread Matt Clay
Hi all -- we're happy to announce that the general release of Ansible 2.6.3 is now available! How do you get it? -- $ pip install ansible==2.6.3 --user The tar.gz of the release can be found here: https://releases.ansible.com

[ansible-project] Usage of the zone plugin

2018-08-16 Thread Tim Shaw
Hi, I'm attempting to use the zone plugin to connect to Solaris 11 zones to re-configure the primary network. Here's my test inventory file; [playpen] localhost e7812svsun003 [my-zones] e7812svsun031 ansible_zone_host=e7812svsun003 and here's my test playbook; --- - hosts: my-zones gather_

[ansible-project] Ansible 2.5.8 is available

2018-08-16 Thread mattdavi
Hi all- we're happy to announce that the general release of Ansible 2.5.8 is now available! How do you get it? -- $ pip install ansible==2.5.8 --user The tar.gz of the release can be found here: https://releases.ansible.com/

Re: [ansible-project] No longer able to apply commands to AWS instances after upgrade to 2.5

2018-08-16 Thread Jonathan Lozada De La Matta
your issue was in " but it boils down to the fact that the 'upgrade' was unintentional and cost us three weeks of head scratching.". Ansible docs, changelogs and release announcements talk about all the changes that happened. If its something that happened in your environment then its not really a

Re: [ansible-project] Re: ansible-pull configuration

2018-08-16 Thread Pshem Kowalczyk
There are two things here: 1. If you're using SSH the public key of the remote server must be added to 'known_hosts', for example like this: ssh-keyscan -t rsa github.com | sed "s/^[^ ]* //" >> ~/.ssh/known_hosts (alternatively you can get ansible to just accept whatever key is offered with --ac

Re: [ansible-project] No longer able to apply commands to AWS instances after upgrade to 2.5

2018-08-16 Thread Karl Auer
In three weeks of head-scratching you didn't realise the version of A nsible had changed, meaning you allow uncontrolled upgrades to your production systems? Or in three weeks of head-scratching, knowing that Ansible had upgraded, it didn't occur to you to read the release notes? It's a bit rough

Re: [ansible-project] No longer able to apply commands to AWS instances after upgrade to 2.5

2018-08-16 Thread Ilsa Loving
I'll skip the story since it's long, convoluted, and frustrating, but it boils down to the fact that the 'upgrade' was unintentional and cost us three weeks of head scratching. Thanks for the info. Now that I know how capricious Ansible is, we will need to reconsider how it is used, and how he

Re: [ansible-project] No longer able to apply commands to AWS instances after upgrade to 2.5

2018-08-16 Thread Kai Stian Olstad
On Thursday, 16 August 2018 22.36.17 CEST Ilsa Loving wrote: > This should theoretically add the instance to inventory so that when we > perform the following task later: > # Perform server default tasks > - include_tasks: set_server_defaults.yml > delegate_to: "ec2_instance_host" > become: true >

[ansible-project] No longer able to apply commands to AWS instances after upgrade to 2.5

2018-08-16 Thread Ilsa Loving
Hi all, I have a bunch of scripts I inherited that do a variety of things, primarily for setting up new environments in AWS. Using v2.4, everything worked just fine. As of v2.5, modules are applied to the currently running host instead of the target instance. Needless to say this caused a re

[ansible-project] Re: Restart server playbook fails on one set of targets, but not on another.

2018-08-16 Thread yaakov.kuperman via Ansible Project
one more thing - I'm doing something similar and I've found it necessary to use wait_for: to determine that port 22 actually went down before I wait for it to come up again. I've also used wait_for_conection: to wait for it to come all the way back before I proceed. On Thursday, August 16, 201

Re: [ansible-project] Re: Looking for advice: json returned from API with and without brackets

2018-08-16 Thread Kai Stian Olstad
On Thursday, 16 August 2018 21.12.49 CEST J-F Gaudreault wrote: > The json... returning a list of 2+ objects. > When the API returns only one object, the brackets are gone. But when it return multiple entries, which one of them will you have? If it's the fist element in the list this should work

Re: [ansible-project] Restart server playbook fails on one set of targets, but not on another.

2018-08-16 Thread Kai Stian Olstad
On Thursday, 16 August 2018 21.14.56 CEST Patrick Hunt wrote: > I have the following playbook snippet > > --- > > > - hosts: collector > become: true > become_method: su > become_user: root > > > tasks: > > > - name: restart server, if kernel updated > command: reboot > asy

[ansible-project] Re: Restart server playbook fails on one set of targets, but not on another.

2018-08-16 Thread yaakov.kuperman via Ansible Project
Check out https://stackoverflow.com/questions/29955605/how-to-reboot-centos-7-with-ansible On Thursday, August 16, 2018 at 3:14:56 PM UTC-4, Patrick Hunt wrote: > > I have the following playbook snippet > > --- > > > - hosts: collector > become: true > become_method: su > become_user: root

[ansible-project] Restart server playbook fails on one set of targets, but not on another.

2018-08-16 Thread Patrick Hunt
I have the following playbook snippet --- - hosts: collector become: true become_method: su become_user: root tasks: - name: restart server, if kernel updated command: reboot async: 1 poll: 0 ignore_errors: true notify: - wait for server to restart han

[ansible-project] Re: Looking for advice: json returned from API with and without brackets

2018-08-16 Thread J-F Gaudreault
The json... returning a list of 2+ objects. When the API returns only one object, the brackets are gone. { "nagios_xi_hosts.json.host": [ { "@attributes": { "id": "26128" }, "action_url": {}, "active_checks_enabled": "1"

Re: [ansible-project] Looking for advice: json returned from API with and without brackets

2018-08-16 Thread Jonathan Lozada De La Matta
a copy of the json would be helpful. On Thu, Aug 16, 2018 at 2:57 PM J-F Gaudreault wrote: > Hi! I getting a json from an API request. I've registered the json in a > var. > > I'm trying to find a way to get the hostname in the json. > I need to find it even if it has brackets or not. > > I only

[ansible-project] Looking for advice: json returned from API with and without brackets

2018-08-16 Thread J-F Gaudreault
Hi! I getting a json from an API request. I've registered the json in a var. I'm trying to find a way to get the hostname in the json. I need to find it even if it has brackets or not. I only got this far with brackets: - name: test1 debug: msg: "{{ nagios_xi_hosts | json_query('jso

Re: [ansible-project] Re: cannot login to cisco switch using ansible

2018-08-16 Thread Ajay Kumar Manukonda
Hi Michael, I am glad you found a solution. I see that you are only taking the output of stdout[0] under copy task. Since your config will have the output of multiple commands you might need config.stdout[1] and config.stdout[2] as well. You can use something like the following to capture all you

Re: [ansible-project] webserver secure

2018-08-16 Thread 'Felix Fontein' via Ansible Project
Hi, > how do you currently do your certs? you can either use the letsencrypt > modules, the letsencrypt module was renamed to acme_certificate (to not violate Let's Encrypt's trademark) for Ansible 2.6. (The renamed module's documentation: https://docs.ansible.com/ansible/latest/modules/acme_cer

Re: [ansible-project] webserver secure

2018-08-16 Thread Jonathan Lozada De La Matta
Coach, how do you currently do your certs? you can either use the letsencrypt modules, use copy to put it on webserver you build or use get_url. You can also do the same for the webserver config you are using. You can also template the config file. On Thu, Aug 16, 2018 at 1:15 PM coach rhca wrot

[ansible-project] webserver secure

2018-08-16 Thread coach rhca
Hi, Trying to create an ec2 instance using ansible. which will host a normal webserver but not sure on how to add the self signed certificate to the http - webserver using ansible. Also how to redirect all the http request to https one using ansible. Could you please suggest. thank you. --

[ansible-project] Re: Use of vmware_guest module

2018-08-16 Thread Dimitri Yioulos
Doing this" --- - hosts: localhost gather_facts: false *serial: 1* vars: ~ doesn't seem to help. Any help would be appreciated. On Tuesday, August 14, 2018 at 3:38:03 PM UTC-4, Dimitri Yioulos wrote: > > Hello, all. > > I need to create a playbook which will include shutting down, the

Re: [ansible-project] only show run give error

2018-08-16 Thread Kai Stian Olstad
On Thursday, 16 August 2018 04.40.02 CEST nbctcp wrote: > Hi, > I have working playbook to cisco on eve-ng. > It will give error only when I want to run "show run". > Other commands like "show version" "show clock" all ok > > Please help > tq > > # cat showrun.yml > --- > - name: Run multiple com

Re: [ansible-project] Re: ansible-pull configuration

2018-08-16 Thread SUMIT SAHAY
Thanks Pshem for your reply. ansible-pull -U [git_url] -k playbook.yml --limit localhost I am using this command to run the ansible pull, while doing this I am getting one error, unable to resolve the error. "msg": "Failed to download remote objects and refs: Host key verification failed.\r\nf

Re: [ansible-project] Ansible "replace" & "lineinfile" issue

2018-08-16 Thread Dick Visser
On 16 August 2018 at 08:30, Kanhaiya Ashtekar wrote: > > I am having a requirement where I need to replace/comment a line from > rsyslog.conf file > I am unable to correctly state the regexp. Please Help. > > INADEQUATE INFORMATION AVAILABLE ONLINE. > > I have been testing the following script wh

Re: [ansible-project] Re: ansible-pull configuration

2018-08-16 Thread Pshem Kowalczyk
Hi, That's correct, in pull mode ansible modifies and sets things on the machine on which it runs. The easiest way of providing inventory in this case is via command line: -i $(hostname), Please note the comma at the end. kind regards Pshem On Wed, 15 Aug 2018 at 02:55 SUMIT SAHAY wrote: >

[ansible-project] Re: Ansible - "pyvmomi module required" error

2018-08-16 Thread 董小呆
Hi, i meet the same issue, are you how to solved ? PLAY [Revert the given snapshot for virtual machines] *** TASK [Gathering Facts] ***