Re: [ansible-project] How to use ec2 modules user_data field?

2014-12-19 Thread Chris Church
I'm planning to get some of these roles onto Galaxy, but until then... The next tasks in that particular play are: - name: wait for instances to listen on port 5986 (winrm https) wait_for: state=started host={{ item.tagged_instances[0].public_ip }} port=5986 with_items: win_ec2.re

[ansible-project] Passing an IP address of a host as an a command line argument to a bash script

2014-12-19 Thread Fazal-e-Rehman Khan
Dear All, My hosts file looks like this. [client] 192.168.1.23 [server] 192.168.1.24 [exchange] 192.168.1.25 In my playbook, I want to run a script on a remote machine ("client" in my case) which requires the IP address of the other remote machine (server) as an cmd line argument to that scr

Re: [ansible-project] Passing an IP address of a host as an a command line argument to a bash script

2014-12-19 Thread Matt Martz
I believe you are looking for the inventory_hostname variable. I also tend to use this in combination with ansible_ssh_host for completeness, such as: {{ ansible_ssh_host|default(inventory_hostname) }} On Friday, December 19, 2014, Fazal-e-Rehman Khan wrote: > Dear All, > > My hosts file looks

Re: [ansible-project] Passing an IP address of a host as an a command line argument to a bash script

2014-12-19 Thread Fazal-e-Rehman Khan
No I want to send the IP address of "server" as a command line argument to a script which is be run on "client" client and server are 2 separate nodes - not the host on which ansible is running. {{ inventory_hostname }} has all hosts in it. I'm looking for a particular host from the group "serv

Re: [ansible-project] Passing an IP address of a host as an a command line argument to a bash script

2014-12-19 Thread Fazal-e-Rehman Khan
No I want to send the IP address of "server" as a command line argument to a script which is be run on "client" client and server are 2 separate nodes - not the host on which ansible is running. {{ inventory_hostname }} has all hosts in it. I'm looking for a particular host from the group "serv

[ansible-project] run_once per group.

2014-12-19 Thread Nico K.
Hi, I have groups of hosts that I copy files to, one those files are copied I call a webservice on the groups master; this webservice will call a deployment script. The problem I'm having is that the webservice call will be made for every host but it only needs to be called once per group. The

[ansible-project] Hybrid Inventory: including ec2.py groups in static hosts.aws

2014-12-19 Thread Zaur Salamov
Hi all. I know if put static and dynamic inventory files in the same directory ansible uses both. But I couldnt include group name from ec2.py in hosts.aws as children. It ignores it. Ie as: [mytest:children] type_m1_large tag_kafkaproducer_yes Yaml file doesnt return the list of hosts if I u

[ansible-project] Cannot get customized facts when pushing with "--check"

2014-12-19 Thread Dong Guo
Hi gentlemen, We are using the Ansible to manage many servers, and we like the dry run mode which with parameters "--check" and "--diff". We always run with these parameters first to verify that if the changes will be made correctly. The customized facts are very helpful, to generate some dynamic

[ansible-project] postgresql_user module: fe_sendauth: no password supplied

2014-12-19 Thread Michael Shi
I'm trying to use the postgresql_user module, but I keep getting *unable to connect to database: fe_sendauth: no password supplied* Doing the same on postgresql_db module seems to work Is it a problem authenticating as the postgres user? # users.yml - name: PostgreSQL | Make sure the PostgreSQL u

Re: [ansible-project] Re: Force gathering facts on all hosts when using --tags or --limit

2014-12-19 Thread Dmitry Zelenkovsky
That's exactly what I'm looking for, please implement it with "gather_facts: force" - in playbook to override --limit & --tags settings. Is there any way to push it to official release? vote? BR Dmtiry Z. On Saturday, October 18, 2014 1:31:58 PM UTC-7, Craig Tracey wrote: > > I also have this is

Re: [ansible-project] Re: Force gathering facts on all hosts when using --tags or --limit

2014-12-19 Thread Michael DeHaan
You're bumping a bit of an old thread. The trick here is to use fact caching, have one play gather your facts, and other plays can just rely on those facts. On Fri, Dec 19, 2014 at 8:38 AM, Dmitry Zelenkovsky < dmitry.zelenkov...@gmail.com> wrote: > That's exactly what I'm looking for, please

Re: [ansible-project] run_once per group.

2014-12-19 Thread Michael DeHaan
- hosts: headnode tasks: - ... # run once stuff goes here - hosts: webservers tasks: - ... # stuff to do to everything Alternatively: when: inventory_hostname == groups['webservers'][0] On Fri, Dec 19, 2014 at 8:55 AM, Nico K. wrote: > Hi, > > I have groups of hosts that I copy

Re: [ansible-project] Passing an IP address of a host as an a command line argument to a bash script

2014-12-19 Thread Brian Coca
as long as the server group only has 1 ip: hosts: client tasks: - shell: myscript.sh {{ groups['server'] }} {{ somevalue }} On Fri, Dec 19, 2014 at 8:30 AM, Fazal-e-Rehman Khan wrote: > No I want to send the IP address of "server" as a command line argument to a > script which is be run on "c

[ansible-project] dpkg options

2014-12-19 Thread sebastian halfar
Hallo ansible-team, first of all nice work i like this tool alot. We use it for Updates on Debian Server. I got one request for your dpkg options, we need the possibility to give apt module some dpkg options like only upgrade a certain package only if its already installed. Can u tell me if u g

Re: [ansible-project] Cannot get customized facts when pushing with "--check"

2014-12-19 Thread Brian Coca
You need to let ansible know your module supports check mode, this is done by instantiating the module class and adding 'supports_check_mode=True'. -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group

[ansible-project] How to easily test/experiment with jinja templating in ansible?

2014-12-19 Thread Dario Bertini
I've been bitten one too many times by the way that ansible interacts with jinja. I'd say its error handling is a little bit too lax, defaulting to return empty strings or similar things that then end up getting my playbooks to fail later down the line. To prevent that, I know that I can have a

[ansible-project] problems with the 'git' module

2014-12-19 Thread Toni Mueller
Hi, I am trying to deploy software from git to a machine which I am managing with Ansible. I am using SSH agent forwarding for authentication. If I log in as the user and connect to the repository host, everything works just like it should. I can make use of the key I am using from the manageme

Re: [ansible-project] Passing an IP address of a host as an a command line argument to a bash script

2014-12-19 Thread Fazal-e-Rehman Khan
Thank you so much Brian once again. :) On Friday, 19 December 2014 19:47:35 UTC+5, Brian Coca wrote: > > as long as the server group only has 1 ip: > > hosts: client > tasks: >- shell: myscript.sh {{ groups['server'] }} {{ somevalue }} > > On Fri, Dec 19, 2014 at 8:30 AM, Fazal-e-Rehman K

[ansible-project] negating a command

2014-12-19 Thread rambius
Hello, I am new to ansible and I am experimenting with a simple playbook I created. My question is how to negate the return code of a command. I use pgrep to check if a server is running and if it is not running I will back it up. If it is running the playbook should fail with an appropriate m

Re: [ansible-project] negating a command

2014-12-19 Thread Brian Coca
look at the failed_when directive, it allows you to chose the failure condition of a task. -- Brian Coca -- 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 an

[ansible-project] Async "Fire and Forget" Issues - Ansible 1.7.1

2014-12-19 Thread Xavier Krantz
Hello, I am trying to use the Async capabilities of ansible to "fire and forget" a job and then check it later and wait till its end. I have followed the example mentioned here : http://docs.ansible.com/playbooks_async.html But I am facing an issue and I don't really understand what's happeni

Re: [ansible-project] Async "Fire and Forget" Issues - Ansible 1.7.1

2014-12-19 Thread Adam Miller
On Fri, Dec 19, 2014 at 2:30 PM, Xavier Krantz wrote: > Hello, > > > I am trying to use the Async capabilities of ansible to "fire and forget" a > job and then check it later and wait till its end. > I have followed the example mentioned here : > http://docs.ansible.com/playbooks_async.html Async

[ansible-project] Using binary data in Ansible Vaults.

2014-12-19 Thread Stephen Gargan
I've been using a pattern of base64 encoded values and jinja templates deal with storing binary data in vaults and have put together scripts to simplify the process; I've found them pretty useful and figured others might get some use out of them. https://github.com/sgargan/ansible-vault-tools

Re: [ansible-project] run_once per group.

2014-12-19 Thread Nico K.
That works sort of, however it does become repetitive. Also it doesn't work very well when using --limit on the command-line, after all there needs to be association between webserver1,2,3 and master1 On Friday, December 19, 2014 3:45:06 PM UTC+1, Michael DeHaan wrote: > > - hosts: headnode >

[ansible-project] Lookup if a value is in a dictionary then perform a task (using when/conditional)

2014-12-19 Thread Cody Robertson
Hello, Hopefully I'm not overlooking this but is there a way to lookup if a value is in a dictionary - if it is perform a task using the "when" keyword? For example I want to have a certain task only run if the {{ ansible_fqdn }} is in the dictionary. licensed_hosts: - test001.example.com

Re: [ansible-project] Lookup if a value is in a dictionary then perform a task (using when/conditional)

2014-12-19 Thread Brian Coca
First, licensed_hosts is actually a list, not a dictionary, the dash (-) signifies 'list item' Second, you don't need to lookup ansible_fqdn as that should be part of fact gathering which isnormally automatic, so this should "just work": tasks: - debug: msg="This should only run on test002.exam

Re: [ansible-project] Lookup if a value is in a dictionary then perform a task (using when/conditional)

2014-12-19 Thread Cody Robertson
Hi Brian, My verbiage is pretty poor when it comes to YAML - thanks for clarifying! Since ansible_fqdn is automatically gathered I was referring to looking to see if that variable / fact was in a list. Your example worked perfectly! I'll make sure to try to look into the Jinja2 expressions a bi

Re: [ansible-project] Using binary data in Ansible Vaults.

2014-12-19 Thread Michael DeHaan
If the primary goal of this is to encrypt the value given to the "src" of a copy operation (or template operation), I wonder if there's a better way to make this happen without needing to shell out to an extra CLI. It might require vault knowing that a file is not YAML when it is executed though..

Re: [ansible-project] Async "Fire and Forget" Issues - Ansible 1.7.1

2014-12-19 Thread Michael DeHaan
Well, it wasn't a new feature in 1.8, though there was a bug fixed in the fire and forget operation when you don't specify a lifetime of the process, IIRC - I remember you filing it, all the same :) Let us know if you have the same problem in 1.8, regardless. On Fri, Dec 19, 2014 at 4:11 PM, Ada

Re: [ansible-project] Using binary data in Ansible Vaults.

2014-12-19 Thread Stephen Gargan
Building this into the copy plugin would definitely be the way to go; the vault header could have a flag to denote the contents and distinguish binary from yaml. On Saturday, 20 December 2014 00:55:42 UTC, Michael DeHaan wrote: > > If the primary goal of this is to encrypt the value given to th

[ansible-project] Creation of dict on the fly

2014-12-19 Thread Rick Kasten
I have to create a haproxy config file with data from an unknown number of backend servers. The number is unknown, because based on the environment I need to run the playbook in, the number of backend servers could be 1 to several. My backend servers in haproxy.cfg need to defined something like

Re: [ansible-project] Creation of dict on the fly

2014-12-19 Thread Timothy Gerla
I wonder if there might be a simpler way to approach this, but you could use a trick I have used a couple of times and use a template to generate a yaml data structure. Something like: backend_servers.j2: --- {% for x in groups['web_servers'] %} - name: {{ x }} ip: {{ hostvars[x]['ansible_eth0'