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

How do I avoid showing skipped Ansible tasks?

The output of my playbooks are always completely swamped with useless output regarding which tasks have been skipped, which makes it annoying and time consuming to go through and find specific information I'm looking for. Here's an example of a…
asdoylejr
  • 281
  • 1
  • 2
  • 7
16
votes
3 answers

How can I have a nested loop with a fileglob pattern?

I'm trying to create a set of authorized SSH keys for a set of users in Ansible. I have a users variable set up like so: users: - { username: root, name: 'root' } - { username: user, name: 'User' } In the same role, I also have a set of…
mipadi
  • 315
  • 2
  • 3
  • 11
16
votes
2 answers

Where do I find the latest ansible error log

I used an ansible script to bring a server configuration up. I was running the script from inside the server and doing everything at the localhost inventory. Now the ssh connection I had to the server closed and I cannot find the log file. Where is…
Felipe
  • 263
  • 1
  • 2
  • 6
15
votes
2 answers

Add static route with Ansible

How do I add and delete routes in my route table with Ansible? I can't seem to find any network or system modules for this.
Jay
  • 275
  • 1
  • 2
  • 6
15
votes
2 answers

Why doesn't ansible have an archive module?

Googling for Ansible create tar doesn't yield any good results and while there is an unarchive module, there's no archive module. I'll probably solve it with the command module, but being new in Ansible it makes me think if I'm doing it wrong. I'm…
duality_
  • 304
  • 2
  • 9
15
votes
1 answer

Ansible: copy file depending on hostname or role

What's the best way to copy over a file depending on a hostname? I need to copy over files with different content but with the same filename to several machines. I have several files: file.role1 file.role2 file.role3 Depending on hostname and/or…
Tuinslak
  • 1,465
  • 8
  • 32
  • 56
15
votes
4 answers

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: / permissions: rX - path: /css permissions:…
Slava Fomin II
  • 1,701
  • 4
  • 17
  • 23
14
votes
4 answers

Is it insecure to have an ansible user with passwordless sudo?

I'm new to Ansible. Most VPS provisioning guides I've seen so far do this: disable root from logging in create a new user who can only log in with ssh (not password) add the new user to the wheel group, with passwordless sudo permission I…
lonix
  • 896
  • 10
  • 23
14
votes
2 answers

Force Ansible to log off to refresh user groups

I'm setting up a server with Ansible and Docker. I'm currently learning both technologies, so please bear with me if I'm being overly stupid here. In order to run run Docker commands, the user has to be in the docker user group. So I'm doing this: -…
14
votes
4 answers

Create non-root user and disable root SSH in Ansible

I'm trying to write an Ansible playbook to bootstrap my servers. By default on Linode I can only login as root with a password, so my playbook logs in as root, creates a non-root user with an SSH key, and disables root and password SSH. This is a…
JonathanR
  • 249
  • 1
  • 2
  • 3
14
votes
4 answers

How can I reduce the verbosity of certain Ansible tasks to not leak passwords into syslog?

Sometimes I would like to use Ansible's lineinfile or blockinfile modules to write a password into some configuration file. If I do so, the whole line or block, password included, ends up in my syslog. As I don't consider syslog to be a secure place…
aef
  • 1,745
  • 4
  • 25
  • 43
14
votes
1 answer

How to set scp_if_ssh = True for a group?

It's simple to set this variable in an ansible.cfg but it makes sense only for hosts that do not have sftp (and most likely python as well). So I have a group for routers – is it possible to set this variable in group_vars?
hryamzik
  • 817
  • 1
  • 8
  • 9
14
votes
3 answers

ansible-playbook --limit more than one host?

For various reasons/limitations I cannot make new groups in the inventory file and need to use --limit/-l to specify the hosts. I was told to do something like: ansible-playbook -i /path/to/my/inventory/file.ini -l server.1.com server.2.com…
ConstantFun
  • 283
  • 1
  • 2
  • 9
13
votes
2 answers

Ansible group_vars variable precedence (group_vars override other group_vars)

On Ansible 2.2, I have an Ansible hosts file: [webserver] aegir.dev [hostmaster] aegir.dev I have two group_vars/ files: # group_vars/webserver.yml my_var: - vagrant and # group_vars/hostmaster.yml my_var: - vagrant - aegir and the…
tvl
  • 369
  • 3
  • 4
  • 10
13
votes
2 answers

How to copy all childs except one in Ansible?

This documentation explains how to copy files and directories using the copy module in Ansible. How to copy all childs except one? Discussion The options do not clarify how it could be done. Copying all childs individually is not an option as the…
030
  • 5,901
  • 13
  • 68
  • 110