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
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):
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,
>
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
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_
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
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
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
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:
>>
>>
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:
-
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
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
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
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
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
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
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
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": {
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
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
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
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=[) =>
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
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
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
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
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
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
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
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
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
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
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
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:
"--
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
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
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
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
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
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
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
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
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
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
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
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
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
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'] %}
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
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
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
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
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
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
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
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
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"
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
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
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
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
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
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
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
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
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
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
#
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-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
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
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
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
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
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
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
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
> 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
> 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
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
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:
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] }}
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
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
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
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
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
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
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
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
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
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
91 matches
Mail list logo