Re: [ansible-project] play_hosts - only when current_host == localhost

2014-07-07 Thread sturban
What should current_host be replaced with so that the below only runs for 
the host localhost? 

---

- hosts: all

 sudo: yes

 tasks:

 - name:play_hosts
  debug: var=play_hosts
   when: current_host == localhost





-- 
Xtratherm Limited is a limited company registered in Ireland. Registered 
number: 331130. Registered office: Kells Road, Navan, Co. Meath. Directors: 
D.E. Hynes, E.J. Hynes, S.K. Steenson, J. Keegan, B. Rafferty, T. Hynes. 
VAT Registration: IE6351130B
Xtratherm UK Limited is a limited company registered in England and Wales. 
Registered number: 4404208. Registered office: Holmewood Industrial Park, 
Park Road, Chesterfield, Derbyshire S42 5UY. VAT Registration: GB787574856
Please note that [Xtratherm Limited/Xtratherm UK Limited] may monitor 
e-mail traffic data and content of e-mail for the purpose of security and 
training.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b676a295-5431-4d3a-8e7a-053f61a3afa4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] play_hosts - only when current_host == localhost

2014-07-07 Thread Brian Coca
when: inventory_hostname == 'localhost'​

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CADn%2BHswjCB54ezyf5uBxb2x9Jmc0iNvTm%2BSYAXbmNE5%2BZQ_i6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] sudo not working for me (Mac OS X Mavericks)

2014-07-07 Thread Mauricio Tavares
On Sat, Jul 5, 2014 at 11:50 AM, Michael Martinez
mmartinez...@gmail.com wrote:
 I am a new ansible user and I can not get the sudo option working for me.

 To keep things simple, I am just trying a simple command: shutdown -r
 now

 In ansible, I am entering it as:  ansible system_name -a shutdown -r now
 --sudo  -sudo-user myAdminUser

 I have tried this many ways and can not get it working.

  Anything in the Mac's log files (system.log and secure.log)? The
Mac also have a console gui that shows all the log files.

 --
 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 post to this group, send email to ansible-project@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/8e60e4ec-9e25-4b27-81c4-52fbd746a98e%40googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAHEKYV6Q2ETW8e5vpYuWz%2BB4rv%3Dyg6fnt8d7YaLvRNy_VOsEGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Need advise on define inventory-specific variables

2014-07-07 Thread Chengbing Liu
I'm using Ansible to deploy and maintain Hadoop clusters.

I used to define variables in group_vars/all as shown below:

hadoop:

 # Variables for core-site.xml
   nameservice: hadoop-namenode

 # Variables for hdfs-site.xml
   dfs_blocksize: 256m

 # Variables for mapred-site.xml
   mapred_job_tracker: hadoop-jobtracker:8021



However, I have different inventory files, which makes it prone to mistakes.

I can define variables using [all:vars] in inventory files:

[all:vars]
 hadoop_nameservice=hadoop-namenode

 

How can I define inventory-specific variables, while still preserving the 
structured definition as in group_vars/all?

Thanks a lot!

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a62a724b-d9db-4bb0-980d-91efff5c869b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] docker module

2014-07-07 Thread Paul Durivage
Docker images in private repos should have be accessed by the private
repo's FQDN, for example:

docker.example.com/myimage:tag

When pulling by this image name, it's implied that the registry is at
docker.example.com and is accessible to the Docker host.  It looks like the
Docker module makes mention of API usernames and passwords, implying that
it has the capability to authenticated against hub.docker.io and any
registry that uses the index/hub authentication.  I'd have to look through
the source code to be sure, but I think that's what it's doing.  The docker
image module doens't have this capability.

At any rate, check out what auth mechanism you're using on your private
index, check that the docker host has access to the registry.

For what it's worth, I use the docker module to work against my private
registry, and it works without issue.


On Sun, Jul 6, 2014 at 3:39 PM, Mark Olliver 
mark.olli...@infectiousmedia.com wrote:

 Hi,

 Is there a way to pass the docker-module a set of parameters so that it
 can login to a repository to download private repos. Currently I have it
 downloading public ones ok but I can not get our private ones to pull.

 Thanks

 Mark

 --
  MARK OLLIVER HEAD OF IT OPERATIONS
   T. +44(0) 20 7775 5628   [image: Infectious Media] 3-7 Herbal Hill /
 London / EC1R 5EJwww.infectiousmedia.com   [image: Infectious Media]
 http://www.infectiousmedia.com/   [image: Facebook]
 http://www.facebook.com/infectiousmedia [image: Twitter]
 https://twitter.com/infectiousmedia [image: LinkedIn]
 http://www.linkedin.com/company/infectious-media-ltd [image: Youtube]
 http://www.youtube.com/user/InfectiousMediaLtd   This email and any
 attachments are confidential and may also be privileged. If you are not
 the intended recipient, please notify the sender immediately, and do not
 disclose the contents to another person, use it for any purpose, or
 store, or copy the information in any medium. Please also destroy and
 delete the message from your computer.

  --
 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 post to this group, send email to ansible-project@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/CALKPxXiL-ZfSK4zp7kR-6ZQQrYb115AQbC49h3MND-eN-v6-4A%40mail.gmail.com
 https://groups.google.com/d/msgid/ansible-project/CALKPxXiL-ZfSK4zp7kR-6ZQQrYb115AQbC49h3MND-eN-v6-4A%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAK6JQEFLz%3DR6W4ROHoFdCJLF-8Z8uF5N-0FTujKtD37-y0zAxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Windows Support Stage 2: Engage Battlestations!

2014-07-07 Thread David Carmean

What I'm primarily interested in is being able to use Ansible as a Vagrant 
provisioner on Win7 hosts.  At the moment I'm kind of resigned to running 
it locally on the VM, though, as I'd have to do with Packer anyway.




On Thursday, July 3, 2014 3:10:18 PM UTC-7, Michael DeHaan wrote:

 A while back we introduced some Windows support on the devel branch.

 http://docs.ansible.com/intro_windows.html
 http://docs.ansible.com/list_of_windows_modules.html
 http://www.ansible.com/blog/windows-is-coming


 

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c81da360-f2d6-46a7-89b0-14cdabed44f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Conditional Includes, Roles and Multiple Playbooks

2014-07-07 Thread Ryan Garrett
I am trying to figure out the structure for how I am going to use Ansible 
and am having some design issues.

I would like to have multiple playbooks in my roles, each with a subset of 
tasks I need to be done. E.g. - a playbook for System Updates, a playbook 
for deploying our app, a playbook for building a system.

Right now, I have playbooks in place with conditional includes in each 
roles main.yml file. 

In my books/ directory I have my playbook for each role, and here is an 
example of the whole series of playbooks:

*// books/dev.yml*
---
- hosts: dev
  serial: 1
  roles:
   - common-dev

*// roles/common-dev/tasks/main.yml*
---
- include: build.yml
  when: pbook == build

- include: update.yml
  when: pbook == update

*// roles/common-dev/tasks/update.yml*
---
- name: Update Kernel
  yum: name=kernel* state=latest
  register: kernup
  sudo: yes

- name: Update glibc
  yum: name=glibc* state=latest
  register: glibcup
  sudo: yes

- name: Update everything else
  yum: name=* state=latest
  sudo: yes

- name: Rebooting Server
  command: /sbin/reboot
  when: kernup|changed or glibcup|changed
  sudo: yes

So, when I run ansible-playbook, I include --extra-vars=pbook=update, for 
example. It works great, but I get 'skipping' for every task out of the 
build.yml playbook. I would really like to suppress this, if at all 
possible. I know what the tasks are not running, but I am afraid of causing 
confusion as I hand off the actual running of the playbooks to other folks. 
Is there some better way to be handling this? I really don't want to have 
to build a role structure out for every grouping of tasks I want to do on a 
system to avoid confusion but keep it as simple as possible for the other 
folks running my books (e.g. just passing an extra-var rather than running 
an entirely different playbook with entirely different roles for each group 
of tasks).

Any thoughts or advice would be great on how to either suppress the 
messages or restructure it to accomplish my goal but still be somewhat 
intuitive without me having to create a new role for every set of tasks I 
want to do (dev-update, dev-build, etc)

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...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/adef651b-4f1e-4c4c-b111-35a520954767%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Windows Support Stage 2: Engage Battlestations!

2014-07-07 Thread Michael DeHaan
We're not really looking to implement running Ansible from Windows, this is
about managing Windows remotes.




On Mon, Jul 7, 2014 at 11:08 AM, David Carmean dlcarm...@gmail.com wrote:


 What I'm primarily interested in is being able to use Ansible as a Vagrant
 provisioner on Win7 hosts.  At the moment I'm kind of resigned to running
 it locally on the VM, though, as I'd have to do with Packer anyway.





 On Thursday, July 3, 2014 3:10:18 PM UTC-7, Michael DeHaan wrote:

 A while back we introduced some Windows support on the devel branch.

 http://docs.ansible.com/intro_windows.html
 http://docs.ansible.com/list_of_windows_modules.html
 http://www.ansible.com/blog/windows-is-coming




 --
 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 post to this group, send email to ansible-project@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/c81da360-f2d6-46a7-89b0-14cdabed44f1%40googlegroups.com
 https://groups.google.com/d/msgid/ansible-project/c81da360-f2d6-46a7-89b0-14cdabed44f1%40googlegroups.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwfHMXZ9kA%3DKsg0MonEH-fRnAYx6h2wTfLth1muuH-Qgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Impact of merging hashes

2014-07-07 Thread Mehul Ved
Hi,
  I am setting up a system using ansible where my configuration values
are defined in defaults/main.yml. If the user wants to override it,
they will edit vars/main.yml with the same dictionary structure. e.g.

$ cat defaults/main.yml
app:
  port: 1
  workers: 10

$ cat vars/main.yml
app:
  port: 2

So, now my configuration will be:
app:
  port: 2000
  workers: 10

To do this, I set hash_behaviour=merge in my ansible.cfg. This does
work as expected. But, I am not sure if it'll cause me any trouble
going ahead or add unnecessary complexity? Is it safe to go ahead with
this setting as long the whole deployment code will be maintained by
me?

-- 
With Regards,
Mehul Ved

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CADTL0oZ0-fyDFEz5RbaD2EoPZv49ucWFej0%2Bt92fTKHPNTzmEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] dict/hash-layout question

2014-07-07 Thread stibbons . peter
Hi,
I'm kind of new to Ansible and I haven't really gotten the terminology down 
yet, so I hope you'd bear with me.

I've got a task which loops through a bunch of disks and performs a set of 
operations on them. The placeholders/keys (CRS,DATA,FRA) are names on a 
sort of logical volumes which should use the disks listed under them.
The construct is loaded via group_vars or host_vars and looks like this:
---
   crs:
 - {disk: /dev/sdc, label: CRS01}
 - {disk: /dev/sdd, label: CRS02}
   data:
 - {disk: /dev/sdd, label: DATA01}
 - {disk: /dev/sde, label: DATA02}
   fra:
 - {disk: /dev/sdg, label: FRA01}
 - {disk: /dev/sdh, label: FRA02}
 - {disk: /dev/sdi, label: FRA03}

The task that uses it accesses it like so:

  - name: Blerg
shell: Use {{ item.disk }}  and set label={{ item.label }}  
with_items: 
   - {{ crs }}
   - {{ data }}
   - {{ fra }}


This works fine but I really dont like to have the names (CRS etc) in the 
loop as they potentially could be called anything.

So what I would like to be able to do is to have something like this, and 
just call 'storage_layout' with a with_something so I dont have to 
hard-code the volume-names.

storage_layout:   
crs:
  - {disk: /dev/sdc, label: CRS01}
  - {disk: /dev/sdd, label: CRS02}
data:
  - {disk: /dev/sde, label: DATA01}
  - {disk: /dev/sdf, label: DATA02}
fra:
  - {disk: /dev/sdg, label: FRA01}
  - {disk: /dev/sdh, label: FRA02}
  - {disk: /dev/sdi, label: FRA03}


Is this even possible, and what would it potentially look like? 

I've tried with 'with_dict' but that seems to only accept 1 entry/key, like 
this.

storage_layout:   
crs:
   {disk: /dev/sdc, label: CRS01}
data:
   {disk: /dev/sde, label: DATA01}
fra:
   {disk: /dev/sdg, label: FRA01}



Thanks!
/Peter


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5744820d-dccd-4045-b60f-7fdab8287087%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Search for EC2 Instances by Tag

2014-07-07 Thread Michael DeHaan
Have you perhaps hand-edited (or someone has) ec2.py?




On Fri, Jul 4, 2014 at 1:19 PM, Scott Anderson scottanderso...@gmail.com
wrote:

 Very strange, that's right in the middle of a docstring. No reason for it
 to break like that.

 What does the result of /usr/bin/env python --version say?

 Regards,
 -scott


 On Thursday, July 3, 2014 5:13:48 PM UTC-4, Dan Chan wrote:

 I have a handful of existing EC2 instances with a specific tag that I
 would like to target and execute Ansible against. What is the best way to
 go about this?

 I tried to use the ec2.py script for EC2 Dynamic Inventory, but ran into
 issues when trying to execute the script.

 dchan $ chmod +x ec2.py
 dchan $ ansible -i ec2.py us-east-1 -m ping
   File /ec2.py, line 292
 region '''
  ^
 IndentationError: expected an indented block

 Is there something I'm doing wrong with the ec2.py script? I'm also
 unsure about how to incorporate the script into my playbook.
 Are there any existing modules that I could utilize to solve my problem?

 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...@googlegroups.com.
 To post to this group, send email to ansible-project@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/a07247b9-b69a-491a-857a-34f814157cdb%40googlegroups.com
 https://groups.google.com/d/msgid/ansible-project/a07247b9-b69a-491a-857a-34f814157cdb%40googlegroups.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwmoXRO0K87mbwkkFbmMfu4xg91SrrrfgNVGjtGsBTMNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] play_hosts

2014-07-07 Thread Michael DeHaan
  with_items: groups['all']

I wouldn't.   I'd use the host loop since it's already there.

- hosts: all
  tasks:
- local_action: ...





On Sun, Jul 6, 2014 at 11:03 AM, Brian Coca brianc...@gmail.com wrote:

 you already have a play_hosts variable with the 'current active hosts' in
 the play​, but it will be reset every play.

 In this case I would just rewrite the play to use:

   with_items: groups['all']

 --
 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 post to this group, send email to ansible-project@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/CADn%2BHsxi1Xc2-BPmxfese12yCrWviigwXS7XsMPxbCM6ey%2BoOQ%40mail.gmail.com
 https://groups.google.com/d/msgid/ansible-project/CADn%2BHsxi1Xc2-BPmxfese12yCrWviigwXS7XsMPxbCM6ey%2BoOQ%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgw_sMfbV5BuJSNZ3HyMaMi9jW7R6endhy8viLKnzsxjPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] on_failure error handlers - any ideas

2014-07-07 Thread Michael DeHaan
Hi Amr,

Thanks very much for the contribution - we do have some specific ideas
about what this would look like syntax wise and are planning on making
something that requires a bit less boilerplate.

As such, we are probably going to close your pull request.

I have some ideas on what this should look like, but we want to get in a
bit of refactoring first so I don't think the time is to dive into this
right now.

That being said, this should come, and is a good idea - just want something
a bit more try/catch block like.

Hope this makes sense!



On Sun, Jul 6, 2014 at 9:19 AM, Amr Ali amrena...@gmail.com wrote:

 Hi guys,

 i have been using Ansible for about a month now, my use case has been
 managing a client's cluster and moving all the infrastructure management to
 Ansible, so far i'v been loving it.. but i was working on new server
 deployment playbooks and was faced with the fact that there is no
 universal way to handle errors.. and we have to use
 ignore_erros/register/when which is fine for 1 or 2 tasks.. but if you want
 for example to rollback a deployment of a new server on failure - delete
 the new instance - revert any changes on other hosts - remove it from
 loadbalancers.. ect, you are gonna end up with one ugly and cluttered
 playbook..

 so i thought i'd give it a shot and write something to mimic the behavior
 of notify handlers but for errors, and have it trigger them per task not at
 the end of the playbook although this could be also done - it just didnt
 seem fitting for most use cases

 anyway i just did my first pull request :
 https://github.com/ansible/ansible/pull/8043

 This is the first time i work with python and i loved it too, so thanks
 ansible for giving me the opportunity to finally get my hands dirty with
 python :) but this also means that i might have done this the wrong way..
 or it could be improved.

 i know this feature has been somewhat in demand, so i'd love to hear what
 you guys think, and how can we improve this?

 Amr

 --
 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 post to this group, send email to ansible-project@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/572f464b-bab7-48ef-b6be-f284f90b655c%40googlegroups.com
 https://groups.google.com/d/msgid/ansible-project/572f464b-bab7-48ef-b6be-f284f90b655c%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzXJGF3FZ2xTV%3DTVPqH-O%3DXGWmjda0Y5nT_CONkFuFtTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Need advise on define inventory-specific variables

2014-07-07 Thread Michael DeHaan
Perhaps I'm not understanding the question, but:

group_vars/all
group_vars/groupname1
group_vars/groupname2

etc

This can be used with multiple inventory files if group_vars is a directory
in the directory with both of them, which should be what you need.

Let us know if this doesn't make sense and perhaps I can elaborate further.

Thanks!


On Mon, Jul 7, 2014 at 12:11 AM, Chengbing Liu lcbabc12...@gmail.com
wrote:

 I'm using Ansible to deploy and maintain Hadoop clusters.

 I used to define variables in group_vars/all as shown below:

 hadoop:

 # Variables for core-site.xml
   nameservice: hadoop-namenode

 # Variables for hdfs-site.xml
   dfs_blocksize: 256m

 # Variables for mapred-site.xml
   mapred_job_tracker: hadoop-jobtracker:8021



 However, I have different inventory files, which makes it prone to
 mistakes.

 I can define variables using [all:vars] in inventory files:

 [all:vars]
 hadoop_nameservice=hadoop-namenode



 How can I define inventory-specific variables, while still preserving the
 structured definition as in group_vars/all?

 Thanks a lot!

 --
 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 post to this group, send email to ansible-project@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/a62a724b-d9db-4bb0-980d-91efff5c869b%40googlegroups.com
 https://groups.google.com/d/msgid/ansible-project/a62a724b-d9db-4bb0-980d-91efff5c869b%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwf5iZU-CdxaHRJnVsH0_ez8JPzYPy1h1m5qXoMwyDDwQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Impact of merging hashes

2014-07-07 Thread Michael DeHaan
I generally view it as over-complicated for most folks, but it is a
supported thing and won't bite :)




On Mon, Jul 7, 2014 at 11:58 AM, Mehul Ved mehul.n@gmail.com wrote:

 Hi,
   I am setting up a system using ansible where my configuration values
 are defined in defaults/main.yml. If the user wants to override it,
 they will edit vars/main.yml with the same dictionary structure. e.g.

 $ cat defaults/main.yml
 app:
   port: 1
   workers: 10

 $ cat vars/main.yml
 app:
   port: 2

 So, now my configuration will be:
 app:
   port: 2000
   workers: 10

 To do this, I set hash_behaviour=merge in my ansible.cfg. This does
 work as expected. But, I am not sure if it'll cause me any trouble
 going ahead or add unnecessary complexity? Is it safe to go ahead with
 this setting as long the whole deployment code will be maintained by
 me?

 --
 With Regards,
 Mehul Ved

 --
 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 post to this group, send email to ansible-project@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/CADTL0oZ0-fyDFEz5RbaD2EoPZv49ucWFej0%2Bt92fTKHPNTzmEQ%40mail.gmail.com
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgx1Q_CNj-FqG3%2BTLBnANbkuMbJeBv4jGsuz%3DR%3DpjRbUFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] dict/hash-layout question

2014-07-07 Thread Michael DeHaan
It seems like you're going to need another type of iterator (lookup plugin)
that doesn't exist to traverse these, akin to something like a
with_dict_items or something.

I don't know your use cases, but another option might be to just make the
data and fra stuff a element inside the hash.

  - name: Blerg
shell: Use {{ item.disk }}  and set label={{ item.label }} 
with_items: storage_config
when: item.category in [ 'fra', 'crs', 'data' ]

etc?


On Mon, Jul 7, 2014 at 3:20 PM, stibbons.pe...@gmail.com wrote:

 Hi,
 I'm kind of new to Ansible and I haven't really gotten the terminology
 down yet, so I hope you'd bear with me.

 I've got a task which loops through a bunch of disks and performs a set of
 operations on them. The placeholders/keys (CRS,DATA,FRA) are names on a
 sort of logical volumes which should use the disks listed under them.
 The construct is loaded via group_vars or host_vars and looks like this:
 ---
crs:
  - {disk: /dev/sdc, label: CRS01}
  - {disk: /dev/sdd, label: CRS02}
data:
  - {disk: /dev/sdd, label: DATA01}
  - {disk: /dev/sde, label: DATA02}
fra:
  - {disk: /dev/sdg, label: FRA01}
  - {disk: /dev/sdh, label: FRA02}
  - {disk: /dev/sdi, label: FRA03}

 The task that uses it accesses it like so:

   - name: Blerg
 shell: Use {{ item.disk }}  and set label={{ item.label }} 
 with_items:
- {{ crs }}
- {{ data }}
- {{ fra }}


 This works fine but I really dont like to have the names (CRS etc) in the
 loop as they potentially could be called anything.

 So what I would like to be able to do is to have something like this, and
 just call 'storage_layout' with a with_something so I dont have to
 hard-code the volume-names.

 storage_layout:
 crs:
   - {disk: /dev/sdc, label: CRS01}
   - {disk: /dev/sdd, label: CRS02}
 data:
   - {disk: /dev/sde, label: DATA01}
   - {disk: /dev/sdf, label: DATA02}
 fra:
   - {disk: /dev/sdg, label: FRA01}
   - {disk: /dev/sdh, label: FRA02}
   - {disk: /dev/sdi, label: FRA03}


 Is this even possible, and what would it potentially look like?

 I've tried with 'with_dict' but that seems to only accept 1 entry/key,
 like this.

 storage_layout:
 crs:
{disk: /dev/sdc, label: CRS01}
 data:
{disk: /dev/sde, label: DATA01}
 fra:
{disk: /dev/sdg, label: FRA01}



 Thanks!
 /Peter


  --
 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 post to this group, send email to ansible-project@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/5744820d-dccd-4045-b60f-7fdab8287087%40googlegroups.com
 https://groups.google.com/d/msgid/ansible-project/5744820d-dccd-4045-b60f-7fdab8287087%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgx8YR6zoN4JCxV0iYo64xHgDbMBQtaCdCPo1bUA%3DDKjCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] 2014 Ansible Community Survey

2014-07-07 Thread Michael DeHaan
Hi everyone,

It's time for another community survey.  This one is much shorter than last
time, and should probably take  you 5 minutes.

We'll use the result of this to know what features everyone is using most,
among other things, which helps greatly with decision making and knowing
who are the people in the neighborhood.

There are also a few free form questions for those that wish to share more
freeform info.

Help with the survey is greatly appreciated.  Thank you very much!


  Survey link:  https://www.surveymonkey.com/s/VLNZYTR


--Michael

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzRjHb%2BFAb-moHmwFbuknyvwUiriDt%3D4fwhATwKfcZX9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.