Hi,
When one has multiple inventories like:
inventories/a/hosts
inventories/b/hosts
inventories/..
Is there an easy way to run a task or playbook against all of them without
explicitly having to define each inventory on the command-line?
The use case here is that all those groups contain
Hi,
Given the following structure:
roles/bugzilla/vars/main.yml:
bugzilla:
vhost:
name: x
stuff: c
roles/subversion/vars/main.yml:
subversion:
vhost:
name: y
stuff: d
I'm trying to do the following
playbook.yml:
- name: x
...
roles:
- { role: apache,
Hi,
I've built a very generic Apache role that can set up a bunch of vhosts,
however I'm running into a design problem.
Each vhost has a dependency, for example 'subversion' requires a bunch of
packages and a repository to be created (subversion specific tasks), the
same goes for all the
of:
inventory_hostname in groups[x]
do a
x in group_names
On Wednesday, August 5, 2015 at 3:25:31 PM UTC+2, R. Dikkes wrote:
Maybe you could look at ignore_error ?
On Wednesday, August 5, 2015 at 7:35:27 AM UTC+2, Nico K. wrote:
It to ignore the fact that this group doesn't exist within this
playbook
hi guys,
I am creating my htpasswd files in the following manner which works fine:
vhosts:
sites:
- name: my_site
htpasswd:
- name: user1
pass: pass1
- name: user2
pass: pass2
- name: Create htpasswd file
htpasswd:
path: { item.1.name
It to ignore the fact that this group doesn't exist within this
playbook/inventory for the sake of re-usability of the role.
On Tuesday, August 4, 2015 at 11:00:01 PM UTC+2, Brian Coca wrote:
I for one expect it to fail, what were you expecting?
--
Brian Coca
--
You received this
Hi,
I have been breaking my head on the following for the past few days now and
I can't come up with a clean solution that will keep my roles portable.
Effectively, what I want to do is have two role (webserver / monitoring),
depending on whether the first one ran the second one should install
- name: task
debug: msg=I will fail
when: inventory_hostname in groups['doesnotexist']
fatal: [host] = error while evaluating conditional: inventory_hostname in
groups['doesnotexist']
I'm assuming this is not expected behavior? Running Ansible 1.9.2, if it's
not, I'll be happy to file a
Hi,
I've been restructuring my variables and ended up with something along the
lines of:
files:
- { src: 'a' }
- { src: 'b' }
and a role that does:
- name: x
template:
src: {{ item.src }}
...
mode: {{ item.mode|default(0755) }}
owner: {{ item.owner|default(root) }}
, August 2, 2015 at 10:10:30 AM UTC+2, Nico K. wrote:
Hi,
I've been restructuring my variables and ended up with something along the
lines of:
files:
- { src: 'a' }
- { src: 'b' }
and a role that does:
- name: x
template:
src: {{ item.src }}
...
mode: {{ item.mode
In your example, the loop variable is named identical to your list variable.
Try doing:
{% for interface in interfaces if interface.name == lo0 %}
{{ interface.unit0.ip_primary }}
{% endfor %}
On Sunday, July 5, 2015 at 4:03:08 PM UTC+2, Vishal Chainani wrote:
Hmmm
so if have to select
I should have been more thorough in my previous reply, when I mentioned it
I was trying to point out that was causing the problem.
Disabling the option so it defaults to sh or explicitly specifying sh makes
the problem go away.
On Friday, June 26, 2015 at 6:39:02 AM UTC+2, Brian Coca wrote:
Hi,
I'm looping over a set of repositories and storing them using 'register',
for each of these repositories I'm listing the configuration directory and
storing the results using register, so far so good.
Now I'm trying to compare the results against a list of configuration files
that should
My ansible.cfg has executable set to '/bin/bash'.
On Tuesday, June 23, 2015 at 9:06:15 AM UTC+2, Nico K. wrote:
Hi,
To ensure that all our playbooks continue running on the upcoming Ansible
2.0, I decided to give it a test run.
Did a clean checkout in a new tree and attempted to run my
Hi,
To ensure that all our playbooks continue running on the upcoming Ansible
2.0, I decided to give it a test run.
Did a clean checkout in a new tree and attempted to run my playbooks, sadly
I immediately run into an error:
TASK [ec2-group : ec2-group : include]
Hi,
My EC2 instances are reachable via a jump host, however when I create a new
EC2 instance as my first step of the play, the new DNS entry isn't
available yet so the jump host configuration is not being used yet.
I tried using 'add_host' and also 'wait_for' (to determine SSH
availability)
Hi,
When I add an ALIAS record in route53 through the ansible module a . is
appended to the end of the value which is wrong.
For example:
mydomain.com. A ALIAS dualstack.mydomain.com.
The dot at the end of 'dualstack.mydomain.com' should not be there, if it
is there the record will not
My apologies, further investigation shows that AWS is actually broken.
For those interested:
https://forums.aws.amazon.com/thread.jspa?messageID=610954
In a nutshell, the 'dualstack' versions currently seem to have region
specific hardcoded zone id's that you can't obtain through the API.
--
What I have noticed is that the installed version of alternatives.py does not
seem to match what's currently in github, the version installed by pip seems to
be many revisions back.
I even went as far as removing ansible completely and reinstalling, making sure
there are no mix-ups with old
Just installed the latest version of Ansible through pip, since the upgrade
the 'alternatives' module no longer seems to install a link if it doesn't
exist yet instead it just reports that there are no existing alternatives.
I'm calling the module with all required arguments (as before):
-
Hi,
I'm trying to register the output of a command which returns json.
When I do this as a standalone task (not role) it works fine, for example:
- name: x
hosts: localhost
tasks:
- shell: aws iam list-server-certificates
register: y
- set_fact:
test: {{ y.stdout }}
The fix is to change:
set_fact: x=y
to
set_fact:
x: y
No idea why.. but it works
--
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
.
- James
On Thursday, April 2, 2015 at 4:59:52 PM UTC-4, Nico K. wrote:
Hi,
I might be doing things backwards, but I'm gonna ask anyway.
In my scenario, I first add the host_vars/new_host and only then do I run
the ec2 create task (which is delegated to localhost obviously).
After
By the way, I just noticed that you run into the exact same issue when
trying to define volumes by passing in a variable.
For instance:
group_vars/all:
ec2_volumes:
- { device_name: /dev/sda1, volume_size: 50 }
- ...
and then in roles/ec2/main.yml:
- name: ec2 test
ec2:
Hi,
I'm trying to spawn an EC2 instance through a role.
However, I can't get instance_tags to work when I try to pass in the
value through a parameter.
group_vars/all:
ec2_instance_tags: '{name:test}'
roles/ec2/tasks/main.yml:
- name: xx
ec2:
...
...
instance_tags: {{
Hey Brian,
Thanks for that, works like a charm.
I did notice there are a bunch of quoting issues going on, for instance:
x:
- y: b
z: c
- y: {{ d }}
z: {{ e }}
Works fine, where-as defining the structure as per my initial post the
variable evaluation fails ( end up with {# x.item #} or
Hi guys,
I'm trying to configure an EC2 Security Group using Ansible, since all of
my security groups contain a set of 'base rules', I'm trying to split that
portion out to avoid duplication.
To do so I have:
base_rules: [
{ proto: ...
, from_port: ...
Hi,
I just ran my playbook against the current ansible packaged version (Ubuntu
- 1.8.2) and noticed that there is a bug in there when it comes to using
'delegate_to' in combination with 'with_items'.
So I updated my DEV environment to the latest git version, problem
resolved..
Is the fix
Hi Damien,
Looking at what you are trying to accomplish I'd suggest you look into
Microsoft's Active Directory and the use of GPO's.
Regards,
Nico
--
You received this message because you are subscribed to the Google Groups
Ansible Project group.
To unsubscribe from this group and stop
Hi Rambius,
The Copy module takes a file from the local (control) machine and sends it
to a target. The Fetch module takes a file from the target and pull it to
the local machine.
Using the modules in combination will 'delegate_to' will not help you
either, since that will perform the action
I'm still kinda stuck here, the only way that I've found working is what
Michael posted earlier. However that solution doesn't work when I use it
with '--limit'.
IMHO run_once_per_group would be an awesome solution, one reasonable
alternative would be as per my previous post, a variable that
I thought of a workaround but I can't seem to get that to work either... :(
This is a snippet:
- name: test
gather_facts: false
hosts: backend
tasks:
- debug: msg='{{ last_frontend_host_seen|default() }}'
- set_fact:
last_frontend_host_seen: {{ frontend_host }}
Hi,
I have groups of hosts that I copy files to, one those files are copied I
call a webservice on the groups master; this webservice will call a
deployment script.
The problem I'm having is that the webservice call will be made for every
host but it only needs to be called once per group. The
tasks:
- ... # run once stuff goes here
- hosts: webservers
tasks:
- ... # stuff to do to everything
Alternatively:
when: inventory_hostname == groups['webservers'][0]
On Fri, Dec 19, 2014 at 8:55 AM, Nico K. nkrab...@gmail.com javascript:
wrote:
Hi,
I have groups
Hi,
It's not perse an Ansible specific question but it's my primary use-case
and I'm hoping there are other users who did the same.
For this example, let's pretend I have 3 hosts, source, jumper and
destination.
The source host is the host that runs ansible and this host can only get to
In case someone wonders, I solved this by writing a shell wrapper and using
that as 'proxycommand' in my ssh config. The shell wrapper effectively does
nothing more than verifying that ${_##*/} = 'ansible-playbook'.
-Nico.
--
You received this message because you are subscribed to the Google
Hi,
I just updated my ansible environment to the latest version, however my
playbooks now no longer run.
When trying to run it I get: ERROR: set_fact is not a legal parameter in
an Ansible task or handler.
This 'set_fact' is performed within a role.
roles/somerole/tasks/main.yml:
- set_fact:
'-' and
'list_of_my_users_obtained_earlier', which is not actually needed, you can
just give the list on the same line was with_items. You were using 'item'
in one place, but 'item.1' in another.
On Thu, Oct 2, 2014 at 8:52 AM, Nico K. nkrab...@gmail.com javascript:
wrote:
Hi,
In my
Hi,
In my setup, I have a master host that contains all accounts, these
accounts are to be kept in sync across a bunch of isolated remote
environments.
The account creation/deletion is not a problem, however I can't seem to
find out a way to deploy the ssh key for each user without having to
on the include_vars.
On Thu, Sep 18, 2014 at 10:03 AM, Nico K. nkrab...@gmail.com
javascript: wrote:
Thanks, I was trying to do the following (which pretty much comes
straight from the manual) but I can't get it to work:
(This is within a role)
# Load a variable file based on the OS type
Hi,
Given a wide-range of distribution versions how does one abstract away the
differences?
For example I have to deal with all Ubuntu versions between 10.04 = 14.04,
there are differences such as '/etc/dhcp' vs '/etc/dhcp3' and so on.
The 'group_by' statement here doesn't really help since
examples of this in our integration tests, and in the Tower
installation playbook.
Thanks!
On Thu, Sep 18, 2014 at 8:42 AM, Nico K. nkrab...@gmail.com javascript:
wrote:
Hi,
Given a wide-range of distribution versions how does one abstract away
the differences?
For example I have to deal
In my hosts file I have a group defined called 'live' for example.
[live]
myhost1.example.com
myhost2.example.com
I want to delegate_to: live
Is that possible?
--
You received this message because you are subscribed to the Google Groups
Ansible Project group.
To unsubscribe from this group
For those wondering, yes it's possible as per Michael's pointer you can use
with_items, so one can do:
delegate_to: '{{ item }}'
with_items: groups('groupname')
where groupname can also be a (custom) fact or variable.
Op woensdag 10 september 2014 15:36:40 UTC+2 schreef Nico K.:
In my hosts
is applied to all tasks in
the include, it *cannot* be used to decide to include something or not,
because the same tasks (with different variable contexts of course) get
applied to all hosts.
On Sun, Jul 27, 2014 at 5:08 PM, Nico K. nkrab...@gmail.com javascript:
wrote:
Hi,
I just updated
Hi,
I just updated to the latest and greatest revision and since the update I
can no longer perform an include of a file defined through a variable.
For instance:
- include: {{ file }}.yml
when: file is defined
now throws the following error:
ERROR: file could not read:
I'm actually using this in a template, however the behavior is not as
expected:
someVar = {{ ansible_memtotal_mb / 4|int }}
The result is '256.0', same when I remove the |int and same when I do *
0.25.
Op maandag 17 februari 2014 16:15:07 UTC+1 schreef Brian Coca:
something like
Hi,
I've been reading through a lot of posts regarding the subject of fact
gathering and I'm under the impression that it's impossible to force fact
gathering on hosts when using '--limit'?
My specific use case would be obtaining IP addresses of all hosts to
populate the firewall ruleset with.
Hi,
Looks like I've run into a bug:
- name: create users
user: name={{ item.owner|default(item.name) }}
group={{item.group|default(item.name)}} groups=aap
with_items:
- {{ user_list }}
Will always report 'changed', if I take out the 'groups' it works as
expected.
Regards,
Nico
--
a variable into the role as a role parameter and have
loops on the individual task steps.
On Tue, Jul 15, 2014 at 5:16 AM, Nico K. nkrab...@gmail.com javascript:
wrote:
I've also been playing with the idea of doing the following:
- include: x.yml var={{item}}
with_sequence: ...
Sadly
Hi,
main.yml:
- include: somefile.yml
when: variable is defined
somefile.yml:
- name: do some stuff
file: path=/x/y/x/application{{ item }} state=directory
with_sequence: start={{variable.start}} end={{variable.end}}
Runs into an error when variable is -not- defined, as it seems to
I've also been playing with the idea of doing the following:
- include: x.yml var={{item}}
with_sequence: ...
Sadly, includes are no longer allowed to be used in conjunction with
'with_items'.
Same goes on playbook level, invoking a role multiple times in a loop isn't
allowed either.
Now I
Hi,
First off I wanted to say that I've been using Ansible for a while now and
so far I'm really pleased with it.
The product is powerful and flexible and the community is alive and helpful.
I was hoping that some of you might be able to share your insights on how
to best approach the
Hi,
Consider the following list of hashes being defined:
my_list: [ { src: a, dest: b, mode: 755 }
, { src: d, dest: e, mode: 640 }
]
and this task:
- name: example
file:
path: {{ item }}
state: absent
with_items: some_other_list
when: item not in
, Michael DeHaan wrote:
On Mon, Jun 23, 2014 at 3:25 PM, Nico K. nkrab...@gmail.com wrote:
Sure, but that's exactly the thing I would like to deal with within a
role, within a role however you can't perform the 'include' you stated
in
your post as ansible_os_family doesn't seem to evaluate
}}
Things would be a lot easier if 'Service' would be implemented for OS-X and
package would be abstracted (like for example Salt does).
Op maandag 23 juni 2014 21:25:04 UTC+2 schreef Nico K.:
Sure, but that's exactly the thing I would like to deal with within a
role, within a role
Hi,
So I've been scavenging through a lot of posts to figure out how to deal
with heterogeneous environments.
The two approaches that I see most are either using group_by or using
when.
For example:
site.yml:
- name: whatever
tasks:
- group_by: key={{ansible_os_family}
- hosts:
, Jun 23, 2014 at 1:05 PM, Nico K. nkrab...@gmail.com javascript:
wrote:
Hi,
So I've been scavenging through a lot of posts to figure out how to deal
with heterogeneous environments.
The two approaches that I see most are either using group_by or using
when.
For example:
site.yml
58 matches
Mail list logo