[ansible-project] Indempotency goal hard to reach, can this be done with dict, lists, nested lists?

2014-04-02 Thread Marko Lisica
Hi I came into a problem while I was trying to make this role work. - name: add db mysql_db: name={{ item.user }} state=present with_items: users - name: add user mysql_user: name={{ item.user }} host=localhost password={{ mysql_pass }} state=present priv={{ item.db }}.*:ALL

[ansible-project] Re: Another way to set the mysql root password

2014-04-02 Thread Marko Lisica
IMHO, as long as this works for you it is okay. On Tuesday, April 1, 2014 5:49:36 PM UTC+2, Patrick Ogenstad wrote: I've just gotten started with Ansible. I must say it's ridiculously simple. :) I've created a few playbooks and was setting up mysql. The module documentation mentions

[ansible-project] Git module, can prompt for entering password ?

2014-04-02 Thread linbo liao
Hi, For security issue, I want to enter password when clone git repository. Like -k parameters for ansible-playbook command, is it possible? Thanks, Linbo -- You received this message because you are subscribed to the Google Groups Ansible Project group. To unsubscribe from this group and

Re: [ansible-project] Ansible conditions and logics

2014-04-02 Thread Maxim Odinintsev
Hello, Yes, you understand correctly. How can I synchronize files on remote node (not from local host to remote) ? Thank you. If I understand correctly, you're copying the contents of several directories to a central location, removing the old path, and then creating a symlink to the new

Re: [ansible-project] Ansible conditions and logics

2014-04-02 Thread Maxim Odinintsev
Hello, I'm tried make it over ansible, but in final, i think much easiest way is using script module. If someone interesting, when i tried it, i'm used this construction for getting files attributes and states: - name: Getting files stats stat: path={{ item }} register: st with_items:

[ansible-project] mysql_user priv problem

2014-04-02 Thread Marko Lisica
Hello, I have a task that reads user and db and grants permisions on specific db for specific user. https://gist.github.com/markotitel/9931850 Problem is that only last DB from list is granted for specific user. I have same task with same vars for folder creation and it works fine.

[ansible-project] Re: mysql_user priv problem

2014-04-02 Thread Marko Lisica
UPDATE: Here is debug msg from mysql task that looks fine, so I guess something about mysql_user module may be odd. ok: [vagrant] = (item=({'webdir': ['woodpecker', 'aligator'], 'user': 'detlic'}, 'aligator')) = { item: [ { user: detlic, webdir: [

[ansible-project] Run role based on local facts - if variable is not defined.

2014-04-02 Thread Marcin Prączko
Good morning. I am trying using local facts for tracking version of the role, and run this role only if version increased (version kept locally within role comparing with version from local fatcs). So this is how is working: Role folder - vars/main.yml - tasks/main.yml So this is example

[ansible-project] Json and local facts.

2014-04-02 Thread Marcin Prączko
Hi, I am working on some tasks related with local facts and not sure whether followig issue is a bug or is designed. Following ansible documentation localfacts can be in JSON or INI format. I've choosen JSON format - is much more easier to write variables like this: module: name: apache

[ansible-project] Re: Ansible conditions and logics

2014-04-02 Thread Marcin Prączko
Hi, I think that you have to find best way which works for you. For example I have to setup quite a lot munin symlinks for checks which depends of server role. 1. Running this via ansible was really slow and caused quite complicated solution in terms of map links to roles. 2. So I decided

Re: [ansible-project] FYI on Ubuntu 14.04 and synchronize module

2014-04-02 Thread Michael DeHaan
Synchronize module does not work going TO Ubuntu 14.04 from anything older than Ubuntu 14.04 See http://rsync.samba.org/issues.html and search for io.c On Tue, Apr 1, 2014 at 4:54 PM, Simon Green simonjgr...@me.com wrote: Done. https://github.com/ansible/ansible/issues/6809 On Monday, 31

[ansible-project] Re: mysql_user priv problem

2014-04-02 Thread Marko Lisica
I am sorry for spamming like this but just got into my mind to try something: - name: grant privileges on databases raw: mysql -e grant all privileges on {{ item.1 }}.* to {{ item.0.user}}@localhost with_subelements: - users - db this task works as expected, and I beleive this

[ansible-project] dealing with Redis and it's rewritten configuration files

2014-04-02 Thread Bryan Larsen
How do people generally set up Redis through ansible? Right now we're using the fairly standard approach of templating the configuration files, and using a notify handler to restart redis whenever the configuration file changes. The problem with this is that Redis often rewrites its

[ansible-project] how to refactor a play consisting of multiple roles into a single role?

2014-04-02 Thread Gallagher Polyn
I'd like to convert a playbook consisting of several (3) roles into a role (the playbook: github.com/leucos/ansible-rbenv-playbook). It seems odd that I would flatten the several roles back into plays, but I haven't seen examples of a role consisting of roles. What is the recommended approach

Re: [ansible-project] dealing with Redis and it's rewritten configuration files

2014-04-02 Thread C. Morgan Hamill
Excerpts from Bryan Larsen's message of 2014-04-02 08:42:55 -0400: The problem with this is that Redis often rewrites its configuration files; for example when a new master is elected. I haven't actually used Ansible to set up Redis, but I have run into software that does this, and I would

[ansible-project] Re: Ansible 1.5.4 Security Update

2014-04-02 Thread Michael DeHaan
BTW, Credit for this find should go to Alan Fairless of SpiderOak.comhttp://spideroak.com/ - Alan was remarkably helpful in isolating and testing. We have some fans of their cloud backup features. --Michael On Tue, Apr 1, 2014 at 5:36 PM, Michael DeHaan mich...@ansible.com wrote: Today

Re: [ansible-project] dealing with Redis and it's rewritten configuration files

2014-04-02 Thread Bryan Larsen
Thanks for your suggestions. I think my approach will be to use the template file to create the configuration only if it doesn't exist, and then use config set/rewrite to set any configuration variables that may change over the project lifetime. Ansible 1.6 includes some more options to the

Re: [ansible-project] how to refactor a play consisting of multiple roles into a single role?

2014-04-02 Thread Michael DeHaan
Having a play map server roles to a host group is pretty simple: - hosts: webservers roles: - role_a - role_b - role_c Some users may like role dependencies but they are usually overkill, and I don't use them hardly ever myself. (It is true of course that a role doesn't consist of

Re: [ansible-project] Re: mysql_user priv problem

2014-04-02 Thread Michael DeHaan
Yep, probably is. I think you filed a ticket on this earlier today, so we're good to go. (If you'd like to attempt a fix or further debugging, that would be welcome too!) On Wed, Apr 2, 2014 at 8:41 AM, Marko Lisica titelskib...@gmail.com wrote: I am sorry for spamming like this but just

Re: [ansible-project] Run role based on local facts - if variable is not defined.

2014-04-02 Thread Michael DeHaan
Python (and Jinja) practices short circuit evaluation. So move the is defined test ahead of the numeric test, and you should be ok. On Wed, Apr 2, 2014 at 8:04 AM, Marcin Prączko marcin.prac...@gmail.comwrote: Good morning. I am trying using local facts for tracking version of the role,

Re: [ansible-project] Git module, can prompt for entering password ?

2014-04-02 Thread Michael DeHaan
It's not presently possible to pass a password to the git module. We'd be totally open to feature additions for this, though the argument should be optional and marked with no_log=True such that it's not tracked in syslog and elsewhere. On Wed, Apr 2, 2014 at 4:50 AM, linbo liao

Re: [ansible-project] Re: Another way to set the mysql root password

2014-04-02 Thread Peter Gehres
The way we do it it to register a variable on the installation of mysql and set the root password when: mysqlInstall|changed On Wed, Apr 2, 2014 at 1:02 AM, Marko Lisica titelskib...@gmail.com wrote: IMHO, as long as this works for you it is okay. On Tuesday, April 1, 2014 5:49:36 PM UTC+2,

[ansible-project] apt returns msg: No package matching...

2014-04-02 Thread Todd Sampson
The apt module returns: *msg: No package matching 'nypa-comtrade-mod' is available* when I try to install a .deb package *that I made*. Here's the playbook: *---* *- hosts: server1* * sudo: True* * user: dfr* * remote_user: dfr* * tasks:* * - name: install nypa-comtrade-mod* *apt:

[ansible-project] Re: remote_user task override not working

2014-04-02 Thread Tonatiuh IIII
I have the same problem, don't know why, this should be working. I would really appreciate some help there. On Wednesday, March 19, 2014 10:31:58 AM UTC-6, Bernat Ràfales wrote: Hi, I have a playbook in which I need to run tasks with different remote users. This is what the main playlist

[ansible-project] Tagging a newly created VPC

2014-04-02 Thread Chinmaya Patanaik
Hi, I created a vpc using ec2_vpc module. Now after the VPC is being created, I would like to tag it using ec2_tag module. --- - name: Playbook to create an AWS VPC hosts: local connection: local tasks: - name: Creating a VPC action: module: ec2_vpc state:

[ansible-project] ssh_args as group_vars?

2014-04-02 Thread Tobias Wolter
Hey there, does someone know if it's possible to define ssh_args as a group_var or something similar? The issue I'm currently facing is that I want to selectively enable SSH agent forwarding, without maintaining any alternate configuration file overhead. (i.e. goal is just works, no thinking

[ansible-project] How do I stage a configuration change?

2014-04-02 Thread Alex King
Hi, I'm new to ansible but liking what I see so far. I'm using it to configure a bunch of machines acting as routers across a region, and I like the model so far. Now I'm trying to set up a couple of machines as a staging environment so I can check out configuration changes before I push them

Re: [ansible-project] Working with dicts

2014-04-02 Thread Premanand Chandrasekaran
Thanks for the pointer. I was missing the vars section. The following works as expected: --- - hosts: all vars: users: alice: name: Alice Appleworth telephone: 123-456-7890 bob: name: Bob Bananarama telephone: 987-654-3210 remote_user: root

Re: [ansible-project] Tagging a newly created VPC

2014-04-02 Thread James Cammarata
You should use the wait=yes (or wait: yes in the form you've specified above) option to tell Ansible to wait until the VPC is in the available state before returning. On Wed, Apr 2, 2014 at 4:49 AM, Chinmaya Patanaik patanaikchinm...@gmail.com wrote: Hi, I created a vpc using ec2_vpc

[ansible-project] Running remote playbooks within a play

2014-04-02 Thread herby . gillot
Purely out of curiosity, what is the suggested course of action to run playbooks present on a remote host within a current run of a local Ansible play? The worst case being to use the shell module to actually exec Ansible remotely with the remote playbook, are there more elegant approaches?

[ansible-project] Problem with the ec2_tag module

2014-04-02 Thread Stephen Gargan
I'm having trouble with boto and the ec2_tags module I'm hoping someone will know what is up. I'm spinning up an ec2 instance and then immediately calling the ec2_facts and ec2_tags to grab data to configure the instance. The creation and ec2_facts work without a problem, but the ec2_tags

Re: [ansible-project] Problem with the ec2_tag module

2014-04-02 Thread C. S.
Try having the module run locally on an instance that is in an IAM role that has perms to update the tags on other instances. Boto should then get the credentials automatically from the metadata. That's been working well for us. On Apr 2, 2014, at 10:51 , Stephen Gargan steve.gar...@gmail.com

Re: [ansible-project] Ansible and openstack questions

2014-04-02 Thread Patrick Galbraith
Thanks Michael, I actually found a bug (region wasn't being supplied to nova client Client()) in the code and submitted a pull request to the nova_compute driver. My very simplistic example that now works with my fix, using HP Cloud, is the following: # Creates a new VM and attaches to a

[ansible-project] Best way to debug developing ansible modules

2014-04-02 Thread Patrick Galbraith
Hi all, I'm relatively new to ansible though I have been working on the nova_compute module and trying to try some ideas that I want to implement and have been trying to find the best way to debug code. Probably not the most elegant but certainly simplistic is the print() statement, which when

Re: [ansible-project] How do I stage a configuration change?

2014-04-02 Thread Michael DeHaan
I would not recommend using a seperate branch unless there are seperate versions of the product, branching is great for versions, not great for environments. Differences in environment should be modelled by differences in group_variables where possible -- and possibly in a slightly different top

Re: [ansible-project] Re: remote_user task override not working

2014-04-02 Thread Michael DeHaan
Sounds like you are saying the remote_user on the task attribute is not overriding the remote_user on the host. If you see this behavior on 1.5.3 and later, can you please check to see if you see this behavior on the development branch, and if so, file a bug? Thank you! On Wed, Apr 2, 2014

Re: [ansible-project] ssh_args as group_vars?

2014-04-02 Thread Michael DeHaan
-c ssh will read options from your SSH config so that may be an option. It is not possible to set at group variable level presently, though patches for this would probably be considered* * = but probably not actively worked on, given the above solution is possible. On Tue, Apr 1, 2014 at

Re: [ansible-project] Running remote playbooks within a play

2014-04-02 Thread Michael DeHaan
Calling Ansible with Ansible? There is no suggested course of action, but I suspect you would do exactly that. I'd really want to understand the *why* though. On Wed, Apr 2, 2014 at 1:32 PM, herby.gil...@gmail.com wrote: Purely out of curiosity, what is the suggested course of action to

Re: [ansible-project] Ansible and openstack questions

2014-04-02 Thread Michael DeHaan
Yep, saw your ticket -- thanks. Some testing on this to make sure it doesn't break normalish OpenStack while fixing your case might be welcome if possible, should someone want to give it a shot. On Wed, Apr 2, 2014 at 3:39 PM, Patrick Galbraith p...@patg.net wrote: Thanks Michael, I

Re: [ansible-project] Best way to debug developing ansible modules

2014-04-02 Thread Michael DeHaan
Best way to develop and hack on modules is the ./hacking/test-module script in the checkout. It can run a module and if you print things it will still give you output. You can either use print based debugging (and remove them later) or even can insert debuggers. Here's some info on how I

[ansible-project] Different group vars based on the inventory, aka staging vs prod

2014-04-02 Thread Kalman Speier
Hi, I have a repository with the same structure as the best practiceshttp://docs.ansible.com/playbooks_best_practices.html#directory-layout in the docs, with two inventory files (staging and production). My question is that how can I control the differences between those environments (stage

[ansible-project] Re: mysql_user priv problem

2014-04-02 Thread Marko Lisica
Hi, I would gladly fix it but dont know programming much, I am ultimate noobster. On Wednesday, April 2, 2014 1:09:32 PM UTC+2, Marko Lisica wrote: Hello, I have a task that reads user and db and grants permisions on specific db for specific user.

[ansible-project] Facts Broken EC2 hostname Changed Format

2014-04-02 Thread Demetri Mouratis
I have been using Peter Sankauskas's excellent netflixoss-ansible repo successfully for the past few months. Starting sometime yesterday, the ansible-playbook invocations started failing with the following error: TASK: [base | Copy rc.local template] *

Re: [ansible-project] dealing with Redis and it's rewritten configuration files

2014-04-02 Thread Brian Coca
I would use custom fact script on each target that queries locally to see if it 'is master', put it in /etc/ansible/facts.d and it will run automatically on gather facts. I would make sure only 1 master appears when going over the facts, then you can just feed it to the template from the 'fact'

[ansible-project] Re: Facts Broken EC2 hostname Changed Format

2014-04-02 Thread Demetri Mouratis
As is always the case, once I wrote out the problem I quickly found the solution. Downgrading to ansible 1.5.3 from https://launchpad.net/~rquillo/+archive/ansible fixes the issue. On the initial ansible play, I now see output from playbook saying it correctly interpolated the vars: PLAY

Re: [ansible-project] Problem with the ec2_tag module

2014-04-02 Thread Stephen Gargan
Thanks for the reply, the instance is created with an iam profile with very open permissions and its on this instance that the ec2_tag module is running. If I look at the metadata on the host i do see credentials for the profile curl

[ansible-project] What is the best way to run a playbook after provisioning?

2014-04-02 Thread Michael Lieberman
I have a provision playbook: https://gist.github.com/mlieberman85/c144fcc384cfcdc992d8 and the last line of it doesn't work because roles can't be variables I guess. Also there's no way to conditionally include playbooks only task files. What is the best practice to have a single provision set

[ansible-project] Re: Facts Broken EC2 hostname Changed Format

2014-04-02 Thread Demetri Mouratis
Bug report: https://github.com/ansible/ansible/issues/6832 -- 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...@googlegroups.com. To

Re: [ansible-project] Running remote playbooks within a play

2014-04-02 Thread herby . gillot
So let’s say you have the following situation: - You have some sizable number of hosts, with some particular software that contains its own set of playbooks. - There may be differences in the software versions, and thus playbooks can differ between sets of these remote hosts.