Hot answers tagged

38 votes

Can I bypass host key checking in Ansible?

This is typically done by setting the following value in ansible.cfg: [defaults] host_key_checking = False If you don't want to modify ansible.cfg you can set an environment variable like so: ...
37 votes
Accepted

How is Ansible different from simply running a provisioning bash shell in Vagrant?

I never used Ansible but since a few weeks, I try to figure out what good Ansible could be in comparison with shell scrips–Which proves, at least in my case, that the haunting ad-campaigns they run ...
32 votes
Accepted

Ansible: Other option available for telnet check of open ports?

You can use the Ansible wait_for module which checks a specific TCP port is open. Since in this case, all ports should be open already, we can use a minimal no. of retries, just enough to cover ...
  • 832
27 votes

Can I bypass host key checking in Ansible?

In your ansible.cfg file you need to add the following line: ssh_args = -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no You could also add those options in your ~/.ssh/config on every ...
  • 5,677
24 votes
Accepted

How to test provisioning and configuration in Ansible setup?

Some options out there.. Testing tools: Sorted by github stars Serverspec - Ruby, most popular tool out there, built on ruby's rspec Goss - YAML, simple, <10MB self-contained binary, extremely ...
24 votes

How is Ansible different from simply running a provisioning bash shell in Vagrant?

When you put it this way, even if Ansible has some inherent advantages, the benefits of using familiar tools (in this case shell scripting) must be outweighed. I don't think there's a clear cut answer ...
  • 1,231
23 votes

Is there a way to run with_items loops in parallel in Ansible?

As @webKnja mentioned this is possible with async mode. I have recently discovered it myself and learned that you can use it in 3 different ways depending on your needs. Execute and poll the results, ...
  • 331
22 votes
Accepted

Ansible: What's the difference between task, role, play and playbook?

No, each has a different role and way of working. Starting with the easy ones: A playbook is simply a list of plays. The highest level of a playbook YAML is a list, and on that list only two things ...
21 votes
Accepted

What are the limitations of Puppet in comparison to Ansible?

There are of course several pro and cons for each of Puppet, Ansible, Chef and add your favorite tool here as well. So I'll try to stay away from opinion, and share what is great in Ansible as a ...
21 votes

Execute multiple Ansible tasks with the same list of items

Make separate tasks file make_site.yml: --- - name: Install apache site conf template: src: apache-sites-{{ site }}-conf.j2 dest: /etc/apache2/sites-available/{{ site }}.conf mode: 0644 ...
17 votes
Accepted

How to keep configuration files automatically during apt-get upgrade or install?

There are options you can pass through apt-get to dpkg that will handle the config choices. We usually do something like: apt-get install -y --no_install_recommends -o Dpkg::Options::='--force-...
  • 5,677
16 votes

How do I run ansible on one host at a time and break on a failure

Your playbook will stop when a failure occurs and you're using serial: 1 according to the documentation. By default, Ansible will continue executing actions as long as there are hosts in the group ...
15 votes
Accepted

How do you manage your inventory of spot instances on AWS with Ansible

You are looking for Dynamic Inventory Please look into ec2.py and ec2.ini of Ansible, and also the Dynamic Inventory docs of Ansible are very good for understanding how to manage your AWS inventory.
  • 2,766
15 votes
Accepted

What is Ansible's config equivalent of `--vault-password-file`?

Here is the definition: DEFAULT_VAULT_PASSWORD_FILE = get_config(p, DEFAULTS, 'vault_password_file', \ 'ANSIBLE_VAULT_PASSWORD_FILE', None, value_type='path') This means that you either put in ...
  • 5,677
15 votes
Accepted

Where to put ansible-vault password

The idea is to put all our sensitive data [...] The meaning of "all" in this sentence should be analyzed very carefully before implementing the solution that you plan. Ansible vault is a very useful ...
14 votes

How is Ansible different from simply running a provisioning bash shell in Vagrant?

The above answer covers part of it but misses one of the important elements: convergent design. I wrote some words a while ago about this in the context of Chef at https://coderanger.net/thinking/ but ...
  • 1,197
14 votes
Accepted

Ansible Playbook Localhost Invocation Working Directory

You can use env lookup plugins. Plugins are always evaluated in the context of "parent" ansible process on the control host. - debug: msg: "{{ lookup('env', 'PWD') }}" More lookup plugins can be ...
13 votes

How should I store my environment variables?

I've had two runs at doing environment variables in a scalable way and neither has ended up perfect because, as I've discovered, is a very tricky thing to get right. I'll give a summary of both of my ...
  • 1,644
12 votes

How to test provisioning and configuration in Ansible setup?

The two tools I've seen for this are InSpec and ServerSpec. Serverspec is a Ruby-based tool that builds on RSpec. InSpec is inspired by RSpec and ServerSpec. I've used ServerSpec. It's cool, but ...
  • 3,983
12 votes
Accepted

Is there an ansible module that check whether a port is not in LISTEN state?

I think you're looking for the wait_for module. It will allow you to check and make an action when a certain port is available and more.
  • 749
12 votes
Accepted

Applying ansible playbook to a docker container on a remote host

With the help of @Levi (refered to Stackoverflow) I managed to find a way to connect straigt into the docker containers using ansibles docker connection driver and the remote API capability of Docker. ...
  • 359
11 votes

What are the limitations of Puppet in comparison to Ansible?

No, people moving away from Puppet to Ansible (or vice versa) has nothing to do with what can or cannot be accomplished with either tool. Puppet/Chef/Ansible - it's mostly a matter of taste. For ...
  • 1,231
11 votes

How to test provisioning and configuration in Ansible setup?

When using configuration management tools, such as Ansible, the tool itself would be responsible preventing configuration drift. Once you used Ansible to set a certain configuration, repetitive ...
11 votes
Accepted

What is ansible-runner about?

This project is to support automation of running ansible playbooks. There is a GUI based project called Ansible Tower or AWX to do that, but ansible-runner seems to be the underlying layer of the ...
  • 5,677
10 votes
Accepted

Are configuration management tools appropriate to use as deployment tools?

In such context the typical advice should be immediately applicable: use the right tool for the job. But then you also cannot ignore nowadays the almost virulent tendency of software tools to extend ...
10 votes
Accepted

Ansible how to know what return value is provided by a specific module

if you do something like: - name: Launch instance ec2: register: data_struct You can then output all the values returned by doing this below the above code: - name: print all returned values ...
9 votes

Where to put ansible-vault password

We are planning to use ansible vault in our project to prevent leaking passwords or keys in git. Since you haven't yet implemented anything, you might reconsider this. Using a system like Ansible ...
9 votes
Accepted

How does Vagrant differ from Ansible and Docker?

Vagrant can complement Ansible and Docker. It is used to spin virtual machines inside which you install Docker and test your Ansible playbooks. You describe desired VM configuration with Vagrantfile ...
8 votes

What are the limitations of Puppet in comparison to Ansible?

Until Puppet 4.0 there was no easy way to orchestrate application spread over multiple servers or services, as it was hard to specifically order actions in Puppet, which was a design choice. Ansible ...
  • 5,677
8 votes

Git clean/smudge filters for ansible vault secrets

The problem here is caused by the random salt in ansible-vault encryption. You can hack VaultEditor class to pass the salt to it from an argument in ansible-vault. The random salt is generated in lib/...
  • 5,677

Only top scored, non community-wiki answers of a minimum length are eligible