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
25
votes
6 answers

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: $ sudo apt-get upgrade Reading package lists...…
Adam Matan
  • 13,194
  • 19
  • 55
  • 75
25
votes
4 answers

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.
Hyperfocus
  • 1,177
  • 4
  • 14
  • 23
24
votes
3 answers

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 approach as well (so, push-based), but state that…
Willem
  • 2,872
  • 4
  • 28
  • 35
23
votes
2 answers

Will Ansible prevent the execution of 'rm -rf /' in a shell script

This is based upon this hoax question here. The problem described is having a bash script which contains something to the effect of: rm -rf {pattern1}/{pattern2} ...which if both patterns include one or more empty elements will expand to at least…
aroth
  • 393
  • 3
  • 9
22
votes
7 answers

How to generate host SSH keys via ansible?

I'm trying to re-generate ssh host keys on a handful of remote servers via ansible (and ssh-keygen), but the files don't seem to be showing up. The playbook runs OK, but the files on the remote are not altered. I need to resort to the echo -e…
Server Fault
  • 3,714
  • 12
  • 54
  • 89
22
votes
4 answers

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 specific requirements which should have their own…
Navern
  • 1,619
  • 1
  • 10
  • 14
21
votes
3 answers

Easiest way to exit Ansible playbook while debugging

Say I'm debugging an Ansible playbook and want to quit after a given task (and not run through all of the following tasks). Is there any one-line magic command available, or do I have to manually create an exit/assert task? From the ansible-playbook…
s g
  • 611
  • 3
  • 9
  • 17
21
votes
1 answer

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 containing pg_config). I see that I can pass…
Collin Allen
  • 584
  • 1
  • 7
  • 16
20
votes
5 answers

How to destroy/delete/unset a variable value in Ansible?

Is there a way to destroy the variable in Ansible? Actually, I have a {{version}} variable being used in my all roles for respective packages. When I run multiple roles, the version value of one role is passed to another - this is due to for some…
MMA
  • 385
  • 3
  • 8
  • 16
20
votes
3 answers

Managing cluster of linux computers behind firewalls

My company's product is essentially a Linux box (Ubuntu) sitting in somebody else's network running our software. Up to now we had less than 25 boxes in the wild and used TeamViewer to manage them. We're now about to ship 1000 of these boxes and…
hakura
  • 303
  • 1
  • 5
20
votes
4 answers

Ansible change default value according to a condition

Is it possible to change a role variable default value according to some condition (i.e. the value of another variable)? Details I have two related variables for a command, env and composer_opts. If both are left at default (env = "prod" and…
Francesco Abeni
  • 575
  • 1
  • 4
  • 14
19
votes
3 answers

Ansible with_items doesn't print whole item?

I'm automatically securing SSL keys like this: - name: Find ssl keys find: paths="/etc/ssl/" patterns="*.key" recurse=yes register: secure_ssl_keys_result - name: Secure ssl keys file: path={{ item.path }} user=root group=root mode=600 …
Zulakis
  • 4,153
  • 14
  • 48
  • 76
19
votes
3 answers

ansible blockinfile disable marker

I'm new to ansible, however I was able to successfully use the blockinfile function. However I can't figure out how to prevent markers from being inserted. I read the documentation but it didn't appear to describe it. This is what shows up in every…
Nik
  • 197
  • 1
  • 1
  • 4
19
votes
4 answers

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 Ansible playbook to reconfigure it to use keys instead and disable root login with password on first run, so I need something like this: try to login with…
petr0
  • 313
  • 1
  • 2
  • 8
18
votes
1 answer

The value True (type bool) in a string field was converted to u'True' (type string)

I'm trying to follow parameters/examples, yet running into following WARNING message while executing Ansible'playbook: TASK [apt (pre)] ******************************************************************************************** [WARNING]: The value…
alexus
  • 13,112
  • 32
  • 117
  • 174