[ansible-project] Re: mangling include_role path

2019-02-22 Thread Dmitry Makovey
foo.yml == - include_tasks: "{{ top_pb_dir }}/roles/myrole/tasks/main.yml roles/myrole/tasks/main.yml == - debug: 'boo!' On Thursday, February 21, 2019 at 2:01:58 PM UTC-8, Dmitry Makovey wrote: > > I've set up a playbook that includes another playb

[ansible-project] mangling include_role path

2019-02-21 Thread Dmitry Makovey
I've set up a playbook that includes another playbook located under 'a/b/c' subdirectory. From that included playbook I do 'include_role' which fails since role is located at top level and not the sub-playbook level. What are the most common ways of mitigating this? sample (that doesn't work):

[ansible-project] Re: ansible yaml question for retries module

2018-10-24 Thread Dmitry Makovey
my first reaction would be to suggest looking into "until" loop structure. if your module can query for results reutrning some value, until will keep calling it until N retries run out or module will execute successfully On Wednesday, October 24, 2018 at 1:21:19 PM UTC-7, rd wrote: > > Hello, >

[ansible-project] "import_role" vs "roles"

2018-10-05 Thread Dmitry Makovey
Hi, I would like to clarify things relating to new "import_role" statement - documentation mentions it as a "new syntax" however it does not mention about the plans for the "roles" syntax. What's the plan moving forward. I see both statements as distinct entities, however some of my colleagues

[ansible-project] docker_login and GCR

2016-09-01 Thread Dmitry Makovey
is anyone using docker_login with Google Cloud Registry? I am attempting to do so by defining variable for auth token: gcloud_token_file: gcp_sa_account.json gcloud_token: "{{ lookup('file', gcloud_token_file) }}" and then trying to login: docker_login: username="_json_key" password="{{ gcloud_

[ansible-project] Re: use of enumerate() in Jinja templates [SOLVED]

2016-08-12 Thread Dmitry Makovey
discovered https://groups.google.com/forum/embed/#!topic/pocoo-libs/gDPqQiRBhdg which mentiones loop.index variable. That'll do for me. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails

[ansible-project] use of enumerate() in Jinja templates

2016-08-12 Thread Dmitry Makovey
Hi, is there a pattern for implementing loop similar to python: for (i,name) in enumerate(list_of_items): print i, name when I try to implement it in Jinja I get error (no enumerate is not available): {% for (i,name) in enumerate(list_of_items) %} item{{ i }} = {{ name }} {%endfor %} wh

[ansible-project] ansible 2.1.0 failures

2016-07-19 Thread Dmitry Makovey
I keep on stepping on the same issue that I do not believe I've ever had in pre-2.1.0 versions (mind you I've had long gap since list I've built playbooks... so my references could go as far back as 1.9) Here's the issue: - hosts: some_hosts gather_facts: False tasks: - block: - na

[ansible-project] Re: including roles from roles?

2016-07-19 Thread Dmitry Makovey
ncluding roles. Currently it doesn't seem possible to do with > dependencies. > > Any reason you think this wouldn't be implemented? Is it a technical > limitation or philosophical? > > On Monday, July 18, 2016 at 8:31:31 AM UTC-7, Dmitry Makovey wrote: >> >>

[ansible-project] Re: including roles from roles?

2016-07-18 Thread Dmitry Makovey
Don'g believe it is possible nor do I think it will be implemented. Currently you can get close approximation by using dependencies: http://docs.ansible.com/ansible/playbooks_roles.html#role-dependencies as far as looping over includes: => test.yml --- - hosts: all tasks: -

Re: [ansible-project] Run local dynamic inventory script against remote Fuel server

2016-07-18 Thread Dmitry Makovey
On Sunday, July 17, 2016 at 12:55:17 AM UTC-7, Rod Oliver wrote: > > Thanks for the reply, apologies for late response. > > I *think* the command "ssh user@fuel-server /path/to/fuel.py" attempts to > run the command "/path/to/fuel.py" on the fuel-server. In any case the > script fails. > would

[ansible-project] Re: add_host

2016-07-18 Thread Dmitry Makovey
add_host is meant to be used **runtime** thus it does not perform any operations making change persistent. Adding hosts to the inventory could be done via one of the "file" modules. On Sunday, July 17, 2016 at 5:02:26 AM UTC-7, Patrick van Haren wrote: > > I try to add a hos to my inventory wit

[ansible-project] Re: dynamically generated inventory (add_host) and playbook failures

2016-07-14 Thread Dmitry Makovey
On Thursday, July 14, 2016 at 1:22:20 PM UTC-7, J Hawkesworth wrote: > > Maybe setting a max failure percentage for the play would help? > > > http://docs.ansible.com/ansible/playbooks_delegation.html#maximum-failure-percentage > > I've not used maximum-failure-percentage myself so I don't know h

[ansible-project] dynamically generated inventory (add_host) and playbook failures

2016-07-14 Thread Dmitry Makovey
I'm building a playbook for patching our servers, however I keep on getting 2016-07-14 09:30:29,186 p=55840 u=dimon | PLAY [report] > ** > 2016-07-14 09:30:29,211 p=55840 u=dimon | ERROR! invalid host > (somerandomhost1.stanford

[ansible-project] Re: add_host madness... or role ...singletons??? what?

2015-06-11 Thread Dmitry Makovey
tested by moving add_host from role over to "tasks" - same result. Sounds like I'm missing the point someplace, but where? -- 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

[ansible-project] add_host madness... or role ...singletons??? what?

2015-06-11 Thread Dmitry Makovey
I've got a playbook in which I'm trying to use add_host to dynamically generate a group of hosts. Here's what I have: \roles \ group_servers \ tasks \ main.yml \ common \ tasks \ main.yml setup.yml ==> ./roles/group_my_servers/tasks/main.yml --- - name: Group My boxes add_h

[ansible-project] --private-key broken???

2015-06-11 Thread Dmitry Makovey
Hi, I'm trying to fire ansible from cron job and am failing as --private-key directive doesn't seem to have effect. I can replicate the issue from CLI as well. So to illustrate: $ ssh -i /home/ansible/.ssh/id_rsa_ansible_key r...@server.com hostname server.com $ /usr/bin/ansible-playbook --pr

[ansible-project] add_host and variable mass-population

2015-05-25 Thread Dmitry Makovey
I have a dilemma: I've got a module that can produce list of sites that given app is configured to serve, "app_info" which produces JSON output like this: "site_info": {

[ansible-project] ansible on android?

2015-01-04 Thread Dmitry Makovey
Has anybody ever tried to run ansible on android? I've attempted to set it up via Qpython's pip_consoly.py and it fails with install of pycrypto. System has pycrypto-2.5 pre-installed however I'm assuming ansible pulls in 2.6 -- You received this message because you are subscribed to the Google

Re: [ansible-project] Roles, tasks and composability

2015-01-02 Thread Dmitry Makovey
I believe I've got similar usecase except my starting point is different. I found that parametrized includes do exactly what I need so there's no issue with roles vs task includes. However while roles have a defined search path and allow for central repo of roles, includes can only be in the sam

[ansible-project] 'empty()' Jinja test?

2014-11-20 Thread Dmitry Makovey
Hi, several times now I came across situation where one of the modules returns 'empty list' in variable and it would be handy to have a simple test like: {% if foo is empty %} which is not the same as {% if foo is defined %} because former case covers also "", [], {} and None as well as "und

Re: [ansible-project] bug in "with_items" or misunderstanding?

2014-11-20 Thread Dmitry Makovey
So I have modified my playbook (see https://gist.github.com/droopy4096/98864a10359f5cf27bab ), then played with "|list" but the results of it were that all of sudden it grabs JSON string and walks through that string one char at a time, resulting in: changed: [undefined.host.com] => (item=[) =>

[ansible-project] bug in "with_items" or misunderstanding?

2014-11-19 Thread Dmitry Makovey
I have an inventory of hosts that defines "my_groups" hash: my_groups: group1=val1 group2=val2 ... Note - it's a dynamic inventory which in fact produces valid JSON that works otherwise. Then I try to use it to auto-populate groups via: - hosts: all tasks: - debug: var=hostvars[invent

Re: [ansible-project] Re: iterate over "failed" hosts?

2014-10-09 Thread Dmitry Makovey
On Wednesday, October 8, 2014 6:42:34 AM UTC-6, Michael DeHaan wrote: > > When Ansible playbooks fail, Ansible generates a retry file to limit a > playbook run to just failed hosts. > > You can use this file to just target those specific hosts. > I was thinking more "inline" kind of action. Whi

[ansible-project] Re: iterate over "failed" hosts?

2014-10-07 Thread Dmitry Makovey
BTW I did read http://docs.ansible.com/developing_api.html and http://jpmens.net/2012/12/13/obtaining-remote-data-with-ansible-s-api/ that provide fine examples of doing it via API code. I'm more curious whether I can sneak something in through the playbook... -- You received this message beca

[ansible-project] iterate over "failed" hosts?

2014-10-07 Thread Dmitry Makovey
I've got an interesting case: playbook is failing on certain hosts either due to SSH connection issues or because some things are not installed. I realize that I should really just write a playbook that makes all my machines "compliant" with the playbook and then re-run it. However I am curious

Re: [ansible-project] blanket-apply delegate_to to roles

2014-10-07 Thread Dmitry Makovey
On Sunday, October 5, 2014 12:02:21 PM UTC-6, Michael DeHaan wrote: > > What you have above, say if you had 500 hosts, would run each step 500 > times and likely overwhelm that server. > > actually that is the intent. My example was "simplified" so it's easy to understand mechanics of it, but o

[ansible-project] blanket-apply delegate_to to roles

2014-10-03 Thread Dmitry Makovey
I've got a case where I'd like to delegate contents of entire role over to another box. Adding "delegate_to" to every task seems strenuous and not reusable since I may use this role without delegation. My attempt at simulating what is done with { role: X, tags: A } did not succeed: $ cat roles

[ansible-project] shortcuts for OpenStack operations

2014-07-23 Thread Dmitry Makovey
I have finally gottent my first OpenStack "node creation" playbook which in fact turned out rather nice, once I looked at source code ;) I have found out that names used in OpenStack component creation routines from ansible will be considered "unique" and ansible will happily provide me with ne

Re: [ansible-project] locations for the "lookup('file'...)

2014-07-23 Thread Dmitry Makovey
On Wednesday, July 23, 2014 4:12:12 PM UTC-6, Michael DeHaan wrote: > > It looks relative to the playbook root, and if in roles, will look in the > "files/" dir of roles. > I've noticed that it does look in role's "files" dir but apparently it doesn't look at playbook root. Is there a paramete

[ansible-project] locations for the "lookup('file'...)

2014-07-23 Thread Dmitry Makovey
Hi, I'm trying to get through my "slow" day here - can't figure out (or locate documetation explaining it) - where does "lookup('file',...)" looks indeed. I have a structure: group_vars/all.yml pgsql_key pgsql_key.pub roles/pgsql/tasks/main.yml site.yml under all.yml I have var defined: ... pg

Re: [ansible-project] --skip-tags equivalent inside playbooks

2014-07-11 Thread Dmitry Makovey
On Wednesday, July 9, 2014 4:50:55 PM UTC-6, Michael DeHaan wrote: > > "Now the other question: would it be reasonable to ask for such feature > then? " > > It would not :) > > I think it makes much more sense to explicitly tag things. > > For instance, think of flickr.com and I tag all pictures i

Re: [ansible-project] --skip-tags equivalent inside playbooks

2014-07-09 Thread Dmitry Makovey
On Wednesday, July 9, 2014 1:49:16 PM UTC-6, Michael DeHaan wrote: > > Correct. > > Tags in playbooks apply tags to tasks. > > --tags means "run the things that are so tagged" > --skip-tags means the opposite > darn. May I suggest some clarification for the documentation then? The way it is writ

[ansible-project] --skip-tags equivalent inside playbooks

2014-07-08 Thread Dmitry Makovey
Hi everybody, http://docs.ansible.com/playbooks_tags.html mentions several ways to use tags, one of which is: - { role: A, tags: [t1, t2] } however cli interface allows for inversion via --skip-tags (which is great BTW) and there's no mention of it's equivalent in playbooks. so in short: "--

[ansible-project] "recycling" script output in a playbook

2014-07-03 Thread Dmitry Makovey
Hi, I've got a script that can produce JSON output and would like to register that output as a variable. I know it sounds lot like module but it isn't. It's a generic tool that can operate with or without ansible. I have come across one post http://jpmens.net/2012/08/30/ansible-variables-var

Re: [ansible-project] include search path from a "roled" play

2014-06-26 Thread Dmitry Makovey
I'm facing somewhat similar challange, with a workaround - I've used the full-path expression, but in my case I have single template that is used for 2 roles. So I assumed one role to be primary and store such template and the other role is using roles/my_pri_role/templates/foo.j2 I guess for c

Re: [ansible-project] breaking up complex playbook into pieces

2014-06-26 Thread Dmitry Makovey
On Wednesday, June 25, 2014 6:12:43 PM UTC-6, Michael DeHaan wrote: > > having a site.yml that includes a webservers.yml and a dbservers.yml is in > fact a reasonable thing to do if you want a quick shorthand to just run a > part of your infrastructure through Ansible. > how do I get around th

Re: [ansible-project] sample playbook demonstating openstack usage?

2014-06-26 Thread Dmitry Makovey
On Wednesday, June 25, 2014 6:18:41 PM UTC-6, Michael DeHaan wrote: > > "I'm looking for some sample playbooks using most of OpenStack modules. > I've attempted building my own but found that certain things are unclear to > me (like how do I get image id after it's creation to be used with > n

Re: [ansible-project] Re: looping over set of tasks (roles?)

2014-06-26 Thread Dmitry Makovey
On Thursday, June 26, 2014 12:40:45 PM UTC-6, Nick Evgeniev wrote: > It's not about being that careful but rather about getting to predictable > result as soon as possible. > > As I mentioned warming up of java program is a complex thing and depends > heavily on jvm version/ switches as well as

[ansible-project] Re: looping over set of tasks (roles?)

2014-06-25 Thread Dmitry Makovey
does that mean you're running cross-host function that takes params from A and B and returns value on B? And you expect certain value on B before you move forward? I'm not an expert but it doesn't seem to be Ansible domain. Maybe Fabric would be a better fit? -- You received this message becau

[ansible-project] sample playbook demonstating openstack usage?

2014-06-25 Thread Dmitry Makovey
I'm looking for some sample playbooks using most of OpenStack modules. I've attempted building my own but found that certain things are unclear to me (like how do I get image id after it's creation to be used with nova_compute invocation later, etc.) Quantum module seems to be the most straigh

[ansible-project] breaking up complex playbook into pieces

2014-06-25 Thread Dmitry Makovey
Hi, I've got my playbook large enough now that whenever I want to execute only bits of it I either have to code-in lots of conditionals and "special" variables or do some other trickery. I've got things split out into roles, so that my main file site.yml looks like: - hosts: all roles: - r

Re: [ansible-project] multiple async actions (background tasks) question

2014-06-25 Thread Dmitry Makovey
Sorry for being unclear - I meant that I can implement above functionality either via ansible (albeit I have no clue on how to make certain things run in the background as per my question) or write a script that does all of that and have a single ansible statement like this: - shell: reconfigur

[ansible-project] multiple async actions (background tasks) question

2014-06-23 Thread Dmitry Makovey
Hi, I'm trying to reconfigure a running OS to use bridge vs the actual interface. My playbook so far: - name: copy bridge config template: src=if-br.j2 dest=/etc/sysconfig/network-scripts/if-{{ bridge_name }} backup=yes - name: copy interface config template: src=if-nic.j2 dest=/etc/sysconf

Re: [ansible-project] variables and their (multiple layer) resolution

2014-06-17 Thread Dmitry Makovey
On Tuesday, June 17, 2014 6:48:58 AM UTC-6, Michael DeHaan wrote: > > There was a ticket raised (possibly by you) recently that recursion in > Jinja2 templates does not appear to be a thing. Since I think that's > filed already, we should be good to go, but I would consider this as > somethi

[ansible-project] Jinja var resolution bug? (Was: Re: variables and their (multiple layer) resolution)

2014-06-16 Thread Dmitry Makovey
Looks like it's some sort of problem with templates, consider this simplified playbook: roles/keystone/tasks/main.yml: --- - name: test template template: src=template.j2 dest=/tmp/template.txt - name: test simple var debug: var=simple_var - name: test nested var debug: var=nested_var

[ansible-project] Re: variables and their (multiple layer) resolution

2014-06-16 Thread Dmitry Makovey
Shall I assume that below is a bug? On Friday, June 13, 2014 2:45:09 PM UTC-6, Dmitry Makovey wrote: > > I have a playbook, and in one of the templates I need to walk over all the > hosts in certain groups grabbing their hostvars etc. > > I followed http://docs.ansible.c

[ansible-project] variables and their (multiple layer) resolution

2014-06-13 Thread Dmitry Makovey
I have a playbook, and in one of the templates I need to walk over all the hosts in certain groups grabbing their hostvars etc. I followed http://docs.ansible.com/faq.html and everything seems to work as expected but with one quirk: In template I have: {% for host in groups['nova'] %}

Re: [ansible-project] with_items and array concatenation?

2014-06-04 Thread Dmitry Makovey
Thanks Matt and Adam! Winning combination turned out to be: ( groups['A']+groups['B'] ) | unique I do like how simple it looks vs ( groups['A']|union (groups['B']))| unique since in my case I have more groups to add and it is very simple with "+" and less error-prone. -- You received this

Re: [ansible-project] with_items and array concatenation?

2014-06-04 Thread Dmitry Makovey
thanks to your hint I'm one step closer: - name: group A & B shell: echo {{ item }} >> /tmp/log with_items: groups["A"] + groups["B"] however I still can't figure out how to make a "set" out of the result. -- You received this message because you are subscribed to the Google Groups "Ansibl

Re: [ansible-project] with_items and array concatenation?

2014-06-04 Thread Dmitry Makovey
nice try - but no dice: fatal: [192.168.0.138] => with_items expects a list or a set FATAL: all hosts have already failed -- aborting I even played a bit and checked python syntax making it: groups['A'].extend(groups['B'])|set with or without last "list" filter with original syntax or with my

[ansible-project] with_items and array concatenation?

2014-06-04 Thread Dmitry Makovey
Hi, I've got a usecase where I'd like to iterate over several servers based on groups, so task looks like: - name: group A & B shell: echo {{ item }} >> /tmp/log with_items: - groups["A"] - groups["B"] so what I get in /tmp/log is: groups['A'] groups['B'] Now, eliminating either grou

[ansible-project] Re: Initial setup of a FreeBSD VPS

2014-06-02 Thread Dmitry Makovey
IMO doing #6 first is only couple of seconds difference, so if you instantiate your server and do above steps all from within the same playbook - for somebody to hit your machine before you tighten the rules *and* guess the password would be incredibly lucky, not to mention that port scanning u

Re: [ansible-project] Idempotency and cleanups

2014-05-23 Thread Dmitry Makovey
On Friday, May 23, 2014 6:16:28 AM UTC-6, Michael DeHaan wrote: > > No config system really handles "this shall not be X". > sounds like NixOS is doing that. Granted their config management is built into the OS giving it some advantages in tracking state. > FWIW, this nothing to do with "ide

[ansible-project] Re: loops and variables

2014-05-23 Thread Dmitry Makovey
Why not "with_nested"? as per ams: - name: fetch files from the server fetch: src={{ item }} dest=/backup/{{ item[1] }}/{{ inventory_hostname }}/{{ item[0] | basename }} with_nested: - [ /root/.bash_profile, /some/other/file ] - group_names better yet

[ansible-project] Re: Thinking about more modules -- what monitoring systems do you use?

2014-05-22 Thread Dmitry Makovey
xymon is missing. you can feed it cli commands to add/remove hosts etc. -- 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...@googlegrou

[ansible-project] Idempotency and cleanups

2014-05-21 Thread Dmitry Makovey
I've tried to research the subject a bit via Google searches but nothing useful came up. So here I am, seeking collective wisdom. Hypothetical scenario: using ansible playbook I set up machines A, B and C with services s1 (A), s2 (A), s3 (B), s4 (C). Playbook allows for modification of "hosts"

Re: [ansible-project] Re: Intelligent loop for yum packages installation

2014-05-12 Thread Dmitry Makovey
I realize that this will probably qualify for non-Ansible way, but here's how I had to resolve similar issue: 1. split playbook into "install" and "setup" whereas install is ran only once in a while if you need to change list of packages installed etc. - resolves issues with RHN etc. setup can

Re: [ansible-project] freebsd buildworld/buildkernel crashes host OS ??

2014-05-12 Thread Dmitry Makovey
For posterity: I've tracked down the issue - it was FreeBSD's UFS "Journaling" that was crashing things. Looks like ansible was able to thrash system well enough to expose issues with that FS feature. After disabling it - things seems to be running as expected. -- You received this message bec

[ansible-project] Re: variable names of variables holding environment variables :)

2014-05-12 Thread Dmitry Makovey
after tinkering with above idea I've got things working exactly how I wanted. Thanks for the tip! -- 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-pro

[ansible-project] Re: variable names of variables holding environment variables :)

2014-05-12 Thread Dmitry Makovey
that sounds like something I need. 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

[ansible-project] variable names of variables holding environment variables :)

2014-05-10 Thread Dmitry Makovey
I know subject sounds kind of crazy, but here's the code to explain it a bit: - hosts: all vars: - djbdns_var: FOO: "DJ DNS" - vnstat_var: FOO: "VN, stat!" tasks: - name: Test flexible vars command: echo "$FOO" environment: "{{ item }}_var" with_items: - dj

[ansible-project] Re: Defining a list inside variable file, to allow for jinja loops for that list

2014-05-05 Thread Dmitry Makovey
On Monday, May 5, 2014 7:27:57 AM UTC-6, greg cox wrote: > > It seems as though this is not possible, but it could really allow for > using jinja's looping function. I realize the with_items functionality, > but I would like to use both at the same time, it would greatly simplify my > templat

Re: [ansible-project] Dynamically change the order of hosts ansible runs on

2014-05-02 Thread Dmitry Makovey
Add to that creation of dynamic group from hosts or ips: https://coderwall.com/p/cz-pjw and you can populate your "head_node" group early in playbook and then play by Michael's suggestion for full nirvana :) -- You received this message because you are subscribed to the Google Groups "Ansible

Re: [ansible-project] freebsd buildworld/buildkernel crashes host OS ??

2014-05-02 Thread Dmitry Makovey
the worst thing has happened - my last re-run went through just fine. ;) I do not like "inconsistent" but have no idea what is happening and why. I did update playbook but not the section that was "crashing". I'll dig deeper next time problem surfaces. I'll probably be re-running playbook with

Re: [ansible-project] freebsd buildworld/buildkernel crashes host OS ??

2014-05-02 Thread Dmitry Makovey
On Friday, May 2, 2014 11:56:24 AM UTC-6, Michael DeHaan wrote: > > Any logs available? > nothing that would identify the culprit. I'm re-running the playbook at the moment to test some other aspects of it. if anything pops up - I'll post here. The thing is - ansible just "sits there" while

[ansible-project] freebsd buildworld/buildkernel crashes host OS ??

2014-05-01 Thread Dmitry Makovey
Hi, I am trying to automate "jail" creation under FreeBSD which includes building the OS from sources which is rather lengthy. I'm using "polling" while doing it: - name: build world shell: executable=/bin/sh chdir=/usr/src SRCCONF={{ build_conf }} make buildworld > /tmp/build.log 2>&1 #

Re: [ansible-project] "cannot yet run check mode against old-style modules" ??

2014-01-10 Thread Dmitry Makovey
On Friday, January 10, 2014 9:29:13 PM UTC-7, Matt Martz wrote: > > The issue you reference (5151) is the resolution. > > If you do not want to update to ansible 1.5 (devel) yet, you have 1 other > option. > > Instead of using the following in the module: > > from ansible.module_utils.basic impo

[ansible-project] "cannot yet run check mode against old-style modules" ??

2014-01-10 Thread Dmitry Makovey
ansible-1.4.1 exhibits this problem on Fedora. Doing things by the book ( http://docs.ansible.com/developing_modules.html#check-mode ): module = AnsibleModule( argument_spec = dict(...), supports_check_mode=True ) if module.check_mode: # Check if any changes would be made by don't ac

Re: [ansible-project] module development and 'with_items'

2014-01-06 Thread Dmitry Makovey
On Monday, January 6, 2014 6:02:45 PM UTC-7, Michael DeHaan wrote: > > This is really a topic for ansible-devel, BTW > > should I be filing a github issue or [re]post to ansible-devel then? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. T

Re: [ansible-project] module development and 'with_items'

2014-01-06 Thread Dmitry Makovey
I think I've got it: http://pastebin.com/NCgAhVjF now works with: - name: Testing Foo dicts foo: name: one: 1 two: 2 three: 3 state: present - name: Testing Foo lists foo: name: [ 1, 2, 3] state: present - name: Testing Foo lists

Re: [ansible-project] module development and 'with_items'

2014-01-06 Thread Dmitry Makovey
thanks for the pointer. Now *that* makes sense why I couldn't find anything in the modules themselves. It also means that unless I hack that file I'm not getting my module to behave similarly. Is there another way to join operations into a single transaction short of passing their parameters

[ansible-project] Re: module development and 'with_items'

2014-01-06 Thread Dmitry Makovey
BTW - if there's a better alternative to 'with_items' - I'm all for it, just didn't see anything close to it -- 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] module development and 'with_items'

2014-01-06 Thread Dmitry Makovey
I'm playing with my module and would like to cram most operations into one transaction under 'with_items' according to the docs 'yum' and 'apt' modules can combine multiple operations generated by 'with_items' into one. However I'm a bit puzzled as to what is causing it to behave that way. htt

[ansible-project] Re: best way to rotate ansible logs?

2013-12-19 Thread Dmitry Makovey
g'ah! should've been "best way"... can't type today -- 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

[ansible-project] bets way to rotate ansible logs?

2013-12-19 Thread Dmitry Makovey
I like the fact that sticking log_path = ./my-log.log into ansible.cfg gives me nice history of actions I can [re]visit later. However with larger playbooks and increased number of actions (and with increased verbosity) log becomes rather large quite fast. So finding heads and tails of each

Re: [ansible-project] Yum Local Install Variable

2013-12-13 Thread Dmitry Makovey
> Also...I understand your point, but as far as "natively"...the > documentation says that it supports installing from a local RPM. Also, I > need to build the RPM manually on the box due to the fact that they > (fusionIO) do not offer a pre-built RPM version for the kernel version that > I

Re: [ansible-project] roles an funky playbooks

2013-12-13 Thread Dmitry Makovey
> Even though they are sub directories to A & B, don't > inherit anything (as in, they don't get vars from the parent role > because there's no such thing). They are fully separate roles. not nitpicking, but out of curiosity - why then when I first call B role var gets substituted for B/i

Re: [ansible-project] Re: struggling with loops

2013-12-13 Thread Dmitry Makovey
On Friday, December 13, 2013 9:46:51 AM UTC-7, Michael DeHaan wrote: > > When ansible gets a list of lists, with_items will talk over them all as > one list. > > This is so you can install packages from multiple lists in one > transaction, which is a very common use case. > > You can also walk

[ansible-project] Re: struggling with loops

2013-12-12 Thread Dmitry Makovey
found solution, but not the explanation: - hosts: all vars: - hello: - [[ 'Hello', 'world' ]] - [[ 'Goodbye', 'people' ]] tasks: - name: Testing loop shell: echo {{ item.0 }} {{ item.1 }} with_items: hello why do I need to double-bracket arrays? Or to put it another way:

[ansible-project] struggling with loops

2013-12-12 Thread Dmitry Makovey
Hi, I'm trying to loop over a list of arrays but I seem to be picking up each array element instead of entire array on each pass: - hosts: all vars: - hello: - [ 'Hello', 'world'] - [ 'Goodbye', 'people'] tasks: - name: Testing loop shell: echo {{ item[0] }} {{ item[1] }}

Re: [ansible-project] roles an funky playbooks

2013-12-12 Thread Dmitry Makovey
On Thursday, December 12, 2013 7:13:28 AM UTC-7, James Martin wrote: > > Dmitry, > > Can you explain what you mean in more detail "if prior to call to > B/install tasks I call B tasks - "foo" gets populated with > /roles/B/vars/main.yml, otherwise it picks up /group_vars/all". > > Examples of

Re: [ansible-project] roles an funky playbooks

2013-12-11 Thread Dmitry Makovey
I like the nested stuff, thanks for the pointer! However I believe I stepped on a bug there: if I define variable "foo" in /group_vars/all and /roles/B/vars/main.yml interesting thing happens: if prior to call to B/install tasks I call B tasks - "foo" gets populated with /roles/B/vars/main.y

Re: [ansible-project] roles an funky playbooks

2013-12-11 Thread Dmitry Makovey
that's an interesting idea - didn't realize roles can be nested like that. tags have one disadvantage: out of multiple you can't exclude one - instead you have to enumerate the rest. so if project already has some tags things become less.. clear. -- You received this message because you are su

[ansible-project] Re: A bit of lightweight entertainment

2013-12-11 Thread Dmitry Makovey
brilliantly funny :) -- 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. For more options, visit https://groups.goog

[ansible-project] roles an funky playbooks

2013-12-11 Thread Dmitry Makovey
Hi, I have a usecase for split-playbook but I still want to maintain it all under the same structure. In my case I'd like to split two phases "install" and "configure" but retain most of the vars etc. between two. What I was thinking is having something like: install.yml config.yml roles \_A

[ansible-project] Re: module development: freestyle parameters

2013-12-11 Thread Dmitry Makovey
thanks guys. I ended up developing specialized module in the end based on yum as repoquery used in yum module has problem with passing params to yum plugins. Well it was worth a try :) -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsu

Re: [ansible-project] files/ vs roles/foo/files . Can I use both?

2013-12-11 Thread Dmitry Makovey
On Wednesday, December 11, 2013 1:58:36 AM UTC-7, David Karban wrote: > > you can reference files with inventory_dir like: > copy: src={{ inventory_dir }}/files/my_file > > Assuming you always read from top level files and not from role files dir. > If you want to read from role or files depen

[ansible-project] files/ vs roles/foo/files . Can I use both?

2013-12-10 Thread Dmitry Makovey
I have a situation where I have files locateed in /files (top-level) and would like to use them within certain roles to avoid duplication. However ansible tells me it can't find referenced file. Do I need to turn a knob or should I just copy same files into diff roles or for any common files

Re: [ansible-project] module development: freestyle parameters

2013-12-02 Thread Dmitry Makovey
On Friday, November 29, 2013 9:26:41 AM UTC-7, Michael DeHaan wrote: > > I'm thinking it might be better to be more explicit, and have something > like: > > extra_yum_flags="--foo asdf --bar xyz" > IMO it makes things a bit less consistant (since half of options are passed normally via args an

[ansible-project] module development: freestyle parameters

2013-11-28 Thread Dmitry Makovey
Hi, I'm trying to extend yum module to allow passing some "extra" options to it that are provided by some of the yum plugins. I would rather avoid enumeration of all possible options (some I don't even know what they will be!) What is the best way to reflect "freestyle" options like that in mo