Questions tagged [ansible]

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.

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. It manages nodes over SSH and does not require any additional remote software to be installed on them. Modules work over JSON and standard output and can be written in any programming language. The system uses YAML to express reusable descriptions of systems.

The platform was created by Michael DeHaan, the author of the provisioning server application Cobbler and co-author of the Func framework for remote administration. It is included as part of the Fedora distribution of Linux, owned by Red Hat inc., and is also available for Red Hat Enterprise Linux, CentOS and Scientific Linux via Extra Packages for Enterprise Linux (EPEL) as well as other operating systems. Ansible was commercially supported and sponsored by AnsibleWorks. Since October 2015 Ansible is owned by RedHat.

It was named by DeHaan after the fictional instantaneous hyperspace communication system featured in Orson Scott Card's Ender's Game.

1762 questions
11
votes
2 answers

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

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 install it first. However I've discovered two ways…
Hyperfocus
  • 1,177
  • 4
  • 14
  • 23
10
votes
1 answer

Where to specify Ansible role's dependencies

It seems that Ansible Galaxy will understand it has to download dependencies if those are specified in either meta/main.yml or a requirements.yml file. Is there a best practice for this?
gtirloni
  • 5,746
  • 3
  • 25
  • 52
10
votes
1 answer

What is the current state of the art for user management with Ansible?

I have been using Ansible, to great success, for ~3 years now for managing an ever-growing flock of linux systems. Before diving into my question, I need to set some context. As part of my day job, I do systems design, deployment, and maintenance…
EEAA
  • 109,363
  • 18
  • 175
  • 245
10
votes
5 answers

How to enumerate network interfaces in Ansible

I'd like to get an ordered list of the network interfaces on a machine using Ansible. Modern Linux systems don't use eth0, eth1, etc. So the names are unpredictable. On our network we connect the lowest numbered interface to the LAN and the highest…
Neik
  • 404
  • 2
  • 5
  • 10
10
votes
3 answers

How to combine two lists?

I have a task which uses with_subelements but it's terrible slow for big list (especially that most of the elements has duplicates and I don't need to run it multiple times for them). So I'm looking for a way to optimize it somehow. I wish to get…
pawel7318
  • 213
  • 1
  • 2
  • 11
10
votes
4 answers

Execute copy and set only if something changed

For Ansible, I have a role that sets the time zone and populates the setting the (Ubuntu) base system, - name: set timezone copy: content='Europe/Berlin' dest=/etc/timezone owner=root group=root mode=0644 …
Nico Schlömer
  • 215
  • 1
  • 2
  • 8
10
votes
1 answer

Configure SSH credentials per environment

I'm trying to figure out how to configure the SSH credentials separately for a production and staging environment with Ansible. I understand that you can configure the server IP addresses and hostnames separately using different inventory files by…
Uyghur Lives Matter
  • 226
  • 1
  • 4
  • 15
10
votes
2 answers

Ansible: restart service only if it was running

In an Ansible playbook, I'd like to restart a service after updating config file, but only if it was already running. I do not want to control the state of the service with ansible, only restart it if it was previously started. I could use a custom…
Beli
  • 268
  • 1
  • 2
  • 6
10
votes
2 answers

Ansible: a host appears in more than one group, and both groups have the same tasks in them; any way to run tasks once?

I have a playbook that looks something like this: --- - hosts: group1 roles: - role1 - role2 - hosts: group2 roles: - role2 - role3 Now say I have a hosts file that has an entry like…
Asfand Qazi
  • 244
  • 1
  • 2
  • 11
10
votes
2 answers

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 Ansible server, I run as my user (NIS user) and use…
BrM13
  • 163
  • 1
  • 1
  • 10
10
votes
1 answer

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 vars: home: '/home/vagrant' curl_version:…
Duncan Lock
  • 1,812
  • 1
  • 17
  • 18
10
votes
4 answers

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 state=present groups="group1", "group2", "group3" …
Hyperfocus
  • 1,177
  • 4
  • 14
  • 23
10
votes
4 answers

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?
Ryan
  • 5,831
  • 24
  • 72
  • 91
10
votes
1 answer

How to NOT print items in an Ansible loop error without no_log

When I execute an ansible module with a loop that has dictionaries with values to be used by the module, including confidential information, I can hide it using loop_control.label, but not when an error happens. - ansible.module: arg1: "{{…
Lucas Basquerotto
  • 201
  • 1
  • 2
  • 7
10
votes
1 answer

Converting string to integer in Ansible Playbook

I am getting a count from powershell command and registering it on variable. I have to use that count in when condition. I have changed it to int before using it in when condition too. Still that task ( mail notification) is getting skipped,…
saffron
  • 143
  • 1
  • 3
  • 12