Have a look at
http://www.ansibleworks.com/docs/playbooks_roles.html#role-dependencies
There's a meta variable to allow for duplicates, but AFAIK, that only works
within one role dependency tree, while your case has two (B and C).
Maybe you can make that work with a role D which depends on B and C
Hi,
I'm trying to do a special kind of nesting loop, using the item of the
first loop in the second loop:
- name: Prepare OSDs
shell: ceph-deploy osd prepare {{ item[0] }}:{{ item[1] }}
with_nested:
- groups['ceph-ODSs']
- hostvars[item[0]]['disks']
I'm not sure if this is possible,
Hi,
2013/12/10 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 in
Well, I did not come to whine only. Most people who have started using
Ansible see the potential, hence why we use it. I have offered my help too,
I do not see the point of your comment.
Ansible does not look mature enough because it does not do thing that
older, more stablish tools do. It woul
Michael,
That was not meant as an offence at all, what is wrong with pointing out
thing s that don't go like expected? I am giving feedback about my
experience, other people may turn their back and go back to other tools.
I really do not understand this attitude of 'don't tell me my child is
I see that 1.4.1 is in the EPEL extras, I obtained it and installed 1.4.1.
and as it has been said, it works fine with that version.
Many thanks to al for your help and comments!
On Wednesday, 11 December 2013 10:36:39 UTC+1, Guillem Liarte wrote:
>
> Michael,
>
> That was not meant as an offe
On Wednesday, 11 December 2013 10:56:50 UTC+1, Guillem Liarte wrote:
>
> I see that 1.4.1 is in the EPEL extras, I obtained it and installed 1.4.1.
> and as it has been said, it works fine with that version.
>
> Many thanks to al for your help and comments!
>
>
> On Wednesday, 11 December 2013
Have a look at the with_subelements lookup plugin.
On 11 December 2013 09:53, Guillaume Subiron wrote:
> Hi,
>
> I'm trying to do a special kind of nesting loop, using the item of the
> first loop in the second loop:
>
> - name: Prepare OSDs
> shell: ceph-deploy osd prepare {{ item[0] }}:{{ i
Le 13/12/11 11:18, Serge van Ginderachter claviotta :
> Have a look at the with_subelements lookup plugin.
I know very well with_subelements, but in this case I'm not trying to
access a subelement in the first element, I'm trying to use the first
element to access an entry in an other dictionary.
Before we dive into a technical solution let me understand your use case
and what you are modelling a bit better.
So groups['ceph-ODSs'] would be all machines in the ceph-ODSs group.
I'd probably just define a variable like "disks" on the group, but I'm
unclear why that wouldn't work in your case
It's possible that our duplicates filter needs a little tweaking, I'll let
James Cammarata reply here, though I will point out that it's designed that
roles with different parameters (i.e. dependencies with different
parameters) do need to get re-evaluated.
On Wed, Dec 11, 2013 at 3:01 AM, Serg
Heh, ansible does quite a lot of things other tools do *NOT* do. Does
that make them look less mature? Absolutely not. They have different
feature sets.
Recursive copy is already available, and also there is the synchronize
module.
I strongly suggest you refrain from making or defending such
I'm glad you've figured this out now.
It always helps to ask questions first before complaining about something!
Rather than "X is broken", ask "how can I achieve X? I'm having difficulty
finding this", etc.
On Wed, Dec 11, 2013 at 4:56 AM, Guillem Liarte <
guillem.lia...@googlemail.com> wrot
Hi guys,
Can anyone tell me why variables in this simple playbook do not get
expanded?
---
- hosts: all
gather_facts: false
user: ubuntu
vars:
tokens_file: /tmp/tokens.yml
tasks:
- debug: msg="{{ lookup('file', '{{ tokens_file }}' ) }}"
All I get is
$ ansible-playbook -i h
Hi Roman,
Happy to help.
Small request -- can you please send just text based mail in the future?
It would make this a lot easier to read. Thanks!
Quick public service announcement, assuming you are using a recent Ansible,
you should simplify your clauses:
when: none_name not in node_query.js
Le 13/12/11 08:05, Michael DeHaan claviotta :
> Before we dive into a technical solution let me understand your use case
> and what you are modelling a bit better.
>
> So groups['ceph-ODSs'] would be all machines in the ceph-ODSs group.
That's right.
>
> I'd probably just define a variable like
I think you probably want this:
- shell: echo {{ item.0 }}-{{item.1 }}
with_together:
- groups['ceph-OSDs']
- disks
this will print for the first host
osd0-sdb
osd1-sdb
and for the second host
osd0-sdb
osd0-sdc
osd1-sdb
osd1-sdc
Let me know if that works for you and if I'm missi
Hum, this is not what I'm looking for, because my action is not
executed on the ceph-OSDs, but on another host (a centralized admin
node).
In this playbook, I'm not doing anything on the ceph-OSDs.
What I need to do (only on my admin node) is :
- shell: echo {{ item.0 }}-{{ item.1 }}
with_nest
After reading nested.py and realizing it would never do what I wanted,
I found a workaround.
On each ceph-ODSs :
- delegate_to: "{{ ceph-admin }}"
shell: echo {{ inventory_hostname }}-{{ item }}
with_items: disks
Anyway, thank you very much for your help :)
Le 13/12/11 14:53, Guillaume S
Yep!!!
This is a *MAJOR* feature of Ansible to build Continuous Deployment systems.
You can see an example using haproxy here:
https://github.com/ansible/ansible-examples/tree/master/lamp_haproxy
You can do this even simpler with an F5, Elastic Load Balancer, Citrix
Netscaler, or whatever for s
Hello,
I am pretty new to ansible. I have used it for a week and succesfully
created some playbooks for orchestrating my server.
I have run into an issue using the git module. I have a playbook that
clones a private repo. It works great for the master and dev branches, but
it hangs when i spec
I have a complex playbook that will provision a CentOS VM on a XenServer
pool from scratch and then configure the VM according to its roles. It
works very well (and I'm very impressed with Ansible) except for one part.
As XenServer installs the VM and OS (via a delegate_to call in the Task)
it
This is a great place to use the "wait_for" module to wait for the port to
become open.
On Wed, Dec 11, 2013 at 9:31 AM, Aaron Hunter wrote:
> I have a complex playbook that will provision a CentOS VM on a XenServer
> pool from scratch and then configure the VM according to its roles. It
> wor
Hi Michael
The requirements.txt could be a way to go, might require some restructuring
but thanks for the suggestion.
And if I have some time over I might have a go at implementing the function
:)
Regards Gustav
Den tisdagen den 10:e december 2013 kl. 18:37:47 UTC+1 skrev Michael DeHaan:
>
> Yo
Can the following be refactored so the following array only appears once in
the code?
- [ '/home/youruser/a', '/home/youruser/b', '/home/youruser/c',
'/home/youruser/d' ]
---
- hosts: yourhost
user: root
gather_facts: no
tasks:
- lineinfile: dest={{ item[0] }}/.gitign
I expected the following to init a git repository in /home/youruser/a, but
instead it's created created in /
what am I doing wrong?
---
- hosts: yourhost
user: root
gather_facts: no
tasks:
- shell: /usr/bin/git init chdir={{ item[0] }}
with_items:
- [ '/home/your
It's iterating over your list of items correctly, but by indexing to [0],
it's taking the first char of the item, which happens to be '/'. Remove
the [0] and you should be fine.
On Wed, Dec 11, 2013 at 9:10 AM, Michael Baydoun wrote:
> I expected the following to init a git repository in /home/
Michael,
Thank you. Looks like you already anticipated the need for this. Sorry I
missed it.
It worked. For the sake of others, here is the statement that accomplished
the task. It wouldn't work without the "local_action" part. I put this in
my "main.yml" under the "vm" role.
[VM creation t
James and Michael,
Thanks lot for your explanations!
Regards,
Ye Deng
On Tuesday, December 10, 2013 12:37:01 PM UTC-5, James Tanner wrote:
>
> On 12/09/2013 03:05 PM, Ye Deng wrote:
>
> Hello all,
>
> I tried to install Ansible on both Mac OS X 10.9 and ubuntu-12.04.
> It seems my insta
I come from an Agile software development background in which test driven
development (TDD) is the norm. As I write Ansible scripts, I'd like some
way of testing them. In principle, I want to test every command in a
playbook. For example, if one of my command changes the user permissions on
a f
Hi,
either define variable on the beggining of the play like here:
http://www.ansibleworks.com/docs/playbooks_variables.html#variables-defined-in-a-playbook
or, better use group vars, or host vars:
http://www.ansibleworks.com/docs/playbooks_best_practices.html#group-and-host-variables
David
2
Yes, this is super easy to already do today, basically just call your tests
at the end as the last step of your playbook.
Executing arbitrary python code is possible, but you can use ansible
modules like get_url and fail and so on.
If you want to push a python script, the 'script' module is aweso
Of course, thanks!
On Wednesday, December 11, 2013 11:13:06 AM UTC-5, Scott Sturdivant wrote:
>
> It's iterating over your list of items correctly, but by indexing to [0],
> it's taking the first char of the item, which happens to be '/'. Remove
> the [0] and you should be fine.
>
>
> On Wed, D
I previous tried to define the array at the begining of the playbook in the
vars section, but it only accepts key/value pairs, not an array. Maybe my
syntax was incorrect. Is there an example of an array being defined in the
vars section somewhere?
On Wednesday, December 11, 2013 11:53:44 AM
Thanks for the feedback guys. Michael, you're right that I was talking
about controlling Linux VMs FROM a Windows machine. (Sorry for the mention
of the other tools - was just clarifying that I didn't do what other
Vagrant users seem to do in a similar situation.)
As Michael and Brian suggeste
I see your point but I'm not sure I agree. "Unit testing" may not be the
best term for it but it's not too far off. Consider this case instead:
installing and configuring a DHCP server. I have my senior admin write down
exactly what the DHCP deployment should look like. This is how success will
My point is if Ansible's file module at that level must be verified you
have greater problems :)
Definitely you can invoke tests of any kind from playbooks, script module,
get_uri, fail module with when, stat module, etc, etc -- or call another
test system, locally or remotely
-- Michael
On Dec
Hi Aaron -
I too would find it useful to have the ability to “unit test” my tasks.
However, I have opted to create a testing playbook [1] which handles
integration testing. It is not perfect, but allows for TDD/BDD, and integrate
into CI gating.
[1] https://github.com/blueboxgroup/ursula/t
If the model is declaring desired state you test the outcome, not the
implementation
Can I ping X, is this route able, is this web service up -- not does this
file look like this.
Think at the higher level and write tests that matter that are not just
basic asserts.
-- Michael
On Dec 11, 2013,
Giorgio Valoti writes:
> Michael DeHaan writes:
>>
>> am I misunderstanding the question ?
>
>
> Maybe or, more probably, I can’t explain myself. :)
>
Well, I guess I really can’t explain myself! :D No suggestions on this?
Thank you in advance.
--
Giorgio Valoti
--
You received this messa
Hello Ansible users,
I'm trying to replace *multiple lines* in *multiple files* using the
lineinfile and register, and this is what I got so far.
- name: list of the .conf files
raw: ls /etc/httpd/conf.d/*.conf
register: certs_dir
tags: update-cert
- name: update certs with the new name i
unfortunately no.
with
path_to_git_extras: >
PATH=$PATH:$ANSIBLE_21CT_HOME/roles/git/files
when the file gets templated to the remote, it contains the value of
ANSIBLE_21CT_HOME evaluated on the local machine. The remote has the
correct ANSIBLE_21CT_HOME path but it never gets a c
Like that. Any objection if I included that in the github role?
Am Dienstag, 10. Dezember 2013 23:21:26 UTC+1 schrieb Kahlil Hodgson:
>
> Another approach occurs that does not require the Perl Crazy Glue:
>
> - name: grab passwd entries for this host
> shell: cat /etc/passwd'
> register: pa
You may want to have a look here:
https://groups.google.com/d/msg/ansible-project/nd4wMLsb0Jw/7-svzpNpTIQJ
Nathan Howell has demonstrated a very nice approach which works very nice
for me.
Am Mittwoch, 11. Dezember 2013 06:20:00 UTC+1 schrieb Xu Chen:
>
> I have defined three roles: A, B and C.
symlinks also work, but can be a pain to maintain
--
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 optio
Before the copy module supported it, you could do recursive copy, but it
required multiple tasks.You could also use ansible pull and have an
'agent', which simplifies it enormously.
I know many tools offer recursive copy, but doing it right with
permissions, sudo/su and multiple hosts is much hard
FYI, there are quite a few unit test already that verify that 'the file
module' works as advertised, you can run 'make tests' in an ansible
checkout to get them. There should be no need to do this per playbook.
not all modules or cases are covered but if you want to add tests at this
level I sugge
Well phrased Brian, that was my point which I was having trouble trying to
share.
The name "unit testing" versus "integration testing" (especially what
happens in stage environments) or "monitoring" is vitally important.
You can trust that the "file" module works, so it's great if you test
whethe
I should clarify a bit because it looks like I have given you the wrong
impression. I have confidence that the Ansible modules behave as
advertised. My experience with them to date has been excellent. The Ansible
code is not what I'm trying to test.
What I want to test is that the *administrat
I guess my trouble of understanding is how would this test be different
than just the play itself. I'm not exactly an expert so forgive me, but
given that plays are written in a declarative "This is what I want" style,
wouldn't the tests essentially be saying exactly the same?
In other words why h
John,
That is pretty good. I like the method you use to do the tests and t that
you put them in a separate playbook. Following TDD style, the test playbook
could be written first, then the implementing playbook. When you check in
the implementing playbook in version control, the CI server can r
Exactly, Ansible playbooks are declarative.
I would disagree that it's like writing code for the most part, it was
designed to be very far from that, but there are definitely steps involved
that happen in order.
You are meant to read the playbook and we made them very auditable for this
reason.
For one use case where template was not optimal and to replace N lines in
one file (grub.conf),
it was convenient to have something like (IIRC):
task1: grep | wc -l
register: the_count
task2: lineifile regex= line='string' ...
with_sequence: the count
ok not the exact syntax , just to give
On 12 December 2013 05:18, Jürgen Haas wrote:
> Like that. Any objection if I included that in the github role?
No objection. Enjoy!
K
Kahlil (Kal) Hodgson GPG: C9A02289
Head of Technology (m) +61 (0) 4 2573 0382
DealMax Pty Ltd
wouldn't a test playbook match the 'production' one?
--
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 op
So since we have a very simple way to list local files (with_fileglob) it
makes sense that we probably just have a fileglob module for use of
register that lists the files in a given directory
- fileglob: path=/etc/foo/*.d
register: files
- shell: foo {{ item.0 }} and {{ item.1 }}
with_nested
How about the following:
path_to_git_extras: "{{ 'EXPORT PATH=$' + 'PATH:' + '$' +
'ANSIBLE_21CT_HOME/roles/git/file' }}"
Or something similar in a template.
The problem will probably just go away once the old style '$' variable
syntax is retired.
K
Kahlil (Kal) Hodgson
Hi,
The serial option is a great way of upgrading servers behind a load
balancer. One of the example playbooks has a HAProxy example that I used,
and it works great. I set the serial option upto half of the hosts and the
service continues running. I am excited about the new "serial: 50%" pull
I have it both ways, I use an inventory dir with
inventory/{dev,qa,staging,production} files, using -i, I can choose all
envs or just one. Also you can run with run with --limit 'staging' and
--limit 'produciton'.
--
You received this message because you are subscribed to the Google Groups
"Ansi
Hi Michael,
Thanks for your reply - and my apologies for pasting with all the syntax
colours and backgrounds - I would have removed those if I was be able to
preview how ugly my post would look like :-)
15 minutes past my submit I was able to figure out myself that my claim
that this piece of
Solution:
{% for minion in groups['rabbit'] %}
{{ hostvars[minion]['ansible_all_ipv4_addresses'][0] }} {{
hostvars[minion]['ansible_hostname'] }}
{% endfor %}
Why didnt this work? :
{% for v in hostvars.iteritems() %}
{{ v['ansible_all_ipv4_addresses'][0] }} {{ v['ansible_hostname'] }}
{%
I use to additional groups, 'left' and 'right', to split my 'testing',
'staging', and 'production' groups in half. So I can use, say,
--limit 'testing:&left'
to run a playbook against the left half of my testing servers, or
--limit 'production:&right'
to run a playbook against the right half o
hostvars.iteritems returns aset of (key,value) so in your case I suspect
you are getting a tuple.
{% for (host,facts) in hostvars.iteritems() %}
would be what you would want if doing the above.
On Wed, Dec 11, 2013 at 5:01 PM, Vasiliy Boulytchev wrote:
> Solution:
>
> {% for minion in group
hehe, i use odd/even, but same concept (my naming convention lends itself
well to this)
--
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+unsu
Amazingly no! ansible catenates the strings, then evaluates it with the
local variable.
I wonder if there is an option that can be set that will allow the new
behavior - {{ only with no $ vars - that can be used for now?
On Wed, Dec 11, 2013 at 3:28 PM, Kahlil Hodgson <
kahlil.hodg...@dealmax.c
Hi All,
I am trying to use the nova.py script provided as a jumping off point for
using OpenStack as a dynamic inventory repository.I am experiencing a
problem where the script does not work if I use the hostname (claims there
is no host by that name). It works fine if I use the IP address. In f
So what you select for the host pattern will need to match what comes back
from the inventory script
do ./ec2.py --list to see what names come back
you can also just reference host by groups
On Wed, Dec 11, 2013 at 5:29 PM, AmiableAlbion wrote:
> Hi All,
> I am trying to use the nova.py scr
Pretty sure this isn't going through the local shell before getting to the
git module.
You can debug with setting ANSIBLE_KEEP_REMOTE_FILES=1 in the environment
and running with -vvv and looking at that module it outputs on the remote
system.
If you see that behavior, please file a ticket if you
Hi Michael,
Thanks, this sheds some light on it (and works as you indicated).
So what is going on under the hood? Is Ansible just calling the nova.py
script with *--list *to get the groups and hostname(s)? Is the *--host*just for
the user or is that called for other functions?
Thanks, this is v
--host is called to get variables for the host if and only if the inventory
script is not optimized to return things all in one call.
More details that should be helpful are listed here:
http://ansibleworks.com/docs/intro_dynamic_inventory.html
and regarding that specifically:
http://ansiblewor
Hi Michael.
I modified the nova.py script since it turns out it was setup to key on the
host IP address (public or private). My version resolves by hostname using
the instance "name" attribute.
Thanks again.
Albion
On Wednesday, December 11, 2013 3:37:02 PM UTC-8, Michael DeHaan wrote:
>
> --h
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
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
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
I have long threatened to make a Mac computer lab, using the "say"
vocalization tool and the osx_say module in Ansible, perform a work of
Shakespeare on a group of computers all sitting across from one another.
Alas, I've finally done it:
https://github.com/mpdehaan/ansible
Patches to add the re
That's totally not the right link.
THIS is the right link: https://github.com/mpdehaan/ansible-and-juliet
There we go.
On Wed, Dec 11, 2013 at 9:55 PM, Michael DeHaan wrote:
> I have long threatened to make a Mac computer lab, using the "say"
> vocalization tool and the osx_say module in Ansi
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
This makes an extremely cool example demonstrating Ansible working. It's
useful to take this example to run a playbook with voice notification as
different milestones are done.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe
I'd say use tags. That's what they are for. You could also
divide your roles up, so instead of 2 roles, you have four.
A/
config/
tasks/main.yml
install/
tasks/main.yml
B/
config/
tasks/main.yml
install/
tasks/main.yml
install.yml:
- hosts: Ahosts
roles:
-
If you are familiar with RSpec (in Ruby), I recommend serverspec [1] for
testing as BDD style.
[1] http://serverspec.org
-- shigeta
On Thursday, December 12, 2013, John Dewey wrote:
> Hi Aaron -
>
> I too would find it useful to have the ability to “unit test” my tasks.
> However, I have opte
Hi all,
We are implementing Ansible at our company and with the current setup we
are managing multiple applications into multiple environments by loading
the appropriate hosts files.
Our issues come when loading the variables files. For each project /
environments we have the following variab
Heyo,
I was looking for a built-in filter either in Ansible or in Jinja2 that
supported regex based find and replace. It doesn't appear a real straight
forward implementation exists today. I was able to achieve what I wanted by
adding the following bit to 'core.py' for testing purposes.
def re
Hello!
I'm trying to develop an `ec2-instances` role that I can use to ensure the
proper number and type of ec2 instances are running for a given playbook.
You can see what I've got so far
here: https://gist.github.com/joshuaconner/da70f903172a6583d463
My problem is that, as it the `hosts:` fi
Hello,
I've written a role to install and configure Apache, the role is at the
moment specific to Debian.
This means my role/apache/tasks/main.yml contains corresponding tasks.
I need also to support CentOS.
I could add corresponding tasks to the same file and add a when clause for
each task, b
Yeah the other notification modules like IRC, campfire, etc, are a bit more
useful most of the time :)
On Wed, Dec 11, 2013 at 10:09 PM, Melissa Tan wrote:
> This makes an extremely cool example demonstrating Ansible working. It's
> useful to take this example to run a playbook with voice noti
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
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
87 matches
Mail list logo