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

22
votes
3answers
4k views

How can I implement ansible with per-host passwords, securely?

I would like to use ansible to manage a group of existing servers. I have created an ansible_hosts file, and tested successfully (with the -K option) with commands that only target a single host ...
18
votes
1answer
8k views

How to see stdout of ansible commands?

How do I see stdout for ansible-playbook commands? -v only shows ansible output, not the individual commands. It would be great if I could figure out how to do this immediately, so if something ...
12
votes
2answers
2k views

Configuration management: push versus pull based topology

The more established configuration management (CM) systems like Puppet and Chef use a pull-based approach: clients poll a centralized master periodically for updates. Some of them offer a masterless ...
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 ...
7
votes
2answers
2k views

How to handle SSH port changes with Ansible?

I'm trying to use Ansible for automating the setup process of new server instances. One of the setup tasks changes the default SSH port, therefore requiring me to update the hosts list. Is it ...
6
votes
2answers
751 views

Ansible: Can I use vars_files when some files do not exist

That's the part: vars_files: - vars/vars.default.yml - vars/vars.yml If a file vars/vars.yml does not exist - here is an error. ERROR: file could not read: /.../vars/vars.yml How can I ...
6
votes
3answers
3k views

How do I add sudo permissions to a user created with Ansible?

What is the cleanest way of doing this? Tried adding the user to the sudo group with the users module but Ansible reports it can't find the sudo group.
5
votes
5answers
3k views

Rolling update with puppet, ansible or fabric

I have some jetty servers with a loadbalancer before them. Now I want to update my application without downtime. When one jetty is going down and no longer reachable the loadbalancer automatically ...
5
votes
1answer
1k views

Reusing tasks in Ansible

In Ansible, is it possible to define a set of tasks in one files and then run selected tasks from other playbooks? The documentation describes how to include and reuse the task list, is there a way to ...
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 ...
5
votes
1answer
902 views

Passing free-form commands to Ansible using complex-args form

I'm using programatically generated Ansible playbooks. In general, because playbooks are just YAML, this is straightforward. However, when using the "simple" key=value form, playbooks aren't pure ...
5
votes
0answers
461 views

Kickoff Ansible Playbook after Cobbler install

I am working on implementing Cobbler and Ansible to do our server deploys and am having one final issue. My Ansible playbook works great, my Cobbler install works great, but the issue is in tying them ...
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 ...
4
votes
3answers
3k views

Deploying a folder of template files using ansible

Is there an easy way to deploy a folder full of template .j2 folder to a linux box, using the same name as the template, but without the .j2 extension, rather than using the template module for each ...
4
votes
1answer
1k views

Ansible playbook not working trying to run make & configure with complex switches

This is a follow-on to this question. I'm trying to use Ansible to provision a Vagrant VM. The VM is running CentOS 6.4. I'm using the following (abbreviated) ansible playbook: - hosts: default ...
4
votes
1answer
2k views

Is it possible to execute the Vagrant Ansible provisioner on a Windows host machine?

It seems that Vagrant doesn't let me automatically provision the Ansible provisioner on Windows using Vmware. I'm not really sure whether Ansible has to be installed on the host machine, (in my case ...
4
votes
2answers
791 views

Create user if not exist in Ansible

I want to make sure a given user always exist in a system, so only create when it is not exist my current tasks is: - name: Create default user action: user name={{ user }} groups={{ group }} ...
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' ...
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 ...
4
votes
1answer
443 views

How to make ansible use password if key was rejected?

My new server instances are configured to login on root via ssh with password. I want my playbook to reconfigure it to use keys instead and disable root login with password on first run, so I need ...
3
votes
2answers
160 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 ...
3
votes
3answers
2k views

How can I add a user to multiple groups in Ansible?

I can't add a user to multiple groups, I keep getting msg: this module requires key=value arguments. This is the piece of code I'm trying: - name: make a new user user: name=user ...
3
votes
3answers
2k views

ansible playbook, different user by operating system

I'm starting to play with ansible. I have a bunch of servers (Ubuntu, Centos, Red hat...). The servers have different users. For the ubuntu servers I use sudo user, for the rest I use root user. How ...
3
votes
2answers
621 views

Force Ansible to throw out error when vars is missing in yml?

Is it possible to force Ansible when replacing the var in yml files, which is undefined, throw out an error instead silently replaced by an empty string?
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: $ ...
3
votes
1answer
117 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 ...
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 ...
3
votes
1answer
871 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: / ...
3
votes
2answers
2k views

Should I install Ansible with python pip or homebrew on Mac OSX Mavericks? [closed]

I recently moved to using OSX to administrate my linux box, so I'm very new to using linux programs on OSX. I want to use Vagrant with Ansible to bootstrap my development environment, so I need to ...
3
votes
1answer
325 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 ...
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 ...
3
votes
1answer
227 views

Using Nagios Event Handlers to bring system back in correct state

I'm pretty new to monitoring , config management, etc. so please bare with me. I've read up on config management / provisioning tools like Ansible and SaltStack. These sound pretty good to me and I ...
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 ...
2
votes
2answers
715 views

How to install Python packages to (Homebrew) Ansible's site-packages folder

I have installed Ansible (v1.4.4) and Python (2.7.6) via Homebrew. I'm creating an Ansible playbook for setting up a local development machine on Mac (Mavericks). When I get to the step to import a ...
2
votes
1answer
2k views

How can I prepend to PATH while running Ansible's pip module?

I'm attempting to install psycopg2 into a Python virtualenv with Ansible's pip module, but I need to prepend an entry to PATH for it to build correctly (it needs to know the path to the directory ...
2
votes
2answers
1k views

Ansible : using different sudo user for different hosts

Recently started using ansible. We have servers where the application is setup under different users, like in server xyz.com, unix user is xyz_user and so on. So in case of xyz.com, ansible xyz.com ...
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
5answers
4k views

SSH aborts with Too many authentication failures

I'm attempting to run this simple provisioning script but I'm encountering errors when running vagrant up and then vagrant provision commands. I read that I needed to create a /etc/ansible/hosts file ...
2
votes
2answers
1k views

How do I authenticate a user on specific tasks using Ansible?

I'm getting 'msg: Failed to lock apt for exclusive operation' when trying to install some dependencies in a playbook using apt, with the vagrant user. I'm suspecting it tells me this because it can't ...
2
votes
2answers
564 views

Is the SSH SFTP subsystem required on the managed nodes for Ansible to work?

When I run: ansible all -a "/bin/echo hello" -u myuser I get back: mydomain.myhost.com | FAILED => failed to open a SFTP connection (Channel closed.) The SFTP subsystem is disabled on the ...
2
votes
3answers
1k views

Command or Shell task hangs when using ssh to create a tunnel

I am using Ansible to push configuration. I have a task inside a playbook that I want to start an ssh tunnel in the background for MongoDB. The task command that i'm using is - name: Start tunnel ...
2
votes
1answer
25 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 ...
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 ...
2
votes
2answers
369 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 ...
2
votes
1answer
344 views

Use Ansible to create vagrant box ?

I am new to Ansible and I bit confused if I can better use Vagrant to create VM instances (on EC2 and local virtual boxes) and use Ansible only for provisioning or if I can/should use Ansible to ...
2
votes
2answers
965 views

how to unify package installation tasks in ansible?

I am starting with ansible and will use it, among others, to install packages on several Linux distros. I see in the docs that the yum and apt commands are separated - what would be the easiest way ...
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 ...
2
votes
1answer
214 views

Deployment and configuration of complex python application scheme

Challenge Our fresh application uses several services: custom build postgresql, redis, celery, rabbitmq, haproxy, nginx, uwsgi, about 4 our internal processes (mostly python), AngularJS ...
2
votes
2answers
2k views

How do I enable additional debugging output from Ansible and Vagrant?

I'm investigating Ansible for server and application provisioning. My application is currently provisioned with shell scripts in Vagrant. Rather than rewrite my scripts I've taken a sample and ...
2
votes
2answers
2k views

Ansible not executing host specific playbook in Vagrant multi-machine provisioning

When provisioning with ansible in Vagrant, I am unable to get server/role specific playbooks to run. There is a common playbook run for all hosts, and that is working, but when trying to target a ...