Re: [ansible-project] ec2 group module, support for icmp protocol

2014-06-19 Thread iain wright
Thanks James! Will give this a shot and add the example -- Iain Wright This email message is confidential, intended only for the recipient(s) named above and may contain information that is privileged, exempt from disclosure under applicable law. If you are not the intended recipient, do not dis

[ansible-project] fetch with_fileglob won't get files

2014-06-19 Thread Makimoto Marakatti
Hi all I have a play like this: --- - hosts: group sudo: True gather_facts: no tasks: - name: actually fetch files fetch: src={{ item }} dest=/ansible/deployment/files/backup/group/ with_fileglob: /etc/yum.repos.d/* Which seems to run successfully: $ ansible-playbook fetc

Re: [ansible-project] 10 lines in file

2014-06-19 Thread Michael Schultz
Depending on the file, sometimes they support an include statement (e.g., sudoers, apparmor, mysql, apache, ...) that you could assert lineinfile for then use template or file on the include file as appropriate. --michael On Jun 18, 2014 3:14 PM, "Michael Baydoun" wrote: > I need to add 10 lines

[ansible-project] Variable precedence and making roles work across distributions

2014-06-19 Thread Jeff Geerling
The technique I usually use for making a role work cross-distro is to do two things: *For variables*: Include a variables file named {{ ansible_os_family }}.yml (then stick 'Debian.yml' and 'RedHat.yml', etc. into the role's vars folder. *For tasks*: Add "when: ansible_os_family == 'Distributio

Re: [ansible-project] Variable precedence and making roles work across distributions

2014-06-19 Thread Maciej Delmanowski
How about this solution? In `defaults/main.yml`: java_distribution_packages: Debian: [ 'openjdk-7', 'java-stuff' ] RefHat: [ 'java-runtime-7', 'other-stuff' ] And then, in `tasks/main.yml`: - {{ ansible_pkg_mgr }}: name={{ item }} state=latest witn_items: java_distribu

Re: [ansible-project] Possible bug in repeated runs of ec2_group module with wide-open rule

2014-06-19 Thread Michael Peters
Thanks for the confirmation. Filed as https://github.com/ansible/ansible/issues/7832 On Wed, Jun 18, 2014 at 10:12 PM, James Cammarata wrote: > Yes, definitely a bug, so please open an issue for this. And the "-1" is > used by the AWS API to indicate "any", so for the error above it's trying to >

Re: [ansible-project] Trouble with using variables for ec2 tags

2014-06-19 Thread Michael Peters
I've filed it as 2 separate issues since they could be related but different (one completing but with the wrong results and the other failing with the traceback): https://github.com/ansible/ansible/issues/7833 https://github.com/ansible/ansible/issues/7835 But I'm still a bit confused about the w

[ansible-project] Using variables from a notifying task in a handler

2014-06-19 Thread Peter Murray
I have a task that iterates over a dictionary of directory names to remove a file: - name: Remove conflicting XACML policy file: path=/opt/fedora/{{ item.key }}/data/blah.xml state=absent with_dict: installs notify: Reload XACML If the file is removed, a handler is required to res

[ansible-project] su works on Debian Lenny but not on Debian Wheezy

2014-06-19 Thread Holger Seidenberg
I have a strange problem with new wheezy machines on lenny ist works ansible backuppc -a ' whoami' -u seidenberg --su -k --ask-su-pass - SSH password: su password: ESTABLISH CONNECTION FOR USER: seidenberg REMOTE_MODULE command whoami EXEC ['sshpass', '-d6', 'ssh', '-C', '-tt', '-vvv', '

Re: [ansible-project] su works on Debian Lenny but not on Debian Wheezy

2014-06-19 Thread James Cammarata
It seems like it's waiting for the password prompt, due to the format of the prompt not matching what we're expecting. Could you execute the command via su on the system and report back what the password prompt is? We can open an issue for this as well and get the regex updated so it will match the

Re: [ansible-project] 10 lines in file

2014-06-19 Thread Michael Baydoun
Because an application is making changes to other parts of the file, and those changes need to be maintained. I can't overwrite what the application is doing. On Thursday, June 19, 2014 1:35:38 AM UTC-4, James Cammarata wrote: > > Why not use a template, or the assemble module? Both of those wo

Re: [ansible-project] 10 lines in file

2014-06-19 Thread Michael Baydoun
unfortunately, it's not that kind of file. It's a xml file for Oracle BI On Thursday, June 19, 2014 7:41:41 AM UTC-4, Michael Schultz wrote: > > Depending on the file, sometimes they support an include statement (e.g., > sudoers, apparmor, mysql, apache, ...) that you could assert lineinfile for

Re: [ansible-project] 10 lines in file

2014-06-19 Thread Michael Baydoun
on second thought, maybe I can do something like this in xml. I'll take a look into that. On Thursday, June 19, 2014 10:21:18 AM UTC-4, Michael Baydoun wrote: > > unfortunately, it's not that kind of file. It's a xml file for Oracle BI > > On Thursday, June 19, 2014 7:41:41 AM UTC-4, Michael Sc

[ansible-project] {"changed": false} on apt install, but install works fine when SSH'd in manually.

2014-06-19 Thread Patrick S
Hi, I'm trying to install openjdk-7-jdk on Ubuntu 14.04, however I'm running into a problem: When I run my playbook: - name: Install Java 6 sudo: yes apt: name=openjdk-6-jdk state=latest install_recommends=no I get: {"changed": false} Now if I SSH into my Vagrant box and do the usual sudo

Re: [ansible-project] {"changed": false} on apt install, but install works fine when SSH'd in manually.

2014-06-19 Thread Scott Sturdivant
Well, for starters, you're talking about installing openjdk-7, but your playbook is targeting openjdk-6... Typo? On Thu, Jun 19, 2014 at 9:05 AM, Patrick S wrote: > Hi, > > I'm trying to install openjdk-7-jdk on Ubuntu 14.04, however I'm running > into a problem: > > When I run my playbook: >

Re: [ansible-project] {"changed": false} on apt install, but install works fine when SSH'd in manually.

2014-06-19 Thread Patrick S
Indeed it is a typo- sorry. I've been trying both to see if there was any difference- however it occurs for both. On Thursday, 19 June 2014 16:27:25 UTC+1, Scott Sturdivant wrote: > > Well, for starters, you're talking about installing openjdk-7, but your > playbook is targeting openjdk-6... Ty

[ansible-project] Template value pairs vs. in-playbook value pairs difference

2014-06-19 Thread jepper
I have this inconsistency when I declare variable pairs used in a template vs. variable pairs used directly in a playbook e.g: Works in a template: group_vars/all fusemq_users: - { 'username': 'admin', 'password': 'admin', 'role' : 'admin' } role_name/templates/users.properties {% for line

[ansible-project] Accessing ec2.py dynamic inventory variables in templates

2014-06-19 Thread Roger Hunwicks
I'd like to access a variable set by the ec2.py dynamic inventory script in a Jinja2 template, but I can't work out how to do it. ec2.py returns a variable called ec2_tag_elasticbeanstalk_environment-name for EC2 instances that are part of an Elastic Beanstalk environment: ec2.py --host=ec2-54-

[ansible-project] Re: Accessing ec2.py dynamic inventory variables in templates

2014-06-19 Thread Roger Hunwicks
After further investigation... When the playbook runs, on that task I get: fatal: [ec2-54-196-159-144.compute-1.amazonaws.com] => {'msg': "unsupported operand type(s) for -: 'StrictUndefined' and 'StrictUndefined'", 'failed': True} If I define the variable in the group_vars file I get the same

[ansible-project] pass variable from ec2_eip to route53

2014-06-19 Thread Dan Vaida
Hello everyone! Since the 'include' doesn't work anymore with 'with_items', I am trying to do the following: ... - name: add EIP to the instance local_action: ec2_eip in_vpc=yes instance_id={{ item.id }} region={{ region }} with_items: ec2.instances register: eip - name: output the IP

[ansible-project] ping inside playbook

2014-06-19 Thread Laurent PETIT
Hello, I bootstrap server security from a bootstrap.yml playbook. Before restarting the ssh service, I'd like to test that it is possible to ssh into the host via the key mechanism (I have used the authorized_keys module for this purpose). I'm trying with the ping module as a task, but I'm not s

[ansible-project] Re: pass variable from ec2_eip to route53

2014-06-19 Thread Dan Vaida
Could it be something as easy as (route53.yml) ... - name: getting & showing all records matchig our stores local_action: route53 command=get zone={{ item.zone }} record={{ item.record }} type=A value={{ elasticip.public_ip }} with_items: - { record: '{{ comhost }}',

[ansible-project] Re: ping inside playbook

2014-06-19 Thread Laurent PETIT
instead of using user=xxx as an argument for the ping module, I use successfully the task remote_user attribute. But still, I'm unsure if the test works because I am already connected to the host, or because ansible is using the password I provided via the -k option 2014-06-19 18:21 GMT+02:00 La

[ansible-project] set a variable depending on the output of a task

2014-06-19 Thread Vasco Figueira
Hi all, I don't seem to find a way to do the following, which probably means I'm trying to do it in some weird way. --- # tasks/main.yml - name: check docker socket existence stat: path=/var/run/docker.sock register: docker_socket - name: set docker_url based on socket existence some-modu

Re: [ansible-project] Variable precedence and making roles work across distributions

2014-06-19 Thread Michael DeHaan
Never do this, ansible_pkg_mgr does not allow the with_items block to be grouped into a single yum/apt transaction, which results in much slower package installations. I understand why it's appealing, but really don't ... you'll also find that the yum and apt modules have different options you may

[ansible-project] Re: ping inside playbook

2014-06-19 Thread Laurent PETIT
no apparently I've still got this wrong 2014-06-19 18:29 GMT+02:00 Laurent PETIT : > instead of using user=xxx as an argument for the ping module, I use > successfully the task remote_user attribute. > > But still, I'm unsure if the test works because I am already connected to > the host, or bec

Re: [ansible-project] set a variable depending on the output of a task

2014-06-19 Thread Matt Martz
I believe what you are attempting should work. But you seem to be missing reference to the "set_fact" module in the second task. "some-moudle-that-sets-vars" is the "set_fact" module, and should do what you want. On Thu, Jun 19, 2014 at 11:35 AM, Vasco Figueira wrote: > Hi all, > > I don't se

[ansible-project] Re: su works on Debian Lenny but not on Debian Wheezy

2014-06-19 Thread Holger Seidenberg
Ok the command via su on Lenny seidenberg@backupPC:~$ su root -c /bin/bash -c echo SUDO-SUCCESS-piguunfptuenxfyxauqmavtunfzjnayk; LC_CTYPE=C LANG=C /usr/bin/python /home/seidenberg/.ansible/tmp/ansible-tmp-1403175187.6-175350529956768/command Password: and the command on wheezy seidenberg@se

Re: [ansible-project] Variable precedence and making roles work across distributions

2014-06-19 Thread Maciej Delmanowski
Will this work ok if I use apt: module directly instead? For different package lists in Debian and Ubuntu, for example. 19 cze 2014 18:49 "Michael DeHaan" napisał(a): > Never do this, ansible_pkg_mgr does not allow the with_items block to be > grouped into a single yum/apt transaction, which resu

Re: [ansible-project] Variable precedence and making roles work across distributions

2014-06-19 Thread James Cammarata
You can achieve pretty much the same thing by using group_by or conditional includes along with the variable structure you've defined, without loosing the benefits Michael mentioned. It should work fine with the apt or yum (or other package modules). On Thu, Jun 19, 2014 at 11:53 AM, Maciej Delm

[ansible-project] Re: GCE service account: "RSA key format is not supported"

2014-06-19 Thread Michael Lucas
On Friday, June 6, 2014 1:06:31 PM UTC-4, Eric Johnson wrote: > > > But do whack those credentials straight away! > > I should have mentioned, those credentials were changed for just that reason... altered many characters to obscure them, but left them the exact same length and format. Just upda

Re: [ansible-project] Re: Accessing ec2.py dynamic inventory variables in templates

2014-06-19 Thread Michael Peters
You can pull it from the hostvars dictionary with something like hostvars[inventory_hostname]['ec2_tag_elasticbeanstalk_environment-name'] On Thu, Jun 19, 2014 at 12:06 PM, Roger Hunwicks wrote: > After further investigation... > > When the playbook runs, on that task I get: > > fatal: [ec

Re: [ansible-project] Re: su works on Debian Lenny but not on Debian Wheezy

2014-06-19 Thread James Cammarata
Interesting, no obvious difference there. On Thu, Jun 19, 2014 at 11:53 AM, Holger Seidenberg < seidenberg.hol...@gmail.com> wrote: > Ok the command via su on Lenny > > seidenberg@backupPC:~$ su root -c /bin/bash -c echo > SUDO-SUCCESS-piguunfptuenxfyxauqmavtunfzjnayk; LC_CTYPE=C LANG=C > /usr/b

Re: [ansible-project] playbooks include statement

2014-06-19 Thread Marc Petrivelli
Turns out I make most of technical decisions based on spite:) But plays in playbooks can be tagged which are in turn composed of roles and tasks. It just seems you might want to "tag" a playbook as having a certain category of functionality. Basically I need to do this because I am trying to

Re: [ansible-project] Moving a docker instance between 2 hosts

2014-06-19 Thread Michael DeHaan
Right, I would agree. Build images with Ansible - stick in registry or wherever. "Cloud" thing may provide this. Have Ansible tell "cloud" scheduler how many images to deploy into "cloud" from registry. On Wed, Jun 18, 2014 at 12:28 PM, Drew Northup wrote: > On Wednesday, June 18, 2014 11

Re: [ansible-project] Playbook hanging on kernel update

2014-06-19 Thread Michael DeHaan
I'm not sure. Perhaps you could register a timestamp of the kernel or the last changed time of the kernel page, run the update, and then use a when statement to see if it changed? This could be a no-op statement that notified a reboot as the last action in your playbook. On Wed, Jun 18, 2014 at

Re: [ansible-project] basename of a list of files returned from 'with_fileglobs'

2014-06-19 Thread Michael DeHaan
Filters are that way, I don't think there needs to be a simpler way as filters work fine for this. On Wed, Jun 18, 2014 at 11:18 PM, Tovey, Mark wrote: > > > That got it! I figured that this shouldn’t be that difficult a thing > to accomplish and there must be a simpler way to achieve wh

Re: [ansible-project] fetch with_fileglob won't get files

2014-06-19 Thread Michael DeHaan
I'd perhaps run this with -vvv for starters, and then maybe show the command you are showing to show there aren't any files? On Thu, Jun 19, 2014 at 5:54 AM, Makimoto Marakatti wrote: > Hi all > > I have a play like this: > > --- > - hosts: group > sudo: True > gather_facts: no > tasks:

Re: [ansible-project] Trouble with using variables for ec2 tags

2014-06-19 Thread Michael DeHaan
Already got this on github, yes, but the problem is the 'environment' variable in Ansible is reserved. The "environment" keyword stores variables here. We may consider changing this to ansible_environment as this occasionally happens. On Thu, Jun 19, 2014 at 8:40 AM, Michael Peters wrote: >

Re: [ansible-project] Using variables from a notifying task in a handler

2014-06-19 Thread Michael DeHaan
This is unfortunately not possible. On Wed, Jun 18, 2014 at 3:08 PM, Peter Murray wrote: > I have a task that iterates over a dictionary of directory names to remove > a file: > > - name: Remove conflicting XACML policy > file: path=/opt/fedora/{{ item.key }}/data/blah.xml > state=

Re: [ansible-project] Template value pairs vs. in-playbook value pairs difference

2014-06-19 Thread Michael DeHaan
In one, you have fusemq_users as a list, in the other, you have a hash. If you are going to feed it a list, perhaps you want to use with_items, or otherwise, perhaps you want to reference the first element in the list. On Thu, Jun 19, 2014 at 10:31 AM, jepper wrote: > I have this inconsist

Re: [ansible-project] Re: ping inside playbook

2014-06-19 Thread Michael DeHaan
I've seen some interesting variations of: - local_action: shell ssh ... For those kinds of tests with keys, feeding it lots of SSH options. Be careful to launch a command like "echo" and not something interactive. On Thu, Jun 19, 2014 at 11:50 AM, Laurent PETIT wrote: > no apparently I've

Re: [ansible-project] Variable precedence and making roles work across distributions

2014-06-19 Thread Michael DeHaan
group_by is awesome. - hosts: webservers group_by: key=webservers_{{ ansible_os_family }} - hosts: webservers_RedHat roles: - ... On Thu, Jun 19, 2014 at 11:56 AM, James Cammarata wrote: > You can achieve pretty much the same thing by using group_by or > conditional includes along

Re: [ansible-project] Re: Accessing ec2.py dynamic inventory variables in templates

2014-06-19 Thread Michael DeHaan
Really we should probably replace all "-" with "_" in tag names so they can be cleanly used as variables. But then again, the tag had a "-" in it, so I'm not sure that's the right thing to do. Anyway, variables can't have "-" in them, which is why that happens, so it's easy to fix with a conventi

Re: [ansible-project] Re: Accessing ec2.py dynamic inventory variables in templates

2014-06-19 Thread Michael Peters
I thought about tackling this along with the proposed "downcase_facts" option for ec2.ini. Something like "normalize_facts" or some such so that anything that's not a letter or number gets converted to an underscore. Would default to false just like downcase_facts. On Thu, Jun 19, 2014 at 5:30 PM,

Re: [ansible-project] playbooks include statement

2014-06-19 Thread Michael DeHaan
" It just seems you might want to "tag" a playbook as having a certain category of functionality." You can tag individual plays, but not whole playbooks. Should be good enough. This will apply he the tag to all tasks (whether in roles or not) therein. On Thu, Jun 19, 2014 at 1:25 PM, Marc P

Re: [ansible-project] Re: Accessing ec2.py dynamic inventory variables in templates

2014-06-19 Thread Michael DeHaan
That seems reasonable to me. On Thu, Jun 19, 2014 at 4:33 PM, Michael Peters wrote: > I thought about tackling this along with the proposed "downcase_facts" > option for ec2.ini. Something like "normalize_facts" or some such so > that anything that's not a letter or number gets converted to a

Re: [ansible-project] fetch with_fileglob won't get files

2014-06-19 Thread Brian Coca
with_fileglob is running on the 'master' not on the target server, so unless they have the same files this won't work. you might want to run a shell: find + register a var for use in the fetch ​ -- You received this message because you are subscribed to the Google Groups "Ansible Project" group

Re: [ansible-project] fetch with_fileglob won't get files

2014-06-19 Thread Michael DeHaan
Yep, that's true! On Thu, Jun 19, 2014 at 4:45 PM, Brian Coca wrote: > with_fileglob is running on the 'master' not on the target server, so > unless they have the same files this won't work. > > you might want to run a shell: find + register a var for use in the fetch > ​ > > -- > You receiv

[ansible-project] Support for managing Windows guests is now available on the 1.7 development branch

2014-06-19 Thread Michael DeHaan
Hi everyone, We've just pushed some code that you might like. Ansible support for managing Windows machines! Read all about it here: http://www.ansible.com/blog/windows-is-coming http://docs.ansible.com/intro_windows.html Module discussion should happen on the development branch as we expand

[ansible-project] Something that seems simply yet can't get it to work

2014-06-19 Thread tb582
Hello, I'm new to Ansible: Here's what I'm looking to do for my first playbook/automation with it. I have a list of users, like below. Oh and by the way I'm running this on OSX. First of all where do I save this file? and what to a call it? anythingiwant.yaml? # List of uses - abc123 - def532

[ansible-project] assemble module with templates?

2014-06-19 Thread Ken Wong
Hi, I'm converting a bunch of my Puppet modules to Ansible and was wondering if, when using the "assemble" module, is there any way to also have template evaluation done at runtime? Or do I have to do this in 2 steps: a) use the template module to loop through my fragment templates and put the

Re: [ansible-project] assemble module with templates?

2014-06-19 Thread Michael DeHaan
Yep, call the template module for each fragment you make, then call assemble. There's really no notion of anything other than runtime. On Thu, Jun 19, 2014 at 2:30 PM, Ken Wong wrote: > Hi, > I'm converting a bunch of my Puppet modules to Ansible and was wondering > if, when using the "assem

Re: [ansible-project] Something that seems simply yet can't get it to work

2014-06-19 Thread Michael DeHaan
On Thu, Jun 19, 2014 at 12:37 PM, tb582 wrote: > Hello, I'm new to Ansible: Here's what I'm looking to do for my first > playbook/automation with it. > > I have a list of users, like below. Oh and by the way I'm running this on > OSX. First of all where do I save this file? and what to a call it?

[ansible-project] conditional options for the command module beyond creates, and removes

2014-06-19 Thread Michael Dur
I see a need for running a command remotely to determine whether a command play should be executed. There is a lot that 'creates', and 'removes' doesn't cover. I'd like to support file test operators and more. I realize this could be accomplished using a preceding command play that sets a va

[ansible-project] Re: su works on Debian Lenny but not on Debian Wheezy

2014-06-19 Thread Holger Seidenberg
ok what else can i do to investigate the problem ? Am Donnerstag, 19. Juni 2014 13:06:19 UTC+2 schrieb Holger Seidenberg: > > I have a strange problem with new wheezy machines > > on lenny ist works > > ansible backuppc -a ' whoami' -u seidenberg --su -k --ask-su-pass - > SSH password: > su