Re: [ansible-project] set_fact support for list of dictionaries?

2014-07-17 Thread Serge van Ginderachter
I have an outstanding PR for that: https://github.com/ansible/ansible/pull/8019 On 17 July 2014 19:16, E.C. Raymond wrote: > What is the status on complex data storage for set_fact? It seems like > its not quite possible yet when I have tried multiple methods. > > - name: testing > set_fact

Re: [ansible-project] Connection reset by peer on an AIX host provisioning

2014-07-17 Thread Lucas, Sascha
Hi Michaël, > PUT /tmp/tmpb1NMJ5 TO > /ansible/.ansible/tmp/ansible-tmp-1405515992.16-30163890915163/ping > > aix | FAILED => failed to transfer file to > /ansible/.ansible/tmp/ansible-tmp-1405515992.16-30163890915163/ping: > Couldn't read packet: Connection reset by peer On peer reset, the c

Re: [ansible-project] Prevent executing a role more than once

2014-07-17 Thread Ahmad Khayyat
On Fri, Jul 18, 2014 at 4:34 AM, Michael DeHaan wrote: Role dependencies can have parameters. > ​Isn’t that what allow_duplicates=yes is for? Wouldn’t it be more consistent for allow_duplicates not to discriminate​ between executing the role explicitly or as a dependency? ​ -- You received thi

Re: [ansible-project] Fact Caching Revisited

2014-07-17 Thread Michael DeHaan
To elaborate: the vars_plugin theoretically could be returned via a specialized inventory plugin. It's more efficient to do so for small numbers of hosts. But there are dangers - lots of accesses, if not lazily done, could bog down the system immensely, and make it intractable for large numbers

Re: [ansible-project] apt module with list of packages

2014-07-17 Thread Michael DeHaan
apt is not pip, but we have some very nice lookup plugins that are useful. - apt: name={{ item }} state=installed with_pipe: cat /path/to/file.txt Note that the file.txt is assumed to be on the control machine. Alternatively, you could register the result of running ls and loop through "result

Re: [ansible-project] variable interpolation in hostvars

2014-07-17 Thread Michael DeHaan
Not too complicated. I'd worry abit about the efficiency as this would need to be calculated a fair amount, but it's something we can look into. Note there is something of a backlog, but I'd file a ticket with info if not already and we can explore it. On Thu, Jul 17, 2014 at 4:34 PM, Tomasz Ko

Re: [ansible-project] mysql_* modules defaults from my.cnf

2014-07-17 Thread Michael DeHaan
Sounds great, send us a PR! On Thu, Jul 17, 2014 at 3:18 PM, Michael Peters wrote: > Right now the various mysql_* modules will pull default connection > information from the ~/.my.cnf file. This is especially important to > make things repeatable especially when the server is newly provisioned

Re: [ansible-project] How to only play tasks with specific tags in playbook

2014-07-17 Thread Michael DeHaan
"Surely a playbook by design should be a playbook?" All ducks must quack, except when they are elephants. On Thu, Jul 17, 2014 at 2:31 PM, Brendon Standing < bstand...@marinsoftware.com> wrote: > Thanks all. I know that I can call tags from the command line and that my > example will apply new

Re: [ansible-project] set_fact support for list of dictionaries?

2014-07-17 Thread Michael DeHaan
You are passing it a string above. Don't do that. Try this: - set_fact: x: On Thu, Jul 17, 2014 at 1:16 PM, E.C. Raymond wrote: > What is the status on complex data storage for set_fact? It seems like > its not quite possible yet when I have tried multiple methods. > > - name: test

Re: [ansible-project] Playbook organization with var files

2014-07-17 Thread Michael DeHaan
"But it does matter in some. I can't get playbooks that aren't in the same directory as group_vars to behave like those that are." This is not because of cwd at all, but because of the playbook basedir. On Thu, Jul 17, 2014 at 2:03 PM, Michael Peters wrote: > On Thu, Jul 17, 2014 at 1:45 PM,

Re: [ansible-project] Use setup module filter parameter to get results based on values of a fact

2014-07-17 Thread Michael DeHaan
This may be useful, untested quick sketch though... Take a look at the group_by parameter to select all hosts where a fact has a certain value. - hosts: all tasks: - group_by: key=ansible_system_vendor_{{ ansible_system_vendor }} - hosts: ansible_system_vendor_HP tasks: - debug: msg

Re: [ansible-project] Connection reset by peer on an AIX host provisioning

2014-07-17 Thread Michael DeHaan
Not sure. Try running with - (four v's) to get SSH debug info out of the system. On Thu, Jul 17, 2014 at 8:37 AM, Michaël Pailloncy wrote: > Hi all, > > I have a problem to provision an AIX host using Ansible (see > https://github.com/ansible/ansible/issues/8164 for details). > > $> ansi

Re: [ansible-project] Prevent executing a role more than once

2014-07-17 Thread Michael DeHaan
On Thu, Jul 17, 2014 at 12:23 PM, Joseph Tate wrote: > On Thursday, July 17, 2014 5:30:44 AM UTC-7, Michael DeHaan wrote: >> >> Right! Good plan. >> >> You could do a "set_fact: role_has_executed=1" at the end of the role >> >> and then on the role: >> >> - role: { name: foo, when: "role_has_ex

Re: [ansible-project] Prevent executing a role more than once

2014-07-17 Thread Michael DeHaan
On Thu, Jul 17, 2014 at 12:21 PM, Joseph Tate wrote: > Even if a role ends up being a no-op, it takes time. This makes playbook > execution slower, which is annoying. > What good does it do to tell the list you are annoyed? Provide an alternative, perhaps. -- You received this message because

Re: [ansible-project] Fact Caching Revisited

2014-07-17 Thread Michael DeHaan
While I appreciate the interest, fact caching will need to have very rigid design requirements so we are unlikely to take a pull request on it at this time. Ultimately I see this happening as a combination of a callback plugin to intercept facts, and a vars plugin to provide them. And it will nee

[ansible-project] Fact Caching Revisited

2014-07-17 Thread Josh Drake
Greetings, I know it has been attempted before and is still slated for the future, but I recently needed fact caching in my personal use of Ansible. I leveraged the work that was already done to fix the bugs that were present and complete a handful of working caching backends: redis, memcached,

[ansible-project] apt module with list of packages

2014-07-17 Thread Jason Clark
Is there a way to have a file i.e system-requirements.txt with a package per line and have the apt module install that? Exactly how pip works... -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receivi

Re: [ansible-project] Prevent executing a role more than once

2014-07-17 Thread Joseph Tate
Even if a role ends up being a no-op, it takes time. This makes playbook execution slower, which is annoying. On Wednesday, July 16, 2014 5:22:34 PM UTC-7, Michael DeHaan wrote: > > Generally people should write roles so that they are idempotent (grr, that > word again) and running them more tha

Re: [ansible-project] Prevent executing a role more than once

2014-07-17 Thread Joseph Tate
On Thursday, July 17, 2014 5:30:44 AM UTC-7, Michael DeHaan wrote: > > Right! Good plan. > > You could do a "set_fact: role_has_executed=1" at the end of the role > > and then on the role: > > - role: { name: foo, when: "role_has_executed is defined" } > Why would this not be default behavior?

Re: [ansible-project] variable interpolation in hostvars

2014-07-17 Thread Tomasz Kontusz
Dnia czw, 17 lip 2014, 14:29:45 Michael DeHaan pisze: I could be very very wrong about my assumption. Can we see the source to your filter? It might be instructive about what this might take. I kind of hope you are, as it would be really handy to have this in Ansible core ;-) My filter is at

[ansible-project] mysql_* modules defaults from my.cnf

2014-07-17 Thread Michael Peters
Right now the various mysql_* modules will pull default connection information from the ~/.my.cnf file. This is especially important to make things repeatable especially when the server is newly provisioned and insecure. But it doesn't use the socket information in the ~/.my.cnf file. Instead if y

Re: [ansible-project] How to only play tasks with specific tags in playbook

2014-07-17 Thread Brendon Standing
Thanks all. I know that I can call tags from the command line and that my example will apply new tags in my playbook. But to me a playbook by design should be able to run all the tasks that you need to run by calling the tags you have set in tasks/*.yml. Instead we are now presented with 2 opti

Re: [ansible-project] Playbook organization with var files

2014-07-17 Thread Michael Peters
On Thu, Jul 17, 2014 at 1:45 PM, Michael DeHaan wrote: > I don't feel the cwd should matter in most cases and it should not be > significant. But it does matter in some. I can't get playbooks that aren't in the same directory as group_vars to behave like those that are. And there's nothing in the

Re: [ansible-project] Openstack Nova_Compute Availability Zone

2014-07-17 Thread Michael DeHaan
Thanks! On Thu, Jul 17, 2014 at 11:34 AM, TextEditor wrote: > Hello Michael, > > I've checked the module code, it is not in there. I've added this option > and sent a pull request: https://github.com/ansible/ansible/pull/8182 > > Op donderdag 17 juli 2014 14:29:12 UTC+2 schreef Michael DeHaan:

Re: [ansible-project] Saving file before it is changed

2014-07-17 Thread Michael DeHaan
the backup feature should be really changed to do remote backups. This may come later. On Thu, Jul 17, 2014 at 10:51 AM, Mauricio Tavares wrote: > On Thu, Jul 17, 2014 at 10:27 AM, Ryan Schulze wrote: > > Something like the "backup" option in the template module? > > http://docs.ansible.com

Re: [ansible-project] Playbook organization with var files

2014-07-17 Thread Michael DeHaan
I don't feel the cwd should matter in most cases and it should not be significant. Ansible already looks for group_vars relative to the playbook dir, so keeping your top level playbooks in the same directory is recommended. On Thu, Jul 17, 2014 at 9:21 AM, Michael Peters wrote: > I do use role

Re: [ansible-project] file module can't be opened

2014-07-17 Thread Nic Flores
Brian, Thanks! I installed an ansible.cfg file in /etc/ansible/ and specified the remote directory to be: remote_tmp = /tmp/.ansible/tmp That fixed my issue. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group an

[ansible-project] set_fact support for list of dictionaries?

2014-07-17 Thread E.C. Raymond
What is the status on complex data storage for set_fact? It seems like its not quite possible yet when I have tried multiple methods. - name: testing set_fact: vms="['{ {{ item.item }}: {{ item.stdout.strip('\n') }} }']" with_items: - "{{ hostips }}" I found these links that got me clo

[ansible-project] Use setup module filter parameter to get results based on values of a fact

2014-07-17 Thread KSS
Hi, Is it possible to use the setup module along with the filter parameter to return something based on the value of fact? For example, I want to quickly get a list of all my machines in ansible that are VMWare based using an ad-hoc command. I can run the following to get the vendor; ansibl

Re: [ansible-project] file module can't be opened

2014-07-17 Thread Brian Coca
hit enter too early ... my guess is that you are setting sudo_user to non root and this user cannot read into ansible's home/tmp folder or that you are using root over a filesystem that won't let you use root privs (i.e NFS). One way to get around it is setting ANSIBLE_REMOTE_TMP to /var/tmp, for

Re: [ansible-project] file module can't be opened

2014-07-17 Thread Brian Coca
it seems like your sudo user cannot open the tmp file under teh ansible user (your remote_user) -- Brian Coca Stultorum infinitus est numerus 0111011100100110010101101110001001110111011000010110011101010010011100110110110101110111001001110111 Pedo mellon a mi

[ansible-project] file module can't be opened

2014-07-17 Thread Nic Flores
Hey Folks, I'm running into the following error. I would appreciate any feedback. -bash-4.1$ ansible --version ansible 1.7 (devel f8bf9cdeec) last updated 2014/06/23 20:27:32 (GMT +000) -bash-4.1$ ansible-playbook edit_sdc_cron.yml -i sdc_hosts -u ansible --ask-pass -K SSH password: sudo passwo

[ansible-project] Connection reset by peer on an AIX host provisioning

2014-07-17 Thread Michaël Pailloncy
Hi all, I have a problem to provision an AIX host using Ansible (see https://github.com/ansible/ansible/issues/8164 for details). $> ansible -i myhosts aix -m ping - Result : ESTABLISH CONNECTION FOR USER: myuser REMOTE_MODULE ping EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=

[ansible-project] copy module with destination link count > 1

2014-07-17 Thread Dustin C. Hatch
I ran into something interesting today. I am using the `copy` module to copy a file from the management station to the managed host, and then the `file` module to create a hard link to that same file somewhere else. This works okay, on the first run, but subsequent runs error out on the `copy` task

Re: [ansible-project] Openstack Nova_Compute Availability Zone

2014-07-17 Thread TextEditor
Hello Michael, I've checked the module code, it is not in there. I've added this option and sent a pull request: https://github.com/ansible/ansible/pull/8182 Op donderdag 17 juli 2014 14:29:12 UTC+2 schreef Michael DeHaan: > > Can you please share what playbook data you are sending to it? > > >

Re: [ansible-project] Saving file before it is changed

2014-07-17 Thread Mauricio Tavares
On Thu, Jul 17, 2014 at 10:27 AM, Ryan Schulze wrote: > Something like the "backup" option in the template module? > http://docs.ansible.com/template_module.html > I have a feeling that might be exactly what I need. ;) Thanks! > > On 7/17/2014 9:06 AM, Mauricio Tavares wrote: >> >>

Re: [ansible-project] group_vars not visible to playbook

2014-07-17 Thread John Wang
> If you want to pass in the host specifier, you'll need to use "-e". Or maybe a lookup plugin reading an environment variable. -e is a bit clear. > > -e @filename.yml is also a valid syntax. Ok, I see. Thanks for mentioning the @filename.yml syntax also. -- You received this message because y

Re: [ansible-project] Re: Mysql Idempotency Failure

2014-07-17 Thread Matt Coddington
i would guess it's an ordering thing. the play prior to the failed one you are templating your .my.cnf. if that template is also using {{ mysql_root_password }} then you have locked yourself out of mysql by updating your .my.cnf with the new password prior to changing it. put the correct current

Re: [ansible-project] Saving file before it is changed

2014-07-17 Thread Ryan Schulze
Something like the "backup" option in the template module? http://docs.ansible.com/template_module.html On 7/17/2014 9:06 AM, Mauricio Tavares wrote: Let's say I have a template that will reapply my, say, /etc/ssh/sshd_conf if it has changed. How can I save the old one just in case? Somet

[ansible-project] Re: Mysql Idempotency Failure

2014-07-17 Thread Chinmaya Patanaik
Thanks. I didn't notice "host="$server_hostname"" thing as the play ended before that task. The task which failed is "name: update mysql root password for all root accounts". I am struggling with this all day. Any help is appreciated. On Thursday, July 17, 2014 5:10:45 PM UTC+5:30, Chinmaya Pat

Re: [ansible-project] Re: Starting Openstack VMs in parallel

2014-07-17 Thread Kurt Yoder
I forgot to include a critical piece of this solution. Here's how you invoke the task to tell Openstack to start the VMs: - name: Create cluster hosts: os_api gather_facts: no roles: [instantiate] # "instantiate" is a role that includes the Openstack startup task Perhaps this kind of exam

[ansible-project] Saving file before it is changed

2014-07-17 Thread Mauricio Tavares
Let's say I have a template that will reapply my, say, /etc/ssh/sshd_conf if it has changed. How can I save the old one just in case? Something like in /etc/ssh/Old would do fine; you get the idea. -- You received this message because you are subscribed to the Google Groups "Ansible Projec

Re: [ansible-project] Re: Starting Openstack VMs in parallel

2014-07-17 Thread Kurt Yoder
I found a different approach to this problem. First create a cluster configuration file. $ cat cluster.yml --- cluster: - cluster1 - cluster2 Define the first task: setting up one connection to localhost for each API call. - include_vars: cluster.yml - add_host: name: "os_api_{{ it

Re: [ansible-project] Playbook organization with var files

2014-07-17 Thread Michael Peters
I do use roles rather extensively for configuration management tasks. But for other (more orchestration related) tasks it doesn't seem to make much sense or at least I'm not seeing how best to organize that. For a more concrete example I have some mysql databases, some acting as master nodes some a

Re: [ansible-project] Mysql Idempotency Failure

2014-07-17 Thread Chinmaya Patanaik
Thanks. I didn't notice "host="$server_hostname"" thing as the play ended before that task. The task which failed is "name: update mysql root password for all root accounts". On Thursday, July 17, 2014 6:03:56 PM UTC+5:30, Michael DeHaan wrote: > > Minor pet peeve - That's not an idempotency fai

Re: [ansible-project] (NOOB) How to assign an array to a variabel in an Ansible-Playbook

2014-07-17 Thread Michael DeHaan
If you're going to reask questions from Stack Overflow please paste the question here and save us the click. We're not going to answer over on StackOverflow. It's also much better to just ask here as you'll get quicker answers - much larger audience reading things. I'm also unclear what you are

Re: [ansible-project] Mysql Idempotency Failure

2014-07-17 Thread Michael DeHaan
s/vault/fault/ (Freudian slip?) On Thu, Jul 17, 2014 at 8:33 AM, Michael DeHaan wrote: > Minor pet peeve - That's not an idempotency failure, you have trouble > logging into a MySQL database. > > I will stick voodoo pins into those that made use of that word so commonly > confused :) Not yo

Re: [ansible-project] Mysql Idempotency Failure

2014-07-17 Thread Michael DeHaan
Minor pet peeve - That's not an idempotency failure, you have trouble logging into a MySQL database. I will stick voodoo pins into those that made use of that word so commonly confused :) Not your vault of course. I do notice you are using horribly dated Ansible syntax with "host="$server_host

Re: [ansible-project] Setting dir vs file permissions with file "recurse=yes"

2014-07-17 Thread Michael DeHaan
Ansible does have a recursive copy, so I imagine you are requesting a change in the permissions structure? I'd also recommend the synchronize module versus passing recurse to the copy module. It's backed by rsync and is much more efficient. On Thu, Jul 17, 2014 at 5:40 AM, Paul Tötterman wrot

Re: [ansible-project] group_vars not visible to playbook

2014-07-17 Thread Michael DeHaan
If you want to pass in the host specifier, you'll need to use "-e". Or maybe a lookup plugin reading an environment variable. -e is a bit clear. -e @filename.yml is also a valid syntax. On Thu, Jul 17, 2014 at 5:33 AM, Serge van Ginderachter < se...@vanginderachter.be> wrote: > > On 17 July

Re: [ansible-project] Prevent executing a role more than once

2014-07-17 Thread Michael DeHaan
Right! Good plan. You could do a "set_fact: role_has_executed=1" at the end of the role and then on the role: - role: { name: foo, when: "role_has_executed is defined" } On Thu, Jul 17, 2014 at 3:31 AM, Tony Marin wrote: > You can try to set a condition on the whole role (you can use

Re: [ansible-project] variable interpolation in hostvars

2014-07-17 Thread Michael DeHaan
I could be very very wrong about my assumption. Can we see the source to your filter? It might be instructive about what this might take. On Thu, Jul 17, 2014 at 2:06 AM, Tomasz Kontusz wrote: > > > Michael DeHaan napisał: > >To be honest, nested variable evaluation in hostvars is a can of

Re: [ansible-project] Openstack Nova_Compute Availability Zone

2014-07-17 Thread Michael DeHaan
Can you please share what playbook data you are sending to it? On Thu, Jul 17, 2014 at 12:56 AM, TextEditor wrote: > In the Openstack Nova_compute module, I cannot give the availability zone > for an instance I want to create. Only the region, but my IAAS provider > only has Availability Zone

Re: [ansible-project] Variables containing passwords - Filtering

2014-07-17 Thread Michael DeHaan
Right now no_log: True is controlling remote syslog, the proposal is to make it also control the data passed to callbacks. On Thu, Jul 17, 2014 at 8:28 AM, Michael DeHaan wrote: > This has been discussed about 5 times over the last 3 days :) > > Yes, we would like to enable the "no_log: True"

[ansible-project] (NOOB) How to assign an array to a variabel in an Ansible-Playbook

2014-07-17 Thread Benjamin Bauer
Can anybody help me on this: http://stackoverflow.com/questions/24798382/how-to-assign-an-array-to-a-variabel-in-an-ansible-playbook -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails fro

[ansible-project] Error in setting Java_HOME and Java_path to make java available for the system

2014-07-17 Thread Nandha Kumar
Hi, I want to know , how to set java home and java path through ansible playbook or else is there any other way to make java available to the system. I have tried using lineinfile and copy the src file and template structure. please assist me in solving this issue. Thanks and Regards Nand

Re: [ansible-project] Variables containing passwords - Filtering

2014-07-17 Thread Michael DeHaan
This has been discussed about 5 times over the last 3 days :) Yes, we would like to enable the "no_log: True" attribute on a task to alter the way the callback outputs data. (or rather, the info passed to the callback should be trimmed in that case) On Wed, Jul 16, 2014 at 4:02 AM, Simone B

[ansible-project] Variables containing passwords - Filtering

2014-07-17 Thread Simone Bovi
Hello, I would like to share a feature idea: how about filtering passwords defined in variables in a way that they are never put through output or red/blue logs? It seems that at this time is filtered only output where "password=something", "login_password=something" or patterns like "user:pas

[ansible-project] Mysql Idempotency Failure

2014-07-17 Thread Chinmaya Patanaik
Hi, I am trying to incorporate mysql secure installation using Ansible playbook. I followed the below links. 1. http://stackoverflow.com/questions/16444306/ansible-idempotent-mysql-installation-playbook 2. https://groups.google.com/forum/#!topic/ansible-project/-jSfGwpk5J8 Target Server - Amaz

Re: [ansible-project] Setting dir vs file permissions with file "recurse=yes"

2014-07-17 Thread Paul Tötterman
> > I'm really not interested in tool comparisons here, but Puppet has not > done the recursive thing either and actually takes the position you have to > spec out every file path along the way. > I suspect Damien meant: file { '/target': source => 'file:///source', recurse => true, mode

Re: [ansible-project] group_vars not visible to playbook

2014-07-17 Thread Serge van Ginderachter
On 17 July 2014 11:29, John Wang wrote: > I felt that. Then is there a way to define variable which can be used in > the position of the mentioned "var1" in foo.yml ? Is the command line > options (i.e., -e) is the only way ? ​I believe so yes. Not sure if there's a way to use a var from var:

Re: [ansible-project] group_vars not visible to playbook

2014-07-17 Thread John Wang
On Thursday, July 17, 2014 3:38:23 PM UTC+8, Serge van Ginderachter wrote: > > > On 17 July 2014 06:09, John Wang > > wrote: > >> The problem in the above configuration is, the variable "var1" in the >> foo.yml cannot be resolved to "my_cluster" defined in group_vars/all . I >> have to use the -

Re: [ansible-project] group_vars not visible to playbook

2014-07-17 Thread Serge van Ginderachter
On 17 July 2014 06:09, John Wang wrote: > The problem in the above configuration is, the variable "var1" in the > foo.yml cannot be resolved to "my_cluster" defined in group_vars/all . I > have to use the -e option of ansible-playbook explicitly. Is this how > ansible works ? And how to realize

Re: [ansible-project] Prevent executing a role more than once

2014-07-17 Thread Tony Marin
You can try to set a condition on the whole role (you can use an empty main.yml with an inmport: ... when: common_executed is defined) based upon a fact/variable that you can define at the end of the common role, thus if it has been executed once, it will be skipped afterwards. On 17/07/14 00: