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

19
votes
3answers
3k 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 ...
14
votes
1answer
6k 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 ...
10
votes
1answer
1k 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 ...
6
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 ...
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
182 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 ...
4
votes
1answer
934 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
3answers
2k 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.
4
votes
2answers
602 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
521 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 ...
4
votes
1answer
639 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
314 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
354 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 ...
3
votes
1answer
690 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 ...
3
votes
3answers
1k 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
1answer
995 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 ...
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
1answer
318 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
1k 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 ...
3
votes
2answers
453 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
69 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
200 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
0answers
301 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 ...
2
votes
1answer
379 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 ...
2
votes
1answer
744 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
485 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
2answers
933 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
487 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
361 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
2answers
911 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
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 ...
2
votes
1answer
83 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
1answer
45 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 ...
2
votes
2answers
123 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
241 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
1k views

Ansible experts: 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
440 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
1k 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 ...
2
votes
2answers
1k 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 ...
1
vote
2answers
2k views

ansible: why is the file module skipping?

I have an ansible 1.1 playbook where I do something like this: - name: copy files sudo: True ...
1
vote
2answers
1k views

Ansible playbook not working trying to run patch

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 vars: home: '/home/vagrant' ...
1
vote
2answers
106 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
5answers
1k 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 ...
1
vote
1answer
210 views

Ansible AWX AMI/EC2 default username and password

What is the default username/password on the AWX AMI for EC2? admin/password is not working.
1
vote
2answers
64 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 ...
1
vote
3answers
992 views

Running an Ansible ping on a remote host fails with an unknown SSH error

I'm attempting to do an Ansible ping ansible all -m ping --ask-pass but I get SSH failures. As the debug log is rather extensive, I've trimmed down the below quote to where I think the problem ...
1
vote
2answers
40 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 ...
1
vote
1answer
61 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
1answer
163 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 ...
1
vote
2answers
590 views

Run included ansible task as standalone task

I have many Ansible playbooks that will get included in much larger playbooks. For example: --- - name: Add user me user: name=me comment="Me" uid=9999 groups=somegroup - name: Add my ssh public ...