Ansible is an open-source software platform for configuring and managing computers. It combines multi-node software deployment, ad-hoc task execution, and configuration management.

learn more… | top users | synonyms

2
votes
1answer
24 views

Detecting a network from ansible playbook using nslookup

I am working on a Vagrant + Ansible configuration for my team that sets up a developer VM, some of the artifacts needed are only available from my corporate network either by being physically on it or ...
1
vote
2answers
36 views

Ansible - Exception: host not found: {{ item }}

I have some task which I wish to delegate_to some hosts (finally I want to list them in some var rather than use group from inventory). For this question lets simplify this to (I did exactly the same ...
0
votes
0answers
13 views

How to set scp_if_ssh = True for a group?

It's simple to set this variable in an ansible.cfg but it makes sense only for hosts that do not have sftp (and most likely python as well). So I have a group for routers – is it possible to set this ...
3
votes
2answers
158 views

Ansible, Chef, Puppet or ____ : Which has the strongest Windows support and smallest init footprint

We do mostly (but not exclusively) win servers. Preferably, we can start the OS and do little or nothing to it to make it ready to receive commands (we know we may need to create a base image with ...
4
votes
1answer
33 views

How can I have a nested loop with a fileglob pattern?

I'm trying to create a set of authorized SSH keys for a set of users in Ansible. I have a users variable set up like so: users: - { username: root, name: 'root' } - { username: user, name: 'User' ...
1
vote
1answer
51 views

Ansible - Try to ping connection between localhost and remote server

I am beginner in Ansible and I am trying to learn it. I use the ansile docs Getting Started and I am faced with problem which stopped me. My problem rely on that when I've tried to use a command ...
0
votes
1answer
51 views

Ansible: copy file depending on hostname or role

What's the best way to copy over a file depending on a hostname? I need to copy over files with different content but with the same filename to several machines. I have several files: file.role1 ...
3
votes
1answer
110 views

Running apt-get autoremove with ansible

I maintain a flock of EC2 servers with ansible. The servers are regularly updates and upgraded using the apt module. When I manually tried to upgrade a server, I received the following message: $ ...
0
votes
1answer
128 views

Issues with Ansible's default/error handling in a playbook

I'm having some issues with Ansible and the way it defaults to values. What I'm trying to accomplish is to bind a Docker container to on eth1, if it exists, otherwise use lo. My initial approach was ...
1
vote
1answer
127 views

Ansible: How to access hostvars in task?

I'm trying to use hostvars in my task. But it seems that ansible is interpolating the variable and then trying to look it up in the main variable dict object. Here's my code: - name: Configure the ...
1
vote
1answer
36 views

Display output with Ansible

I have a Ansible play for PGBouncer that displays some output from a stats module built into PGBouncer. My issue is that when Ansible prints the output to the terminal it mangles the newlines. ...
0
votes
1answer
199 views

Avoid repeating 'with_items' in Ansible role

I've got an Ansible role with several tasks that I run for several virtual hosts. My playbook works, and it looks like this: --- - name: Create vhost configuration # action with_items: vhosts - ...
-1
votes
1answer
155 views

How to make sudo -u not require password [closed]

I'm using ansible with vagrant and ansible is trying to sudo as postgres user to run some postgres commands. Ansible running as vagrant user seems to run something like sudo -u postgres psql This ...
3
votes
1answer
115 views

how to access host variable of a different host with Ansible?

Let's say a have a host that collects some data and it's in a group [collectors]. I also have hosts in group [reporters]. So I want to set a variable on reporters from groups['collectors'][0] ip ...
0
votes
1answer
34 views

Ansible error when unpacking some archives into /usr/local/lib

I'm running an ansible playbook on my machine, and every task completes successfully except for several steps that involve unpacking various zip and tar.gz archives into /usr/local/lib. Here's an ...
3
votes
1answer
61 views

Tweaking Ansible output

I want to use Ansible to collect information from a number of servers. The information should be postprocessed locally, so it should be presented in a certain format. Other than grep and sed and awk ...
0
votes
0answers
54 views

How can I run a delegated task for an offline host using Ansible?

I have Ansible tasks for enabling and disabling Nagios checking for some hosts. They use "delegate_to" the Nagios server. However, I can't use them when the host in question is offline, because ...
1
vote
2answers
40 views

Ensuring a given set of RPMs, and only those RPMs, are installed

I have multiple lists of RPMs (one per configuration), and a set of remote machines. Each list includes all of the RPMs needed to run my machine in the configuration I choose. For a given ...
0
votes
1answer
82 views

passing list of lists in a playbook to a single command (not with_items)

I two groups of hosts: dc1 and dc2. Also combined to a DC group. I need to pass a list of IP addresses of hosts from a foreign DC to a command. with_items doesn't work here at all. Should look like ...
0
votes
1answer
210 views

Associative array in Ansible playbook

I'm trying to add users to my servers using Ansible. Each user have a different encrypted password. I have something like that: vars: users: - myuser1 - myuser2 password: ...
0
votes
1answer
105 views

file created by ansible seems to have mangled permissions

Issue with files created by Ansible I’m looking at using to setup some new servers at a new ISP and I’ve been doing some basic steps to test first. I am new but have done some testing on diff servers ...
1
vote
1answer
338 views

Ansible stuck on gathering facts

I'm having some odd issues with my ansible box(vagrant). Everything worked yesterday and my playbook worked fine. Today, ansible hangs on "gathering facts"? Here is the verbose output: ...
1
vote
1answer
62 views

using pgpool doesn't see a list of variables into group_var directory

I am using Ansible + Vagrant to create my infrastructure or make a little simulation of I wish. It installing postgres and creating a ssh directory to store the differents keys for each host. It is ...
0
votes
1answer
54 views

Is it possible to get host groups from nagios config to ansible?

We have already nice preconfigured nagios with hosts, host groups etc... Is it possible to get host groups from nagios to ansible? are there some plug-in/module which may allow us to do: ansible ...
1
vote
2answers
110 views

How set to ansible a default user/pass pair to ssh connection

I am using ansible and I have it configuration in my inventory/all: [master] 192.168.1.10 ansible_connection=ssh ansible_ssh_user=vagrant ansible_ssh_pass=vagrant [slave] 192.168.1.11 ...
3
votes
1answer
323 views

How to get remote server facts on ansible

I have playbook where i setup web-servers. And in this playbook i want to know local-network ip address of db server. All this servers i have in inventory file. How i can do it? I tried to use ...
2
votes
1answer
203 views

Have a Vagrant VM destroy itself or power off on completion of a long-running task

I've been using Vagrant with Ansible to perform certain ETL tasks. This has provided some flexibility and transparency: jobs can be easily be moved around and the YAML playbook provides some level of ...
-1
votes
1answer
296 views

Access to ESXI using Ansible (python)

I'm want to execute a command using Ansible on an remote ESXi but it seems that a module grp is missing. # ansible esxi -a "date" esxi | FAILED >> { "failed": true, "msg": "Traceback ...
3
votes
1answer
93 views

Securing the primary Ansible user

It seems that there are only two reasonable approaches for the primary Ansible user: Using root Using another user (e.g., ansible) with NOPASSWD sudo access The first option is a no-go since I ...
1
vote
2answers
153 views

Install image with Ansible via IPMI?

Is there a way to install an image on and provision a bare metal SuperMicro IPMI server from the ground up with Ansible via in-band IPMI over VPN? I'm looking to see if I can automate the ...
-1
votes
1answer
229 views

MySQL installation with Ansible on Debian Wheezy

As the title suggests, I am trying to install MySQL Server 5.5 on Debian with Ansible. Since this needs to be a silent installation, I provide the root password before the installation with debconf ...
1
vote
1answer
297 views

Why is my instance failing ELB health checks when adding it to the load balancer via Ansible?

I am trying to add an EC2 instance to an Elasitic Load Balancer using an Ansible playbook, with the ec2_elb module. This is the task that should do this: - name: "Add host to load balancer {{ ...
1
vote
2answers
75 views

Issue with sharp in host vars Ansible

Since # is considered as a comment in /etc/ansible/hosts I'm unable to use a password containing a sharp. [hosts] host1 ansible_ssh_user=user ansible_ssh_pass=userpass ansible_su_pass=My#Password ...
2
votes
1answer
568 views

Ansible: Excecute task only when a tag is specified

Ansible tags can be used to run only a subset of tasks/roles. This means that by default all tasks are executed and we can only prevent some tasks to execute. Can we limit a task to be exectued only ...
4
votes
2answers
2k views

Iptables management with ansible in huge environment

What is the best way to manage iptables from one point and have the ability to edit something on local server. We need to add some rules centralized on all servers, but we have specific servers with ...
1
vote
2answers
540 views

Always trigger handler execution in Ansible

I'm using Ansible to provision my development server. I want it to always start some services for me. I have handlers for this purpose but what is the best way to trigger handler execution without ...
1
vote
1answer
143 views

Ansible Role include

I have a task that can be used by several roles. I added it to lib/mycommontask.yml On my playbook on roles/my-project/tasks/main.yml I have: -- - include: lib/mycommontask.yml vars: project: ...
1
vote
3answers
676 views

Accessing hostvars for a host group in anisble

I am trying to use ansible to add entries in the server hosts file. I have a group of servers that I need to talk to each other over a private LAN. My inventory file: [server_list] server1 server2 ...
4
votes
1answer
1k views

Weird network problems with Vagrant, VirtualBox, Ansible and Ubuntu Server box

We are using Vagrant and Ansible to provision VirtualBox machine. It was working great, but recently we've started to encounter some weird network problems with tasks that require access to the ...
1
vote
1answer
97 views

Configure all hosts, then create a list of the config for all hosts?

I deployed a huge number of hosts with Ansible - which did work very nice. Each host got its individual settings and configuration. Now I'd like to generate a config file for another system that ...
1
vote
1answer
238 views

SSH via terminal succeeds, but same SSH connection via Ansible fails on same machine?

Can anyone possibly shed any light on why this is happening? I am logged into machine A, the client, with user basicuser. When I try to run an ansible playbook on machine B (server machine, as ...
1
vote
1answer
320 views

Using more advanced filters with ansible setup module

I'm new to ansible, but I cant find the answer to this question which I think looks fairly simple.. In playbooks, you can get facts in ansible using example {{ ansible_eth0["ipv4"]["address"] }} or ...
2
votes
1answer
2k views

Ansible ssh as user and execute has root (expect like)

I have to administer an important number of hosts where there is only one user able to access from SSH (let's call him foo) and then have to login as root to execute privilegied commands. Foo user ...
2
votes
2answers
368 views

How to clean up stuff from roles that aren't used any more on a server?

Suppose I have a host that is, among other things, a web server, where the related Ansible role installs nginx, performs some essential configuration in /etc/nginx, and opens up ports 80 and 443 in ...
3
votes
1answer
868 views

Ansible iterate a dictionary with lists

I have the following variable loaded via include_vars: access: username-foo: - path: / permissions: rwX recursive: true username-bar: - path: / ...
7
votes
1answer
2k views

Ansible: copy template only when destination file does not exist

I'm using Ansible 1.6.6 to provision my machine. There is a template task in my playbook that creates destination file from Jinja2 template: tasks: - template: src=somefile.j2 ...
0
votes
1answer
64 views

How to notify a handler at the end of execution?

I have a Rackspace instance that I use for testing. I am using a seperate user for running Ansible, and due to my SSH configuration update tasks, if I notify the "restart ssh" task when needed, later ...
0
votes
1answer
84 views

how to provide username and password for ansible mail module

How to provide username and password of email account while using ansible mail module. I'm using gmail smtp server. In documentation of mail module nothing is mentioned about it. I also came across ...
3
votes
1answer
627 views

Running Ansible locally inside a Dockerfile SSH authentication issue

I'm unable to run my ansible playbook inside a Dockerfile due to authentication issues. Here's my dockerfile: FROM ubuntu:14.04 MAINTAINER hyperfocus # Update system and install ansible RUN apt-get ...
5
votes
1answer
321 views

Distribute ssh public keys among hosts

I'm setting up some machines with Ansible and need to enable password less connections between them. I've got a database master and several slaves. For initial replication the slaves need to ssh into ...