Questions tagged [ansible]

On-topic questions are concerned with the use of the tool itself. Installing Ansible and prerequisites, connection issues, ... are off-topic. Red Hat Ansible is a model-driven, configuration management, multi-node deployment/orchestration and remote task execution system. It uses SSH by default, so there is no special software to be installed on the nodes you manage. Ansible is written in Python but can be extended in any language.

Red Hat® Ansible® is a model-driven, configuration management, multi-node deployment/orchestration and remote task execution system. It uses SSH and Python by default, so there is no special software to be installed on the nodes you manage. Simply, it is an agentless configuration management tool. Ansible can be extended in any language, as long as the modules can process and respond with JSON.

The biggest advantage of Ansible over other configuration management technologies is, it is agent-less, i.e., no clients need to be installed, which avoids the chicken and egg problem.

The name "ansible" is taken from the science fiction concept of a machine capable of instantaneous or superluminal communication.

While only a Linux node can be used as a control machine, it remains nonetheless possible to have Windows nodes as a target into Ansible.

Ansible capabilities have gained a lot of modules to cover Infrastructure as a Service, Platform as a Service, and Service as a Service.

Ansible is also capable of interacting with a lot of network equipment like Cisco IOS, Juniper Junos or F5 Bigip.

Ansible has two major products,

  • Ansible Engine - Easily and quickly deploy IT services, applications and environments, remove barriers between IT teams by automating routine activities.

  • Ansible Tower - With Red Hat® Ansible® Tower you can centralize and control your IT infrastructure with a visual dashboard, role-based access control, job scheduling, integrated notifications and graphical inventory management. Easily embed Ansible Tower into existing tools and processes with REST API and CLI.

Relevant links:

Related tags:

23075 questions
6
votes
1 answer

Ansible - Filter a dict with a list of keys

I have a list which is actually a list of keys of a dict. And I want to get a concatenated string with the dict filtered on this list of keys and use it in a module option. My use case here is users that have a list of public keys's name to generate…
xenlo
  • 761
  • 1
  • 7
  • 21
6
votes
2 answers

How to create the multiple symlinks for the folders/files under the same source

I want to create the folder: temp2 which is able to store all the symlinks of the subfolders/files of other foder: temp1. with_items can help complete this task, but it needs to list down all the folder/file name as below script shown: - name:…
Jiajun Han
  • 63
  • 1
  • 3
6
votes
5 answers

Dealing with a password with special characters in Ansible

I'm trying to run an ansible playbook with the ansible_ssh_pass option to connect to the destination server. ansible-playbook test-playbook.yml -i hosts -u daniel --extra-vars "{"ansible_ssh_pass":"u5!vuL!<35Lf?<>n'x"}" The problem is that the…
radicaled
  • 2,369
  • 5
  • 30
  • 44
6
votes
4 answers

Disable systemd service only if the package is installed

This is what I have - name: disable os firewall - firewalld systemd: name: firewalld state: stopped enabled: no This task works fine on hosts where firewalld package is installed but fails on hosts where it is not. What is the best…
GMaster
  • 1,431
  • 1
  • 16
  • 27
6
votes
2 answers

How to set existing linux environment variables with ansible?

Ansible v2.4.0.0 on RHEL 6.x I see How to set linux environment variables with ansible, but it deals with setting a NEW environment variable. The solution does NOT work for me if I try to set my PATH variable. I do... - name: Add /usr/other/bin to…
Chris F
  • 14,337
  • 30
  • 94
  • 192
6
votes
2 answers

How to fix permission denied error when trying to install packages using Ansible?

I'm trying to write a simple Ansible Playbook, please look at snippets below. Using Ansible 2.4.0.0, Ubuntu 17.04, Python 2.7.13. This is my first time using Ansible and Playbooks so please don't be too harsh. What am I doing…
metalcamp
  • 526
  • 1
  • 6
  • 14
6
votes
1 answer

Puppet vs Ansible - why would organisation use both?

I have worked in an organisation where we used both puppet and ansible for configuration management... but I always wondered why would they use both tools ... what can puppet do that Ansible cannot do? The only thought that came to my mind was: -…
Buggy B
  • 623
  • 7
  • 18
6
votes
1 answer

Ansible called by Vagrant does not prompt for vault password

Summary I have a Vagrantfile provisioning a Virtualbox VM with Ansible. The Ansible playbook contains an Ansible Vault-encrypted variable. My problem is that Vagrant provisioning does not prompt for the password although I pass the option to do…
bjhend
  • 1,538
  • 11
  • 25
6
votes
1 answer

Using when conditional to match string in output register (Ansible)

Im unable to search my output variable for a specified string that im using for a when statement. The code below is supposed to check for the string "distribute-list" in the output variable but when run the playbook it gives the error. fatal:…
techkid
  • 139
  • 2
  • 2
  • 9
6
votes
3 answers

Ansible Recursive Directory Copy

Ansible version: 2.2.1.0 I'm having trouble copying the contents of a directory to a destination host in Ansible. My role directory structure looks like this: roles/server/ ├── defaults │   └── main.yml ├── files │   ├── Common-x86_64.repo │   ├──…
Patrick
  • 253
  • 1
  • 6
  • 23
6
votes
1 answer

Ansible string concat before filter

I was having an issue in my Ansible template where I wanted to create an HTTP basic auth credential out of two different variables a user inputs into the play. The first thing I tried to do was: basic_auth: "{{ user + ':' + pass | b64encode…
Breedly
  • 12,838
  • 13
  • 59
  • 83
6
votes
3 answers

Check authenticity of file in ansible

I have ansible role that downloads a script file, how can i check the authenticity of the file using md5sum before executing? - name: Add xx official repository for ubuntu/debain get_url: url: https://script.deb.sh dest:…
user6826691
  • 1,813
  • 9
  • 37
  • 74
6
votes
2 answers

Restore Selinux file context in ansible on multiple directories

I am currently using the sefcontext module to manage my servers SeLinux file context Below is an example of a task used to manage some of the directories. name: Set selinux policy for directories sefcontext: target: '{{ item.target }}(/.*)?' …
crusadecoder
  • 651
  • 1
  • 11
  • 26
6
votes
1 answer

Using --become for ansible_connection=local

With a personal user account (userx) I run the ansible playbook on all my specified hosts. In ansible.cfg the remote user (which can become root) to be used is: remote_user = ansible For the remote hosts this all works fine. It connects as the user…
Dnl
  • 101
  • 1
  • 2
  • 8
6
votes
1 answer

{{ ansible_hostname }} not working while calling directly with Ansible 2.3

Has anyone faced the following issue with "{{ ansible_hostname }}" while calling in a playbook task directly? Please suggest if there is other way around to do it or if I'm doing anything wrong here, I have tried it with both lineinfile & replace…
user7995721