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

1
vote
1answer
45 views

Running Ansible task as a specific user

I am trying to run a specific Ansible task as a different user than the one who is running the playbook. My .yml file looks like this: --- - hosts: staging_servers tasks: - name: check ...
0
votes
0answers
16 views

Python in the debian-installer context

My broader question is about using Ansible to perform the late_command in a preseeded Debian/Ubuntu install. The specific question is, is there some straightforward or documented way to get a working ...
1
vote
1answer
41 views

Ansible SSH as one user and Sudo as another

I am having trouble with configuring Ansible and sudo to allow me to SSH into a server and run a command as another user. I have gone through the questions / answers below and the Ansible ...
1
vote
1answer
27 views

Pubsub-style notify/handler in Ansible (restart all services using source code when it changes)

I have a role that updates source code of my project from git, let name it source_tree. Git repository contains source used by multiple services so I want to restart all services using that source on ...
1
vote
1answer
44 views

Prevent rsync from deleting excluded directories

I'm using rsync through Ansible's synchronize-module with the following task definition: synchronize: src='{{ local_app_path }}/.' dest='{{ remote_app_path }}/' perms=no owner=yes ...
0
votes
1answer
63 views

Ansible/Capistrano with fixed sudo command (“sudo su -”)

I have to administer some half-managed servers (monstly CentOS 6), where we are only allowed to login as a regular user, then do "sudo su -" and type the regular user password, and then run the ...
3
votes
2answers
104 views

Ansible Fails to Authenticate Sudo Even When Sudo Pass is Given

Problem Using the latest, stable Ansible build, I have an odd problem where my playbook hangs on one server during "Gathering_Facts" but works fine on other similar servers when using Sudo. On the ...
2
votes
1answer
46 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
90 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
33 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
320 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
85 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
194 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
98 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
273 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
241 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
360 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
53 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. ...
1
vote
1answer
394 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
288 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
405 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
41 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
86 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 ...
2
votes
0answers
82 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
46 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
121 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
431 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
130 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 ...
2
votes
1answer
552 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
77 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
75 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
145 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 ...
4
votes
1answer
510 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
238 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
409 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
114 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
208 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 ...
0
votes
1answer
251 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 ...
2
votes
1answer
451 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
92 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 ...
3
votes
1answer
870 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
3k 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 ...
2
votes
2answers
825 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
188 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
926 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
2k 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
112 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 ...
2
votes
1answer
311 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
395 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 ...
3
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 ...