Re: [ansible-project] when conditional and IP address, is this a bug ?

2014-05-13 Thread Julien Tognazzi
I really thought I tested your variant :-/ thanks anyway. On Tuesday, May 13, 2014 6:45:14 PM UTC+2, Matt Martz wrote: > > You when line need to be manipulated just a bit to look like: > > when: ansible_lo.ipv4.address == "127.0.0.1" > > You don't need {{}} in a when statement, you don't need to

Re: [ansible-project] synchronize module connects to local machine as root before calling rsync

2014-05-13 Thread 'Petros Moisiadis' via Ansible Project
On 05/13/2014 10:49 PM, Michael DeHaan wrote: > It depends if localhost is in inventory or not, but there is nothing > to presume an explicit entry of localhost has requested a particular > way to connect. But it is indeed presumed to connect through ssh, probably because this is the default for al

[ansible-project] Is it possible to see the JSON output of an ad-hoc command?

2014-05-13 Thread Kevin Bell
If I run something like: $ ansible -a "[ -d my_app ] chdir=/run/uwsgi/app" ec2 Even with max verbosity, this doesn't seem to output the raw JSON output. However if I do, e.g. : - command: "[ -d uwsgi_dev ] chdir=/run/uwsgi/app" register: result - debug: var=result Then I get the full J

[ansible-project] string comparison

2014-05-13 Thread Christian Huck
Hi, this when: item.mount != "/ does unfortunatly no do what it is supposed to do. The condition fails even though item.mount contains a "/". For explanation: item.mount is derived from ansible_mounts and describes the root partition. Any help appreciated. Thanks in advance. -- You receiv

Re: [ansible-project] Nested looping with hash/dict so I can override values

2014-05-13 Thread David Reagan
Yeah... I'm confused. I found with_nested to be a bit odd in the first place, much less trying to figure out what Petros is adding. I ended up with https://github.com/jerrac/aspects/blob/master/ansible_plugins/lookup_plugins/subdict.pyused at https://github.com/jerrac/aspects/blob/master/roles/own

Re: [ansible-project] Collecting setup facts from other servers when using --limit

2014-05-13 Thread Michael DeHaan
" But doesn't it seem weird that you should/shouldn't use --limit based on the implementation details of the playbook?" Depends what you want limit to do. It's kind of a damned if you do/don't, sort of thing. I suppose we could make a smart exemption for a single play with no tasks other than f

Re: [ansible-project] Collecting setup facts from other servers when using --limit

2014-05-13 Thread Michael Peters
Thanks for the additional options. But doesn't it seem weird that you should/shouldn't use --limit based on the implementation details of the playbook? Should the person who is running the playing have to know about the inner workings of the playbook file in order to know whether to use --limit or

Re: [ansible-project] how to always run code, regardless of tag

2014-05-13 Thread Michael DeHaan
Good deal. This is marked a "P3" ticket, so it's in queue once we get the P2's smited down properly not too far away, hopefully! On Tue, May 13, 2014 at 4:35 PM, Peter Gehres wrote: > I believe there is a pull request for an "all" tag at > https://github.com/ansible/ansible/pull/7039 > >

Re: [ansible-project] how to always run code, regardless of tag

2014-05-13 Thread Peter Gehres
I believe there is a pull request for an "all" tag at https://github.com/ansible/ansible/pull/7039 On Tue, May 13, 2014 at 12:53 PM, Michael DeHaan wrote: > You should be tagging such tasks with something like 'core' like you say > above, for now. > > We would entertain an 'all' tag if well impl

Re: [ansible-project] how to always run code, regardless of tag

2014-05-13 Thread Michael DeHaan
You should be tagging such tasks with something like 'core' like you say above, for now. We would entertain an 'all' tag if well implemented, which I believe we've also said before. "So what should I be doing here?" Submitting a pull request? :) On Tue, May 13, 2014 at 3:49 PM, Snyder, C

Re: [ansible-project] Collecting setup facts from other servers when using --limit

2014-05-13 Thread Michael DeHaan
This has come up once or twice. When limiting, you can't get facts from other hosts. The solution is to not use --limit and instead do: hosts: "mygroup:{{ limit_spec }}" and pass "-e limit_spec=what_I_would_have_passed_to_limit" This allows patterns like: - hosts: all tasks: [] # gather fa

Re: [ansible-project] synchronize module connects to local machine as root before calling rsync

2014-05-13 Thread Michael DeHaan
"Besides the above, another issue is whether it is good default behavior to connect to localhost through ssh if 'ansible_connection' is undefined" It depends if localhost is in inventory or not, but there is nothing to presume an explicit entry of localhost has requested a particular way to connec

Re: [ansible-project] when conditional and IP address, is this a bug ?

2014-05-13 Thread Michael DeHaan
You're getting an error because both the left and right value need to be quoted due to the extra template evaluation you had requested, which is why Ansible is giving the warning about this. This is simplified if you leave off the unneccessary {{ foo }} and just say "foo". On Tue, May 13, 2014 a

[ansible-project] how to always run code, regardless of tag

2014-05-13 Thread Snyder, Chris
How do you always have a set of tasks run regardless of the tag being passed in on the command line? I'm getting to the point where I have a 'core' playbook that must be run before any other playbook I have. This does specific things such as set specific facts based upon my local environments

Re: [ansible-project] synchronize module connects to local machine as root before calling rsync

2014-05-13 Thread 'Petros Moisiadis' via Ansible Project
On 05/13/14 18:36, Michael DeHaan wrote: > There's a degree of fuzzy logic in the synch module to understand > localness, but it's not perfect --- it was actually pretty surprising > how complex "guessing" the right params to sync needed to be. > > To understand this further though, can we please s

[ansible-project] Collecting setup facts from other servers when using --limit

2014-05-13 Thread Michael Peters
I have a playbook that sets up the application configuration on a server in a cluster. This configuration is based on other servers in the cluster and uses hostvars to great effect in the templated configuration. I'm really happy at how easy ansible make that. To make that work so that the facts ab

Re: [ansible-project] when conditional and IP address, is this a bug ?

2014-05-13 Thread Matt Martz
You when line need to be manipulated just a bit to look like: when: ansible_lo.ipv4.address == "127.0.0.1" You don't need {{}} in a when statement, you don't need to quote the whole line and you need to individually quote the IP address. --  Matt Martz m...@sivel.net On May 13, 2014 at 11:17:24

[ansible-project] when conditional and IP address, is this a bug ?

2014-05-13 Thread Julien Tognazzi
Hello, Running this test playbook, I have the following error: - hosts: localhost tasks: - name: Test IP address debug: msg="ok" when: "{{ ansible_lo.ipv4.address }} == 127.0.0.1" [WARNING]: It is unneccessary to use '{{' in conditionals, leave variables in loop expressions bare.

Re: [ansible-project] Need to avoid using a hosts or inventory file using Ansible

2014-05-13 Thread Michael DeHaan
And we should never teach people that trick, because it's quite useful to have inventory. It's kept around for historical reasons but may not be there indefinitely. On Tue, May 13, 2014 at 8:38 AM, Brian Coca wrote: > you always need inventory, but you can do it int he command line: > >-

Re: [ansible-project] Re: Callback functions and local facts.

2014-05-13 Thread Michael DeHaan
Hi! This is really a question for ansible-devel, since this is about developing code that uses the API. Can you post there? Thanks! On Tue, May 13, 2014 at 7:14 AM, Marcin Prączko wrote: > And still have question. > > Is there any way to use facts_get with DICT? > > For example: > facts.get('

Re: [ansible-project] Includes playbooks not able to access variables from vars_files

2014-05-13 Thread Michael DeHaan
Please file a ticket at github.com/ansible/ansible. Thank you! On Tue, May 13, 2014 at 2:37 AM, Manu J wrote: > Variables defined in vars is available to included playbooks but variables > included via vars_files is not. > > Files to reproduce - https://github.com/j-manu/debug/tree/master/ansi

Re: [ansible-project] freebsd buildworld/buildkernel crashes host OS ??

2014-05-13 Thread Michael DeHaan
Exciting! On Tue, May 13, 2014 at 12:20 AM, Dmitry Makovey wrote: > For posterity: I've tracked down the issue - it was FreeBSD's UFS > "Journaling" that was crashing things. Looks like ansible was able to > thrash system well enough to expose issues with that FS feature. After > disabling it -

Re: [ansible-project] Re: Ansible upgrade testing - version number isn't tracking?

2014-05-13 Thread Michael DeHaan
Not sure what is going on with pip in your case, but there's nothing in Ansible's pip configuration that running it 8 vs 9 times would change :) Ansible 1.4 is quite old though and there have been security updates in the 1.5 series, you should take the time to fix variable issues for sure so you c

Re: [ansible-project] access inventory file name

2014-05-13 Thread Michael DeHaan
"But looks like the variable file is referred to, before the variable inventory_file is loaded?" I'm not sure what this means, can you elaborate? Thanks! On Mon, May 12, 2014 at 3:27 PM, Mridusmita Talukdar wrote: > Hi, > We have multiple clusters. Each of the clusters need to have a differen

Re: [ansible-project] synchronize module connects to local machine as root before calling rsync

2014-05-13 Thread Michael DeHaan
There's a degree of fuzzy logic in the synch module to understand localness, but it's not perfect --- it was actually pretty surprising how complex "guessing" the right params to sync needed to be. To understand this further though, can we please see the lines from your playbook that you are using

Re: [ansible-project] Jinga2 Integer substitution in YAML task file

2014-05-13 Thread Michael DeHaan
This sounds entirely like the module is at fault and it doesn't have anything to do with Jinja2. What may be happening is the module is expecting an integer, and not casting strings to integers. In which case, this could be quickly confirmed with: size_gb={{ some_value | int }} And to see if th

[ansible-project] Re: apt-key with HKP keyserver

2014-05-13 Thread Adrian Simmons
On Saturday, 1 March 2014 08:58:47 UTC, Michael Mahemoff wrote: > > http doesn't work stderr: gpg: no valid OpenPGP data found." > Did you ever resolve this Michael? Just hit the same OpenPGP error with MariaDB... -- You received this message because you are subscribed to the Google Groups

Re: [ansible-project] Need to avoid using a hosts or inventory file using Ansible

2014-05-13 Thread Brian Coca
you always need inventory, but you can do it int he command line: -i '192.168.1.24,'​ the comma is required as it signifies its a list vs a directory/file -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and

Re: [ansible-project] Need to avoid using a hosts or inventory file using Ansible

2014-05-13 Thread James Cammarata
I would recommend using a dynamic inventory script that would provide the information, assuming it can be found via some local command or API? On Mon, May 12, 2014 at 6:15 PM, Noah Parker wrote: > Hello, > > The way I am implementing Ansible will mean that I will not know the IP of > the server

[ansible-project] Need to avoid using a hosts or inventory file using Ansible

2014-05-13 Thread Noah Parker
Hello, The way I am implementing Ansible will mean that I will not know the IP of the server I am configuring until I am launching the Playbook. I have tried passing in a variable for the IP for Ansible complains with: ERROR: provided hosts list is empty Here is a look at my .yml and command l

Re: [ansible-project] UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 84: ordinal not in range(128)

2014-05-13 Thread James Cammarata
Go ahead and open an issue on github for this, and we'll dig into it deeper. If setting the module_lang doesn't fix things, then the issue may not be on the client side. On Tue, May 13, 2014 at 6:41 AM, Joel Sdc wrote: > Hi James, > > I have tried: > > a) setting "module_lang = en_US.UTF-8" in

Re: [ansible-project] UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 84: ordinal not in range(128)

2014-05-13 Thread Joel Sdc
Hi James, I have tried: a) setting "module_lang = en_US.UTF-8" in ansible.cfg b) editing /usr/share/pyshared/ansible/constants.py and changing: DEFAULT_MODULE_LANG = get_config(p, DEFAULTS, 'module_lang', 'ANSIBLE_MODULE_LANG', 'C') to DEFAULT_MODULE_LANG = get_config(

[ansible-project] Re: Callback functions and local facts.

2014-05-13 Thread Marcin Prączko
And still have question. Is there any way to use facts_get with DICT? For example: facts.get('ansible_local["apache"]) ??? or facts.get('ansible_interfaces["eth"].some_argument) ??? Best regards, Marcin Praczko -- You received this message because you are subscribed to the Google Groups "

[ansible-project] Re: Callback functions and local facts.

2014-05-13 Thread Marcin Prączko
Hi, I think I sorted this our, seems be working now as expected: This is a snipped which must be used for local facts: ansible_local = facts.get('ansible_local', None) cur.execute("REPLACE INTO modules (host, name, status, version) VALUES(?,?,?,?);", (

[ansible-project] Callback functions and local facts.

2014-05-13 Thread Marcin Prączko
Hello, I am trying to write my own callback function which logs information which I want to database, especially informations from local facts. We have localfacts in json mode and I can easly get access to them from Ansbile it self, however everything what I've tried in terms access them from c