[ansible-project] Re: nested dictionary access

2014-10-01 Thread Sergey Sudakovich
It looks like I will need to flatten out the structure, just want somebody to confirm that there is no other obvious way. On Tuesday, September 30, 2014 10:24:29 PM UTC-7, Sergey Sudakovich wrote: > > I have a dictionary like this: > ppools: > one: > devices: > - abc >

Re: [ansible-project] Re: nested dictionary access

2014-10-01 Thread Serge van Ginderachter
You can iterate through it in a jinja template, though only for a fixed depth as you would need to code each iteration level manually (AFAIK) {% for p in ppools %} {% for devices in ppools[p].devices %} etc On 1 October 2014 09:28, Sergey Sudakovich wrote: > It looks like I will need to flatten

Re: [ansible-project] Execute sudo as a different user

2014-10-01 Thread Andreas Calvo
Thanks! Having the same user to do the connection and run sudo does not seems a good fit. And SU is not an option since the password cannot be stored in the inventory file. On Tuesday, September 30, 2014 7:36:40 PM UTC+2, tkuratomi wrote: > > On Tue, Sep 30, 2014 at 11:41 AM, Andreas Calvo > >

[ansible-project] chown failed in file module

2014-10-01 Thread olga
Hi, I am using ansible 1.7.2 and see the chown is not working olga@ubuntu:~/ansible/try/02$ ansible localhost -u root -k -m file -a 'path=/tmp/test6 state=directory mode=0700 owner=root' SSH password: localhost | FAILED >> { "failed": true, "gid": 1001, "group": "olga", "mode

[ansible-project] fetch does not support space in file name ?

2014-10-01 Thread Paul Yan
Hi, I just found fetch does not work very well with filenames has spaces in them. so I wrote a test script. ## name: report | fetch auditusage report from server fetch: src="{{ item }}" dest=/tmp/fetched with_items:

[ansible-project] Ansible module - ec2_elb Failing with Boto exeception ( throttling )

2014-10-01 Thread Nate Dobbs
Hello fellow ansible users. I have a process that turns on ec2 instances, then subsequently adds said instances to their respective load balancers. I get very intermittent results, sometimes the playbook will complete successfully, even consecutively at times. No matter what I do, ( change log

[ansible-project] Re: Back order for with_items

2014-10-01 Thread Nicolas Dupont-Jubien
Hello, The filter reverse returns a reverselistiterator and will be inappropriate here. I suggest you to use *with_items: *your_liste*[::-1] * Regards, Le mercredi 7 mai 2014 12:43:04 UTC+2, Aleksey Smart a écrit : > > Hello! > > I use zfs module for creating necessary structure. > Using

[ansible-project] How to edit boto for ec2, if we want to use big size of root

2014-10-01 Thread wholanda Edwart
Guys, I can use boto to create instance, but my problem, i dont know how to add tag when use it & get ip address. If i use ansible, i can give tag name & get ip address of new instance, but the problem the default of root size is 8GB. How can i add my python file to create instance in ansible/ ed

[ansible-project] Added ANSIBLE_KEEP_REMOTE_FILES but nothing happens

2014-10-01 Thread Tennis Smith
Hi, This is in reference to a CentOS 6.5 host using ansible as a vagrant provisioner. I added "export ANSIBLE_KEEP_REMOTE_FILES=1" to /etc/profile.d/ansible_debug.sh so that all users would pick up the env var. However, after running ansible, there aren't any files in /home/vagrant/.ansibl

[ansible-project] Ansible and ssh-keys | -a still allows running of playbooks?

2014-10-01 Thread Mark
So we stumbled upon this strange thing today while we are implementing and testing Ansible. We are sshing with keys to a server with ansible. from there we can run playbooks as usual against hosts. What we don't understand is this: We do the following: ssh -A ansible-test-machine ansible-playb

[ansible-project] Re: chown failed in file module

2014-10-01 Thread Mark
You are SSHing as root, is permitremoterootlogin enabled? Op woensdag 1 oktober 2014 13:36:16 UTC+2 schreef olga: > > Hi, > > I am using ansible 1.7.2 and see the chown is not working > > olga@ubuntu:~/ansible/try/02$ ansible localhost -u root -k -m file -a > 'path=/tmp/test6 state=directory mode

[ansible-project] aws ec2 module getting error - One or more undefined variables: 'instances' is undefined

2014-10-01 Thread Andy Raj
Hello folks, New to ansible, using version - 1.7.2. I am trying to write a play to launch an instance on AWS and install my packages on it. i need to automatically add the DNS name of the launched instance to my hosts file. But i am getting the error - One or more undefined variables: 'instance

[ansible-project] ansible code reuse in roles

2014-10-01 Thread Dmitry Sukhodoyev
Hello. I would like to reuse some ansible code in roles tasks. For example, installation of packages for multiple destination operation systems from local files: roles/includes_common/pkg_from_files.yaml: --- - name: uploading package copy: src="../{{current_role}}/files/{{name}}.{{generic_pkg

[ansible-project] ec2 module returning "One or more undefined variables: 'item' is undefined"

2014-10-01 Thread Andy Raj
Hello Fellow ansible users, I am new to ansible, using version 1.7.2 on Mac OSx. I am trying to launch aws instances and install our code on them as part of an automated deployment process. I am following this example http://docs.ansible.com/guide_aws.html And my playbook is located here https

[ansible-project] file created by ansible seems to have strangely mangled permissions (looks OK as root but looking generates errors as regular user)

2014-10-01 Thread Paul Hardwick
Issue with files created by Ansible I’m looking at using to setup some new servers at a new ISP and I’ve been doing some basic steps to test first. I am new but have done some testing on diff servers at another ISP which seemed to go OK (I had created files there no problem). Both are Unbuntu

[ansible-project] Ansible and SSH agent forwarding

2014-10-01 Thread Mark
So I'm running 3 CentOS 6.5 machines and came upon this thing which I don't understand. server 1: client machine server 2: ansible machine server 3: any target machine controlled by ansible. server 2/3 both have my public key. so when I ssh to them from server 1, it all goes well. I ssh from s

[ansible-project] Python API -> Inventory Variables

2014-10-01 Thread CJR
All - I am having hell with this: getLog = ansible.runner.Runner( forks=100, inventory=ansible.inventory.Inventory('inventory'), module_name='fetch', module_args='src=/tmp/logs.tar.gz dest=./output/?/logs flat=yes validate_md5=no', ).run() In line 5, you can see I put a whole bunch of

Re: [ansible-project] PROPOSAL: 'description' parameter

2014-10-01 Thread Michael DeHaan
Typically "name" has been used to provide a user readable comment and we haven't added code for ecosystem things that aren't part of the ansible project. One thing of caution to mention is that, currently, on the include this would set a variable called "description". My gut feeling is some playb

Re: [ansible-project] fetch does not support space in file name ?

2014-10-01 Thread Michael DeHaan
As an initial question, what is ansible --version ? On Mon, Sep 29, 2014 at 10:23 PM, Paul Yan wrote: > Hi, > > I just found fetch does not work very well with filenames has spaces in > them. so I wrote a test script. > ## > nam

Re: [ansible-project] Re: Back order for with_items

2014-10-01 Thread Michael DeHaan
Newer versions of Ansible can iterate across iterators in that "with" and should not present a problem. On Wed, Oct 1, 2014 at 4:03 AM, Nicolas Dupont-Jubien < nicolas.dupontjub...@gmail.com> wrote: > > Hello, > > > The filter reverse returns a reverselistiterator and will be inappropriate > he

Re: [ansible-project] Python API -> Inventory Variables

2014-10-01 Thread Michael DeHaan
First off, what's ansible --version? Second, can you show the line you have tried using the variable? This is a more-appropriate question for ansible-devel in the future. Thanks! On Tue, Sep 30, 2014 at 2:11 PM, CJR wrote: > All - > > I am having hell with this: > > getLog = ansible.runner.R

Re: [ansible-project] unarchive module: --check

2014-10-01 Thread Michael DeHaan
Please open a ticket if the recent changes on the development branch do not resolve things for you. Thanks! On Tue, Sep 30, 2014 at 3:32 PM, Lui wrote: > Actually, it doesn't make the change.. it just says it did (step marked in > yellow) > > > On Tuesday, September 30, 2014 3:06:42 PM UTC-4, L

[ansible-project] Re: Ansible and ssh-keys | -a still allows running of playbooks?

2014-10-01 Thread Mark
You can kill this thread as I submitted a duplicate, updated one later on. thanks! -- 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...

Re: [ansible-project] Re: new to ansible, looking for the way to go with oracle-ansible

2014-10-01 Thread Michael DeHaan
"if you look at yum, it gets binaries and installs them, with a very simple recipe." I'm aware of what yum is but I'm unclear on what "recipe" means here. I gather you are trying to build a module to automatically install Oracle, where that feels like it should be a role to me. Oracle is not a s

Re: [ansible-project] Re: nested dictionary access

2014-10-01 Thread Michael DeHaan
Restructing it slightly, you could use the "with_subelements" lookup: http://docs.ansible.com/playbooks_loops.html#looping-over-subelements On Wed, Oct 1, 2014 at 3:35 AM, Serge van Ginderachter < se...@vanginderachter.be> wrote: > You can iterate through it in a jinja template, though only fo

Re: [ansible-project] Execute sudo as a different user

2014-10-01 Thread Michael DeHaan
The user you connect as, and sudo to, are both seperately configurable. On Wed, Oct 1, 2014 at 6:23 AM, Andreas Calvo wrote: > Thanks! > > Having the same user to do the connection and run sudo does not seems a > good fit. > And SU is not an option since the password cannot be stored in the >

Re: [ansible-project] Ansible module - ec2_elb Failing with Boto exeception ( throttling )

2014-10-01 Thread Michael DeHaan
For starters, what ansible --version are you using? On Tue, Sep 30, 2014 at 11:49 AM, Nate Dobbs wrote: > Hello fellow ansible users. > > I have a process that turns on ec2 instances, then subsequently adds said > instances to their respective load balancers. I get very intermittent > results,

Re: [ansible-project] How to edit boto for ec2, if we want to use big size of root

2014-10-01 Thread Michael DeHaan
Start here for basic info and let us know if you have specific questions: http://docs.ansible.com/ec2_module.html http://docs.ansible.com/guide_aws.html On Tue, Sep 30, 2014 at 3:26 AM, wholanda Edwart wrote: > Guys, > I can use boto to create instance, but my problem, i dont know how to add >

Re: [ansible-project] aws ec2 module getting error - One or more undefined variables: 'instances' is undefined

2014-10-01 Thread Michael DeHaan
Reading your playbook above, there's no point at which you register into a variable called "instances", which is the problem. Move your debug line up and see what is in it: - debug: var=ec2_info On Tue, Sep 30, 2014 at 12:45 AM, Andy Raj wrote: > Hello folks, > > New to ansible, using version

Re: [ansible-project] Added ANSIBLE_KEEP_REMOTE_FILES but nothing happens

2014-10-01 Thread Michael DeHaan
That parameter needs to be set on the control machine, not the remote. I suspect that's what's happening to you, perhaps? On Tue, Sep 30, 2014 at 4:30 PM, Tennis Smith wrote: > Hi, > > This is in reference to a CentOS 6.5 host using ansible as a vagrant > provisioner. > > I added "export ANSI

Re: [ansible-project] Re: chown failed in file module

2014-10-01 Thread Michael DeHaan
"You are SSHing as root, is permitremoterootlogin enabled?" If that were the case the error would appear further up. Also sudo isn't being used because of the "-u root" Is there anything unusual about /tmp we might need to know? On Wed, Oct 1, 2014 at 7:40 AM, Mark wrote: > > You are SSHing

Re: [ansible-project] Ansible and SSH agent forwarding

2014-10-01 Thread Michael DeHaan
I'm having a bit of difficulty following the above, but I did want to point out that ansible is not doing anything to move/store your key. On Wed, Oct 1, 2014 at 6:48 AM, Mark wrote: > So I'm running 3 CentOS 6.5 machines and came upon this thing which I > don't understand. > > server 1: clien

Re: [ansible-project] ec2 module returning "One or more undefined variables: 'item' is undefined"

2014-10-01 Thread Michael DeHaan
The ec2 module is actually not returning this as an error, where you have it, there is no global named "item". This error message is appropriate. You'll need to debug a variable that's actually in scope :) On Tue, Sep 30, 2014 at 12:03 PM, Andy Raj wrote: > Hello Fellow ansible users, > > I

Re: [ansible-project] ansible code reuse in roles

2014-10-01 Thread Michael DeHaan
A few pedantic things: Roles don't actually hold code, and this seems to be more of a question about how to split up things that vary between OS than about reuse. Attaching a "when" to an include is fine if you'd like to do this, or you could keep the tasks inline. This is fine. The "pkg_from_f

Re: [ansible-project] file created by ansible seems to have strangely mangled permissions (looks OK as root but looking generates errors as regular user)

2014-10-01 Thread Michael DeHaan
As this is somewhat long, I understand your question to be about this: " The file “authorized_keys” in the .ssh directory exists and appears to have the correct permissions and does have the correct content. But trying to login via SSH acts as if it is not there." I see you have the task to copy

Re: [ansible-project] Re: new to ansible, looking for the way to go with oracle-ansible

2014-10-01 Thread Brian Coca
As an example https://galaxy.ansible.com/list#/roles/628, my role to install Oracle's java on ubuntu/debian. It has similar requirements, though lot simpler than the DB install. -- Brian Coca Stultorum infinitus est numerus 0111011100100110010101101110001001110111011000010110111

Re: [ansible-project] Ansible and SSH agent forwarding

2014-10-01 Thread Mark
I'm not sure if I can make it any clearer than this. Server 1 has the private key. Server 2 and 3 have the public key of server 1 If I connect to server 3 from server 1 through server 2 I would need to use ssh -A, since it needs to take my key from server 1, through 2 to 3. This is done through S

Re: [ansible-project] Ansible and SSH agent forwarding

2014-10-01 Thread Karl E. Jorgensen
Hi On Wed, Oct 01, 2014 at 03:48:52AM -0700, Mark wrote: > So I'm running 3 CentOS 6.5 machines and came upon this thing which I don't > understand. > > server 1: client machine > server 2: ansible machine > server 3: any target machine controlled by ansible. > > server 2/3 both have my public k

Re: [ansible-project] Ansible and SSH agent forwarding

2014-10-01 Thread Brian Coca
Check to see if you still have the control persist sockets open, ansible will reuse those and the forwarding settings will be the ones used to create the socket, so if created with -A, forwarding will continue to work. -- Brian Coca Stultorum infinitus est numerus 0111011100100110010101101110

Re: [ansible-project] Python API -> Inventory Variables

2014-10-01 Thread Matt Martz
So, reducing this to a more simple example: getLog = ansible.runner.Runner( forks=100, inventory=ansible.inventory.Inventory('inventory'), module_name='command', module_args='echo "{{ansible_ssh_host|default(inventory_hostname)}}"', ).run() In the above, I can confirm that standar

Re: [ansible-project] Python API -> Inventory Variables

2014-10-01 Thread CJR
I am running Ansible version 1.7. I have tried many different flavors of variables. I have tried using Ansiable syntax: module_args='src=/tmp/logs.tar.gz dest=./output/{{ inventory_hostname }}/logs ...as I would in a YML playbook. On Wednesday, October 1, 2014 8:05:23 AM UTC-4, Michael DeH

Re: [ansible-project] Python API -> Inventory Variables

2014-10-01 Thread CJR
Matt - Thanks for the assistance. I will try that shortly and see if I get the desired effect. I hadn't been using default() around it... On Wednesday, October 1, 2014 8:44:49 AM UTC-4, Matt Martz wrote: > > So, reducing this to a more simple example: > > getLog = ansible.runner.Runner( >

Re: [ansible-project] Ansible and SSH agent forwarding

2014-10-01 Thread Mark
So, allthough I have not specified ControlPersist in the playbook, nor in .ssh/config , when I reconnect to the machine in a short enough time and run the playbook to server 3, the ssh tunnel is still open and will be used by Ansible? So what I want, is probably, a way to close the tunnel when

Re: [ansible-project] Ansible and SSH agent forwarding

2014-10-01 Thread Brian Coca
ansible by default tries to use control persist (you can turn this off in ansible.cfg) if using a new enough version of openssh as it speeds things up considerably. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this grou

Re: [ansible-project] Added ANSIBLE_KEEP_REMOTE_FILES but nothing happens

2014-10-01 Thread Tennis Smith
Ah! Thank you. -T On Wednesday, October 1, 2014 7:19:26 AM UTC-5, Michael DeHaan wrote: > > That parameter needs to be set on the control machine, not the remote. > > I suspect that's what's happening to you, perhaps? > > > > On Tue, Sep 30, 2014 at 4:30 PM, Tennis Smith > wrote: > >> Hi, >> >>

Re: [ansible-project] PROPOSAL: 'description' parameter

2014-10-01 Thread shirou
Thank you for the comment. 'name' is always printed when you play. If name is long, the output becomes too verbose. I mentioned the Sphinx in the previous mail, but we can implements an ansible command which can output description. When many people write playbooks for a long time, it is easy to

Re: [ansible-project] file created by ansible seems to have strangely mangled permissions (looks OK as root but looking generates errors as regular user)

2014-10-01 Thread Paul Hardwick
Thanks for the idea Michael, I had verified that the correct/user(testjunk01 variable set in playbook) file was being created. I don't think that the fact that SSH didn't appear to use the file is the root issue but a symptom. >From trying to display the .ssh directory which contains the file,

Re: [ansible-project] Python API -> Inventory Variables

2014-10-01 Thread CJR
This did it! Thanks, I was not including the '|default(...)' piece. On Wednesday, October 1, 2014 8:44:49 AM UTC-4, Matt Martz wrote: > > So, reducing this to a more simple example: > > getLog = ansible.runner.Runner( > forks=100, > inventory=ansible.inventory.Inventory('inventory'), >

Re: [ansible-project] Added ANSIBLE_KEEP_REMOTE_FILES but nothing happens

2014-10-01 Thread Tennis Smith
FYI. I submitted a doc update. -T On Wednesday, October 1, 2014 7:19:26 AM UTC-5, Michael DeHaan wrote: > > That parameter needs to be set on the control machine, not the remote. > > I suspect that's what's happening to you, perhaps? > > > > On Tue, Sep 30, 2014 at 4:30 PM, Tennis Smith > wrote:

Re: [ansible-project] Docker module does not restart containers when docker parameters have changed

2014-10-01 Thread Aaron Feng
Here's the code change to restart the container if env vars have changed: https://github.com/forty9ten/ansible-modules-core/compare/ansible:devel...devel Let me know what you think. I know in the previous post I also talked about also checking other parameters such as volume and port. Maybe tha

Re: [ansible-project] Ansible module - ec2_elb Failing with Boto exeception ( throttling )

2014-10-01 Thread Nate Dobbs
Thank you for replying. I knew I left something out. Ansible version: ansible 1.7.2 Boto version: 2.32.1 On Wednesday, October 1, 2014 8:16:06 AM UTC-4, Michael DeHaan wrote: > > For starters, what ansible --version are you using? > > > > On Tue, Sep 30, 2014 at 11:49 AM, Nate Dobbs > wrote: >

Re: [ansible-project] file created by ansible seems to have strangely mangled permissions (looks OK as root but looking generates errors as regular user)

2014-10-01 Thread Paul Hardwick
I had been confused how a problem that looked that bad could get thru user testing. Well it turns out that Ansible testing didn't catch the problem because the problem was on my end and NOT with Ansible. Because I had not set the X-execute permission on the .ssh directory the "ls" command could

[ansible-project] Re: 'join' a list and a dict

2014-10-01 Thread Mikael Sandström
So I havent made any progress with this, and given the lack of response I take it this will not work? The workaround hack it is then /Micke On Friday, September 26, 2014 3:00:59 PM UTC+2, Mikael Sandström wrote: > > Hi, > > I've got the following structures (or at least I'm hoping to be able to

Re: [ansible-project] Re: nested dictionary access

2014-10-01 Thread Sergey Sudakovich
Thank you, ended up flattening it and using subelements. On Wednesday, October 1, 2014 5:15:17 AM UTC-7, Michael DeHaan wrote: > > Restructing it slightly, you could use the "with_subelements" lookup: > > http://docs.ansible.com/playbooks_loops.html#looping-over-subelements > > > > On Wed, Oct 1,

[ansible-project] where do i put a custom iterator?

2014-10-01 Thread Guy Matz
ansible-playbook --version ansible-playbook 1.8 (devel 1d3a8bd39c) last updated 2014/09/18 10:33:54 (GMT -400) Hi! I've written a custom iterator that works when I put it in ansible/lib/ansible/runner/lookup_plugins, however I can't seem to get it found when I put it with my playbooks . . . does

Re: [ansible-project] Re: Looping over a set of host in a playbook?

2014-10-01 Thread Stefan Mojsilovic
Had the same problem. Managed to solve it using this way to access the value: debug: msg="{{ hostvars[item]['ansible_default_ipv4']['address'] }}" with_items: groups.web_servers On Friday, April 25, 2014 4:07:47 PM UTC+2, Sébastien Han wrote: > > No one? > > On Wednesday, April 23, 2014 3:34:47

[ansible-project] Error using wait_for exclude_hosts option

2014-10-01 Thread Kevin Formsma
I'm trying to use the new exclude_hosts option as part of the drained state on the wait_for module (https://github.com/ansible/ansible/pull/7260). I'm using the latest source from git. However I'm getting the following error: Traceback (most recent call last): File "/home/monk/.ansible/tmp/an

[ansible-project] apt module doesn't install module with a 'when' condition

2014-10-01 Thread Johan Chassaing
Hi, I run ansible 1.7.2 under ubuntu 14.04 amd64 I made a playbook to upgrade only package that I added to a list. ( https://github.com/johan-chassaing/linux/blob/master/ansible/playbook/package_upgrade_list.yml ) So, I retrieve the list of every packages that need to be upgraded on my se

Re: [ansible-project] where do i put a custom iterator?

2014-10-01 Thread James Cammarata
Hi Guy, If this is a lookup plugin, you should be able to put it in a directory named "lookup_plugins" at the same location as the playbook. I can't find any documentation or code referencing this working in roles though, so I don't believe you can embed lookup plugins in a role at this time (whic

Re: [ansible-project] Error using wait_for exclude_hosts option

2014-10-01 Thread James Cammarata
Hi Kevin, this appears to be a bug. Could you please open a GitHub issue for this? The fix for this is to remove the `.split(',')` from that line. On Wed, Oct 1, 2014 at 4:18 PM, Kevin Formsma wrote: > I'm trying to use the new exclude_hosts option as part of the drained > state on the wait_for

Re: [ansible-project] where do i put a custom iterator?

2014-10-01 Thread Guy Matz
Awesome! yes, so moving my plugin, 12fcmds, to ansible_root/lookup_plugins/12fcmds.py allowed me to use the plugin as: - name: Test of with_cmd template: src=cmd.j2 dest=/tmp/{{ item.key }}.txt with_12fcmds: test_var tags: test This reply is mostly for posterity . . . Thanks!! Guy On Wed

Re: [ansible-project] apt module doesn't install module with a 'when' condition

2014-10-01 Thread Mark McCoy
If I understand your intent, it is to only update Apache if it is already installed, so that systems without Apache on them won't accidentally have it installed by mistake. A better way to go about this would be to have an "apache" or "webserver" group, and assign that group only to the servers tha

[ansible-project] Missing functionality?

2014-10-01 Thread John Oliver
The 'file' module could use the "directory_mode" directive. And 'unarchive' could use "owner", "group", "mode", "serole", "setype", etc. As well as "directory_mode" Unless I'm completely missing something, but it seems I should be able to unzip a local archive to the target, set ownership and

Re: [ansible-project] Missing functionality?

2014-10-01 Thread James Cammarata
Hi John, Those options should be available to both of those modules - I believe it is a mistake in the documentation that they are missing. If you have any trouble specifying those options with either module please let us know, and I will get the documentation updated in the mean time. Thanks! O

Re: [ansible-project] Missing functionality?

2014-10-01 Thread James Cammarata
Also, as far as the directory_mode option goes, the copy module is the only one that uses that, so it is not available in the other modules. On Wed, Oct 1, 2014 at 7:25 PM, James Cammarata wrote: > Hi John, > > Those options should be available to both of those modules - I believe it > is a mist