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
9
votes
3 answers

Sharing ansible variable between plays

This is a follow up to this question. I have a play that provisions a bunch of EC2 instances. By necessity, the hosts value is localhost (because when it's run there are no hosts), and the play assembles a new host list called ec2hosts, and…
Synchro
  • 3,148
  • 6
  • 27
  • 38
9
votes
3 answers

How to read a line from a file into an ansible variable

I'm trying to read the database password on a remote host from the file /etc/mysql/debian.cnf. Format of the file is below. Is there a way to parse out the password field so I can drop a mysql user via Ansible? # Automatically generated for Debian…
Server Fault
  • 3,714
  • 12
  • 54
  • 89
9
votes
1 answer

Register ansible variable in multiple tasks

I'm using the following tasks in an ansible script that installs updates on various servers. These tasks are for CentOS machines: - name: Check for outstanding reboot shell: needs-restarting > /dev/null || echo Reboot required when:…
Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89
9
votes
4 answers

Ansible syntax for regex_search using variable to match

What is the syntax within the regex_search() to match against a variable? For below, vcsourcekit = 10, I want to match regex ^10. It doesn't evaluate the variable, rather interprets literally. - name: Do something awesome vmware_guest: …
jacksonp
  • 151
  • 1
  • 3
  • 9
9
votes
2 answers

ssh-keyscan through a bastion

I have some test servers running behind a bastion on Openstack. The test stack gets deleted and created often. After the stack is created I run a set of Ansible scripts to install and configure the servers. I have the process almost completely…
Steve
  • 143
  • 1
  • 8
9
votes
3 answers

Configuration management for 'single server multiple admins'

We've set up a server that's running the infrastructure for a small association. So far, we've tried to manage the configuration with Ansible, but that has not been a great success. Perhaps we're doing it wrong. In principle, the idea is that this…
Joost
  • 177
  • 1
  • 9
9
votes
1 answer

ansible run global variable

I want to create a cluster of servers, using ansible. In one main-playbook, I include some sub-playbooks. - include: playbook_commandserver.yml - include: playbook_agent.yml In the playbook_commandserver.yml, I create the command-server (on…
doh-nutz
  • 227
  • 1
  • 3
  • 9
9
votes
3 answers

What is the equivalent of Puppet's `unless` in Ansible?

Background: in Puppet it is possible to execute a command unless it has already been executed: exec { '/bin/echo root >> /usr/lib/cron/cron.allow': path => '/usr/bin:/usr/sbin:/bin', unless => 'grep root /usr/lib/cron/cron.allow…
030
  • 5,901
  • 13
  • 68
  • 110
9
votes
2 answers

Immutable Server model with Docker/Ansible vs. Ansible, Puppet, and Foreman in AWS?

We are running into an interesting argument and are falling into two camps. I'm interested in any particular problems with either idea or gotchas we might be missing. Really, anything that can help us make a decision or point out things we are not…
9
votes
1 answer

Ansible - Access through Bastion w/ MFA

In my current environment, I have all my Linux servers only accessible through a bastion host, which has MFA enabled. I've managed to get Ansible to successfully talk to servers through the bastion, the only problem is that it establishes a new…
9
votes
5 answers

Ansible run ends up with MODULE FAILURE?

I am unable to figure out anymore on this as there's no way that I know of to get a "real" error message out of ansible. I run the below $ ansible -i /opt/ansible/ec2.py "tag_Function_app:&tag_Application_pro:&tag_Environment_pqa" …
ehime
  • 597
  • 2
  • 7
  • 15
9
votes
1 answer

Can ansible tasks be used as dependencies?

I currently have three ansible tasks: create vhosts test config reload nginx I now registered the last two as handlers, but the forward notifications of ansible feel wrong for what i am doing: create vhosts, notify test config (okay) test config,…
allo
  • 1,620
  • 2
  • 22
  • 39
9
votes
1 answer

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: encryptedpasswordhere tasks: - name: Creating users user:…
Francis
  • 481
  • 2
  • 7
  • 19
9
votes
4 answers

Accessing hostvars for a host group in Ansible

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 The task I am trying to get working: - lineinfile:…
melsayed
  • 1,122
  • 1
  • 6
  • 12
9
votes
2 answers

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 YAML -- they include content embedded a…
Charles Duffy
  • 946
  • 2
  • 10
  • 19