Re: [ansible-project] How to escape a variable?

2014-08-08 Thread Vijay Korapaty
I'm not entirely sure what I changed, but {{ '{{' }} .Id {{ '}}' }} started working for me. Thanks for the alternatives, I'll keep those in mind. On 8/8/2014 4:32 PM, Michael DeHaan wrote: Alternatively, you could also do: \{\{.Id\}\} Or {% raw %}{{ .Id }}{% endraw %} I probably prefer the

Re: [ansible-project] 'lineinfile' module - possible bug?

2014-08-08 Thread James Cammarata
Also, is there any reason you're not using the user module to manage entries in your passwd/shadow files? On Fri, Aug 8, 2014 at 6:30 PM, Michael DeHaan wrote: > lineinfile is tricky and I don't have bandwidth to debug this one right > now, but maybe some other folks would like to help? > > Mos

Re: [ansible-project] Configuring Ansible to run play books through a bastion host on aws/ec2

2014-08-08 Thread Michael DeHaan
I think I rejected this in the past, when we were young, saying you could set this in ~.ssh/config (as you can). I'm open to it now though, for exactly those reasons. Would need to be implemented in ssh.py and probably raise warnings if found in paramiko.py. Code submissions would be great, othe

Re: [ansible-project] Configuring Ansible to run play books through a bastion host on aws/ec2

2014-08-08 Thread Kevin Fox
I'd love a feature that let you set ansible_ssh_proxy in this way. I'd be able to set it from my openstack inventory module. On Wednesday, February 5, 2014 11:51:03 AM UTC-8, Adam Heath wrote: > > I've had musings on that too. Currently, I think you'd have to manually > configure $HOME/.ssh/con

Re: [ansible-project] Templated file used as variable?

2014-08-08 Thread Michael DeHaan
"One thing that would really help here and is general enough I'm sure it would find use elsewhere as well is to have the template module capable of outputting to a variable rather than a file. That certainly would help me in my case, and I've seen cases elsewhere while trying to improve my code fo

Re: [ansible-project] How to escape a variable?

2014-08-08 Thread Michael DeHaan
Alternatively, you could also do: \{\{.Id\}\} Or {% raw %}{{ .Id }}{% endraw %} I probably prefer the raw/endraw most of the time. On Fri, Aug 8, 2014 at 5:35 PM, Michael Peters wrote: > Probably not the best way, but you could use a string inside of the > jinja templating > > - name:

Re: [ansible-project] Merging of host_vars and group_vars?

2014-08-08 Thread Michael DeHaan
hash_merge would only merge hashes, not lists. So if you instead had users keyed such that they were in the hash based on the username, that would work. users: dev: name: dev groups: ['dev'] uid: 2001 etc The extra "name" may also be redundant, but this should get you o

Re: [ansible-project] 'lineinfile' module - possible bug?

2014-08-08 Thread Michael DeHaan
lineinfile is tricky and I don't have bandwidth to debug this one right now, but maybe some other folks would like to help? Most of the time, I *strongly* recommend just templating the file, that way you are centrally very sure of the state of everything that's in there. On Fri, Aug 8, 2014 at

Re: [ansible-project] EC2 module : dependency between exact_count and count_tag

2014-08-08 Thread Michael DeHaan
Ouch, absolutely should have. There's a flag "required_together" in the argument spec that can be used for this. Can you please file a ticket in GitHub so we can take care of this one? Random killing of nodes is definitely not something we wish to encourage! Sometimes nodes deserve it though, b

Re: [ansible-project] Loop over a list that points at structures

2014-08-08 Thread Michael DeHaan
Yeah you are going to need to write your own iterator for a lookup plugin at that level of complexity. Take a look at "with_subelements" for one example of one that is almost there. Or you could just restructure your info to make it easier, if it was coming from a YAML file. On Fri, Aug 8,

Re: [ansible-project] Is there a Pattern for having one machine in a cluster perform an action?

2014-08-08 Thread Michael DeHaan
run_once does that for a task, yes. Long-form, may be useful, as well; # all of em - hosts: webservers tasks: - blarg - blarg # just on the head node - hosts: webservers[0] tasks: - blarg - blarg # now some others - hosts: dbservers tasks: - blarg On Fri, Aug 8,

Re: [ansible-project] ec2 module alarm creation

2014-08-08 Thread Michael DeHaan
ec2_metric_alarm was added more recently, yes. On Fri, Aug 8, 2014 at 8:38 AM, Sankalp Khare wrote: > Doesn't the ec2_metric_alarm module do this already? Or was this post from > a time before that module was added... > > > On Thursday, 13 March 2014 21:09:16 UTC+5:30, Michael DeHaan wrote: >

Re: [ansible-project] Re: Make it possible to nest connection plugins

2014-08-08 Thread Michael DeHaan
"I don't think ssh.py (or any other specific connection plugin) is a good place for this, I think it should rather be done as separate plugin or in core. That's because I'd like to see the same layers used with local/ssh/accelerate." I'm not sure that's a good idea. (A) all distros are moving to

Re: [ansible-project] pycrypto

2014-08-08 Thread Michael DeHaan
Can you share how you installed Ansible as well? On Fri, Aug 8, 2014 at 2:43 PM, Guanwen Zhang wrote: > The OS is CentOS 6.5 64 bit. > > > Initial questions - what OS are you running from and how did you install > ansible? > > > > Pycrypto can get confused when your libs get mixed between OS

Re: [ansible-project] Templated file used as variable?

2014-08-08 Thread AJ Daws
For example, say I have file, .bashrc that I want to write to my target host during the cloud-init process. In some cases, like with CoreOS which sets files like this one read-only once cloud-init is complete, there are things you can do during cloud-init that you cannot do afterwards (otherwi

Re: [ansible-project] How to escape a variable?

2014-08-08 Thread Michael Peters
Probably not the best way, but you could use a string inside of the jinja templating - name: obtain image id local_action: shell docker inspect --format={{ '{{.Id}}' }} {{ docker_image_name }} | cut register: docker_image_id On Fri, Aug 8, 2014 at 1:04 PM, Vijay Korapaty wrote:

Re: [ansible-project] Templated file used as variable?

2014-08-08 Thread Michael Peters
I don't know if you know this, but variables can themselves be templated. You can do this in a set_fact or even in a variable file (group_vars, host_vars, var_files, etc). For instance: set_fact: foo={% if yada %}{{ (blah + baz) / 100 }}{% else %}{{ fiddly * 100 }}{% endif %} Or in a var file:

Re: [ansible-project] Templated file used as variable?

2014-08-08 Thread AJ Daws
Michael, no need to apologize, you've already helped a lot, thank you! One thing that would really help here and is general enough I'm sure it would find use elsewhere as well is to have the template module capable of outputting to a variable rather than a file. That certainly would help me

Re: [ansible-project] Trouble updating alternatives on CentOS via shell/command modules

2014-08-08 Thread Brian Coca
alternatives module works for me, if it does not for you, could you file a bug?​ -- 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...@g

[ansible-project] 'lineinfile' module - possible bug?

2014-08-08 Thread Willard Dennis
Hi all, I have a playbook used for setting up new servers here, that among other things, ensures both NTP and NIS (yes, we still use NIS here...) are installed and are running. The problem I am seeing is that when the playbook executes the notify action for restarting the ntpd service, it is f

[ansible-project] How to escape a variable?

2014-08-08 Thread Vijay Korapaty
I'm trying to execute the following task: - name: obtain image id local_action: shell docker inspect --format={{.Id}} {{ docker_image_name }} | cut register: docker_image_id where '{{.Id}}' should not be considered as a variable. I've tried escaping it in this fashion: {{ '{

[ansible-project] Merging of host_vars and group_vars?

2014-08-08 Thread ryan
I have a playbook with a role that creates users that are defined in group_vars/all, similar to this role https://galaxy.ansible.com/list#/roles/51. When I define a user in the host_vars/foo it takes over precedence and does not add the users I have in group_vars/all. I have set hash_behaviou

[ansible-project] EC2 module : dependency between exact_count and count_tag

2014-08-08 Thread casimir Jeanjean
Hi everyone, In one of my plays, in a EC2 action, I used the "exact_count" parameter and forgot to specify "count_tag". Ansible tried to kill one of my EC2 machines randomly (fortunately it had API termination disabled). In such case, as exact_count and count_tag are dependent of each other (ac

[ansible-project] Loop over a list that points at structures

2014-08-08 Thread mtovey
I have structures in group_vars files that looks roughly like the following: Accounts1: files: - { src: 'src_path/filename1', dest: 'dest_path/filename1' } - { src: 'src_path/filename2', dest: 'dest_path/filename2' } app_groups: - { name: 'group1', gid: '1234' }

[ansible-project] pycrypto

2014-08-08 Thread Guanwen Zhang
The OS is CentOS 6.5 64 bit. Initial questions - what OS are you running from and how did you install ansible? Pycrypto can get confused when your libs get mixed between OS packages and pip. On Thu, Aug 7, 2014 at 5:46 PM, Guanwen Zhang wrote: > > I installed ansible 1.7, when I played m

[ansible-project] Trouble updating alternatives on CentOS via shell/command modules

2014-08-08 Thread Gary Malouf
I tried using the debian-specific update-alternatives module but this did not work. Very simply, I have a command that when executed from the command line on the server itself works fine but via a task in our playbook says it succeeded but in reality has no effect. Very simply, I am trying to

Re: [ansible-project] template module bombing out

2014-08-08 Thread Michael DeHaan
When you don't specify a destination path, it is going to use the filename to decide the filename of the output. The solution would be to specify the full path to the destination file. On Fri, Aug 8, 2014 at 1:51 AM, David Karban wrote: > Hi, > > AFAIK it is correct and ansible is doing it

Re: [ansible-project] Templated file used as variable?

2014-08-08 Thread Michael DeHaan
I'm sorry, I found your use case too confusing for me to understand - no offense implied - with what you were doing with lookup plugins. I can't help you explore it further. This may just be the case of a mailing list making it hard to communicate, but things like "The problem is that the output

Re: [ansible-project] Re: Ideal permissions setup?

2014-08-08 Thread Michael DeHaan
I'm not going to sell things on this list, but pricing has recently been updated if you have not checked recently - so it might actually make sense for you. It's a lot more complex to get this right than you think, so it may be worthwhile if you have such needs. On Fri, Aug 8, 2014 at 9:39 AM,

Re: [ansible-project] ansible verison 1.7 and pycrpto problems

2014-08-08 Thread Michael DeHaan
Initial questions - what OS are you running from and how did you install ansible? Pycrypto can get confused when your libs get mixed between OS packages and pip. On Thu, Aug 7, 2014 at 5:46 PM, Guanwen Zhang wrote: > > I installed ansible 1.7, when I played my playbook, I got the following >

Re: [ansible-project] Is there a Pattern for having one machine in a cluster perform an action?

2014-08-08 Thread Guy Matz
Super-sweet! For anyone who is wondering, the "full" documentation is in here: http://docs.ansible.com/playbooks_delegation.html Thanks! On Friday, August 8, 2014 10:15:16 AM UTC-4, Michael Peters wrote: > > Ansible 1.7 added the new "run_once" keyword so that a given action > will only ru

Re: [ansible-project] Is there a Pattern for having one machine in a cluster perform an action?

2014-08-08 Thread Michael Peters
Ansible 1.7 added the new "run_once" keyword so that a given action will only run once for that host list. On Fri, Aug 8, 2014 at 10:08 AM, Guy Matz wrote: > Hi! I have a few django servers . . . I would like to run a syncdb in my > playbook, but only need/want one of the django servers in the

[ansible-project] Is there a Pattern for having one machine in a cluster perform an action?

2014-08-08 Thread Guy Matz
Hi! I have a few django servers . . . I would like to run a syncdb in my playbook, but only need/want one of the django servers in the group to run that play . . . do I need to designate a machine to run that or is there an easier way? Thanks!! -- You received this message because you are

[ansible-project] Re: access to ansible_ssh_host and ansible_ssh_port in a play

2014-08-08 Thread Amr Ali
yes you can use hostvars, hostvars[host]['ansible_ssh_host'] replacing host with the host you want to get in info on. also ansible_ssh_host is available as a variable for the current play host, you can simply do {{ ansible_ssh_host }} On Friday, August 8, 2014 9:14:39 AM UTC+2, Stefan Lapers wr

[ansible-project] Re: Ideal permissions setup?

2014-08-08 Thread Gary Malouf
I hear that, but atm we can not afford to go that direction. I was more asking what users who have not been able to afford the commercial product are doing in the mean-time. On Friday, August 8, 2014 6:42:55 AM UTC-4, Vitaliy Zhhuta wrote: > > for such kind of tasks Ansible created Tower http:/

[ansible-project] Re: Ideal permissions setup?

2014-08-08 Thread Vitaliy Zhhuta
for such kind of tasks Ansible created Tower http://www.ansible.com/tower Пʼятниця, 8 серпня 2014 р. 08:44:24 UTC+3 користувач Gary Malouf написав: > > Today, we have a setup where all of our playbooks, roles, etc are owned > and run by root on our 'management instance'. Some important key files

Re: [ansible-project] ec2 module alarm creation

2014-08-08 Thread Sankalp Khare
Doesn't the ec2_metric_alarm module do this already? Or was this post from a time before that module was added... On Thursday, 13 March 2014 21:09:16 UTC+5:30, Michael DeHaan wrote: > > There's no specific plan for adding this, but we're always open to pull > requests for upgrades. > > Not sure

[ansible-project] access to ansible_ssh_host and ansible_ssh_port in a play

2014-08-08 Thread Stefan Lapers
Hi, Is it possible to access ansible_ssh_host (and other inventory parameters) in a playbook ? The goal is to copy/backup files *from* a remote machine to the local ansible station or a machine specified with delegate_to using rsync over ssh. So i would need to expand the ssh connection info in

Re: [ansible-project] template module bombing out

2014-08-08 Thread David Karban
Hi, AFAIK it is correct and ansible is doing it at least from 1.1 (when I started with it). If you set only path, template file name is just copied as is in src argument. template: src=admin-pwd-chg.ldif.j2 dest=/tmp/admin-pwd-chg.ldif will work. David 2014-08-07 23:41 GMT+02:00 John Oliver :

Re: [ansible-project] How to loop over all elements of a list when elements are not known in advance?

2014-08-08 Thread Servermanaged
Sounds interesting! Thanks for the suggestion! 2014-08-07 23:16 GMT+02:00 Michael DeHaan : > For dictionaries, you can use ".keys()" to get all of them. There is also > ".iteritems()" which returns a tuple of both the key and the value. > > > > > On Wed, Aug 6, 2014 at 6:58 AM, Valentino Gaglia