[ansible-project] ansible with forks > 1 doesn't work using ansible_ssh_host/ansible_ssh_port

2017-07-26 Thread Sureshkumar Kaliannan
Hi, We are tunneling ssh through websocket..so the inventory looks something like this.. [nodes] host1 ansible_ssh_host=localhost ansible_ssh_port=26532 host2 ansible_ssh_host=localhost ansible_ssh_port= [admin@nsm-dev2-suresh ~]$ ansible -vv -m ping nodes Using /etc/ansible/ansible.cfg as

[ansible-project] ANSIBLE: how to append a string at the end of a file

2017-07-26 Thread Vijay Misra
Hi , I am trying to use ansible as a test tool. at the end of each sucess/faiure i want to append a string at the end of a file and this file can be used as a test report. i Have tried this code but it did not log anything in the file. - debug: msg="HPQC Create snapshot of a vGPU VM on

Re: [ansible-project] Storing IP address of First node (Control Node) in variable

2017-07-26 Thread Pshem Kowalczyk
Ansible runs an implicit loop for all the devices. If you access a variable in the 'regular' way you can only see variabels/facts set for the current device. Variables/facts set for other devices (that the loop already ran through) can be accessed via the 'hostvars' variable. If you know that you

Re: [ansible-project] Using Pathword Authentication to run a Playbook

2017-07-26 Thread Adrian Likins
ansible-playbook isnt really the right tool for writing interactive tooling. There is some very limited support for it but it is not a good approach. Some of the previous mentioned suggestions (password protected prod only ssh keys and ssh-agent...) will be more useful in the long run. Or using

Re: [ansible-project] Role included multiple times only seems to run once

2017-07-26 Thread Matthew Rathbone
Hey Adrian -- thanks for your response! I did about an hour of reading and playing around with dependencies and I figured it out: I needed to add allow_duplicates: yes to the role I was depending on, not my role. So I forked the redis-server role, added the statement, and it works! Thanks for

Re: [ansible-project] Role included multiple times only seems to run once

2017-07-26 Thread Adrian Likins
http://docs.ansible.com/ansible/latest/playbooks_roles.html#role-dependencies "Roles dependencies are always executed before the role that includes them, and are recursive. By default, roles can also only be added as a dependency once - if another role also lists it as a dependency it will

Re: [ansible-project] how to debug ansible seg vault ?

2017-07-26 Thread Adrian Likins
Can you reproduce the segfault? Can try running it under gdb: # 'bin/ansible-playbook' or the path to you ansible-playbook install (`which ansible-playbook`) gdb --batch -ex run --args python bin/ansible-playbook -vvv your_playbook.yml But maybe easier to use catchsegv to grab a stack

[ansible-project] Storing IP address of First node (Control Node) in variable

2017-07-26 Thread Homayoun Najafizadeh
It might be a dumb question but I can't get this to work. I want to print IP address of my control node in all nodes. Lets say I have this in hosts: [webservers] 10.10.10.1 10.10.10.2 10.10.10.3 When I run my "ansible-playbook -s myCode.yml" on 10.10.10.1 I want to see my debug line says:

Re: [ansible-project] Best practice/way for variables to be used in template?

2017-07-26 Thread Mike Eriksson
Hi Branko, Yeah, I stumbled onto host_vars during my trial and error approach so that's where it all ended up. Many thanks for getting back to me - confirming my conclusion/finding. Cheers, Mike On Wed, Jul 26, 2017 at 8:58 PM Branko Majic wrote: > On Fri, 21 Jul 2017

Re: [ansible-project] gathering facts on network devices

2017-07-26 Thread Andrew Meyer
Ok now i'm getting this - {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'password' is undefined\n\nThe error appears to have been in '/home/andrew.meyer/playbooks/asa-showrun.yml': line 7, column 5, but

Re: [ansible-project] gathering facts on network devices

2017-07-26 Thread Kai Stian Olstad
On 26. juli 2017 20:45, Andrew Meyer wrote: So I figured that out. But now i'm not able to connect to any of the network devices. All of them are showing unreachable when running ansible-playbook with --check. Here is my config: cat asa-showrun.yml --- - hosts: "cisco-fw-ip" PLAY

[ansible-project] Re: Small Example for Reading from CSV-File for the creation of new user

2017-07-26 Thread Daniel JD
Hey Dan, your current csv file doesn't really looks like a csv file :D The item variable which you are refering to is the key which jinja will use to give you the right csv- row. I am guessing that there will be some more values than the name in the future, so you could iterate over the first

Re: [ansible-project] gathering facts on network devices

2017-07-26 Thread Andrew Meyer
So I figured that out. But now i'm not able to connect to any of the network devices. All of them are showing unreachable when running ansible-playbook with --check. Here is my config: cat asa-showrun.yml --- - hosts: "cisco-fw-ip" tasks: - name: sho run set_fact: cli:

Re: [ansible-project] Small Example for Reading from CSV-File for the creation of new user

2017-07-26 Thread Kai Stian Olstad
On 26. juli 2017 18:04, 'Dan Steffen' via Ansible Project wrote: maybe I am just blind but I spend today 2 hours to found out how to read from a CSV to create User at the moment I have something like - hosts: all user: name="{{ lookup('csvfile', 'item file=user.csv delimiter=, col=0') }}"

Re: [ansible-project] Getting a Column value from row

2017-07-26 Thread Vijay Misra
Awesome Kai & Jean ! it worked when i used the shell command. :) Lot of thanks to you guys! ASK [ESX_VM_SnapRestore : Get the VM id of the powered ON VM] *

Re: [ansible-project] gathering facts on network devices

2017-07-26 Thread Kai Stian Olstad
On 26. juli 2017 17:09, Andrew Meyer wrote: I seem to be having some issues making this playbook work. I want to just do a show run on all my cisco devices, but it keeps throwing errors about the '- vars:' or something else. I am on the latest version. rpm -qa|grep -i ansible

Re: [ansible-project] Getting a Column value from row

2017-07-26 Thread Kai Stian Olstad
On 26. juli 2017 19:50, Vijay Misra wrote: Thanks Kai for your quick response ! Here is my output , problem is it does not extract the VMID but outputs the whole string. I intend to just get the VMID. I forgot that command doesn't allow pipe, so as James suggested, use the shell module. You

Re: [ansible-project] win_shell/win_command chdir to Directory with Spaces

2017-07-26 Thread Jean-Yves LENHOF
Le 26/07/2017 à 20:10, Nick Couchman a écrit : > Thank you for the suggestion, Mike. > > I've tried it both ways, and neither of them works. In fact, the > "YAML Syntax" doesn't seem to actually attempt to change directory - > if I use that, I get an error along the lines of file not found or >

Re: [ansible-project] win_shell/win_command chdir to Directory with Spaces

2017-07-26 Thread Nick Couchman
Thank you for the suggestion, Mike. I've tried it both ways, and neither of them works. In fact, the "YAML Syntax" doesn't seem to actually attempt to change directory - if I use that, I get an error along the lines of file not found or command not found, indicating that it isn't even going

Re: [ansible-project] Getting a Column value from row

2017-07-26 Thread Jean-Yves LENHOF
Le 26/07/2017 à 19:50, Vijay Misra a écrit : > Thanks Kai for your quick response ! > Here is my output , problem is it does not extract the VMID but > outputs the whole string. I intend to just get the VMID. > > TASK [ESX_VM_SnapRestore : debug] >

Re: [ansible-project] Getting a Column value from row

2017-07-26 Thread James Tanner
Try using the shell module instead of command. On Wed, Jul 26, 2017 at 1:50 PM, Vijay Misra wrote: > Thanks Kai for your quick response ! > Here is my output , problem is it does not extract the VMID but outputs > the whole string. I intend to just get the VMID. > > TASK

Re: [ansible-project] win_shell/win_command chdir to Directory with Spaces

2017-07-26 Thread Mike Eriksson
Nick, I saw it mentioned somewhere that if you use 'YAML syntax' with the :'s instead of Ansibles ='s you should not need escape characters for directories with spaces in them. Ie, if you do it like this: - win_command: runsomething.exe args: chdir: c:\Program Files\Application The

[ansible-project] Small Example for Reading from CSV-File for the creation of new user

2017-07-26 Thread 'Dan Steffen' via Ansible Project
Hello, maybe I am just blind but I spend today 2 hours to found out how to read from a CSV to create User at the moment I have something like - hosts: all user: name="{{ lookup('csvfile', 'item file=user.csv delimiter=, col=0') }}" and a CSV-File that looks like jdoe jkirk bwillis

[ansible-project] docker_container network issue

2017-07-26 Thread sn . lazamanthony
Hi, I've been using the docker_container module. So far it's working when creating the image and other options, but when the "networks" option is used then the issue arise. Here's the details: ansible version: ansible 2.2.1.0 (master d5f68d2824) last updated 2017/07/26 15:11:46 (GMT +800)

Re: [ansible-project] Does command module honor wildcards?

2017-07-26 Thread Josef Fortier
> > > Command module does not support globs so you would need to use shell > with globs. > Ahh... Thanks. FWIW, Looking at the command module docs I do see this telling note: >> "It will not be processed through the shell" But I'd only get the lack of glob support from that sentence

[ansible-project] Ansible 2.3.2 RC4 is available for testing

2017-07-26 Thread James Cammarata
Hi all, we're happy to announce that Ansible 2.3.2 RC4 is available for testing. A list of fixes can be found in the CHANGELOG here: https://github.com/ansible/ansible/blob/v2.3.2.0-0.4.rc4/CHANGELOG.md#bugfixes How do you get it?

[ansible-project] win_shell/win_command chdir to Directory with Spaces

2017-07-26 Thread Nick Couchman
So, I'm trying to run a command via Ansible, and the command exists in a path that's in a directory with spaces, namely c:\Program Files. I need the module to chdir to the directory where the command is actually located because there are files that it needs to reference inside that directory.

[ansible-project] gathering facts on network devices

2017-07-26 Thread Andrew Meyer
I seem to be having some issues making this playbook work. I want to just do a show run on all my cisco devices, but it keeps throwing errors about the '- vars:' or something else. I am on the latest version. rpm -qa|grep -i ansible ansible-inventory-grapher-2.3.2-1.el7.noarch

Re: [ansible-project] Building Module - Unable to set correct type for DEFAULT_LOCAL_TMP

2017-07-26 Thread Kai Stian Olstad
On 26. juli 2017 14:28, Luvpreet Singh wrote: I have just started to learn on how to build modules in Ansible. I can't help with you problem, but wanted mention that Ansible has a list for development, you might have better luck there.

Re: [ansible-project] Getting a Column value from row

2017-07-26 Thread Kai Stian Olstad
On 26. juli 2017 09:29, Vijay Misra wrote: I need to get the VMID field from the column data as below. [[root@prmh-mag-31:~] vim-cmd vmsvc/getallvms Vmid NameFile Guest OS Version Annotation 51 myvgpu_clone2 [EVC_Store1]

[ansible-project] 2.4 support for multiple vault passwords, looking for feedback

2017-07-26 Thread Adrian Likins
I've been working on some vault related 2.4 roadmap[1] features, namely "Support for multiple vault passwords. ". The current pr is at https://github.com/ansible/ansible/pull/22756 The roadmap feature is based on RFE https://github.com/ansible/ansible/issues/13243 Looking for feedback from

Re: [ansible-project] parsing output from json

2017-07-26 Thread Kai Stian Olstad
On 26.07.2017 14:03, akku wrote: yes... with this it prints the path and size along with the whole output. but i need only the parsed output. You don't say what you are going to use this for. If you would like it in a file, use the template module. If you would like to have it displayed

[ansible-project] Building Module - Unable to set correct type for DEFAULT_LOCAL_TMP

2017-07-26 Thread Luvpreet Singh
I have just started to learn on how to build modules in Ansible. I have followed this page, http://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html I created the python file, cloned the ansible repo told there, and ran the command, ansible/hacking/test-module -m

Re: [ansible-project] parsing output from json

2017-07-26 Thread akku
yes... with this it prints the path and size along with the whole output. but i need only the parsed output. On Wednesday, July 26, 2017 at 11:20:14 AM UTC+5:30, Kai Stian Olstad wrote: > > On 25. juli 2017 23:03, akku wrote: > > Am using find modules to get largest files and its size the

[ansible-project] Re: How to read the JSON output of a module from another module I am creating

2017-07-26 Thread russell choudhury
Ahh I got it, seems like ansible auto-magically converts the json to dict so I just changed the type from 'string' to 'dict' On Wednesday, July 26, 2017 at 11:23:24 AM UTC+1, russell choudhury wrote: > > I want to be able to read the output from a specific task in the module I > am creating. >

[ansible-project] how to debug ansible seg vault ?

2017-07-26 Thread Mike C
im getting a seg fault when im running my ansible. Is there a way to turn on more debugging or anything that can help me find out the source ? My `/var/log/syslog` has entries like this ``` Jul 26 10:47:26 ubuntu-xenial kernel: [ 497.822661] ansible-playboo[13890]: segfault at a9 ip

[ansible-project] How to read the JSON output of a module from another module I am creating

2017-07-26 Thread russell choudhury
I want to be able to read the output from a specific task in the module I am creating. To do this I am registering the output into a variable in my playbook and then sending this as a argument in my module. The format of the variable is json, I am reading this in my python script as a string

Re: [ansible-project] Add role dependency to another role without it being executed automatically

2017-07-26 Thread Adam Addamsky
On Friday, July 7, 2017 at 9:22:18 PM UTC+1, Dick Davies wrote: > Why not just stick the slack tasks in the relevant roles? > In this speci That would result in a lot of duplicated code and potential problems with maintainability. Also, that practice leads to "inventing the wheel all over

[ansible-project] Getting a Column value from row

2017-07-26 Thread Vijay Misra
I need to get the VMID field from the column data as below. [[root@prmh-mag-31:~] vim-cmd vmsvc/getallvms Vmid NameFile Guest OS Version Annotation 51 myvgpu_clone2 [EVC_Store1] myvgpu_clone2/myvgpu_clone2.vmx

[ansible-project] Re: Fetch Time Out with Windows Server 2008 SP2 and R2 - Works for Server 2012

2017-07-26 Thread Richard Rogers
Further to your reply, The servers do have that KB installed - one of the first things I checked. The Ansible server has only recently been built, so would expect it to be up to date. Testing has also only been with one server at a time. Yes, also tried flat='no' - obviously then saved file in

[ansible-project] Re: Fetch Time Out with Windows Server 2008 SP2 and R2 - Works for Server 2012

2017-07-26 Thread Richard Rogers
Hi, To further clarify on this, I have made some changes, including the following: ansible_winrm_operation_timeout_sec=800 ansible_winrm_read_timeout_sec=900 Although not sure the above fixed the issue. I can now connect to Server 2008 R2. However, I still can't connect to Server 2008 SP2 - it

Re: [ansible-project] " Unable to look up a name or access an attribute in template string" when use conditional check

2017-07-26 Thread Kai Stian Olstad
On 25. juli 2017 23:48, G. Muirdok wrote: *Got error for every run after upgrade to *2.3.1.0*:* root@aansible:~/nexkek# ansible --version ansible 2.3.1.0 config file = /root/nexkek/ansible.cfg configured module search path = Default w/o overrides python version = 2.7.6