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
13
votes
1 answer

How do I print the current hostname of a host in ansible

I wrote a role to edit the motd when user log into the machine, but I want to personalize the motd to print the hostname of the machine What variable do I use? or how do I do this? template? how? I used the copy module for the motd file So for…
grant tailor
  • 505
  • 2
  • 6
  • 13
12
votes
1 answer

Ansible display realtime shell stdout

I want see the realtime shell stdout, instead of registering in a variable and then display once it is completed. Example Playbook - test.yml - name: Testing RUN Shell Command hosts: localhost connection: local tasks: - name: Runnig…
Veerendra K
  • 313
  • 3
  • 4
  • 11
12
votes
6 answers

SSH access gateway for many servers

Managing multiple servers, in excess of 90 currently with 3 devops via Ansible. All is working great, however there is a giant security problem right now. Each devop is using their own local ssh key to gain access directly to the servers. Each devop…
John
  • 887
  • 4
  • 15
  • 25
12
votes
3 answers

Distribute ssh public keys among hosts

I'm setting up some machines with Ansible and need to enable password less connections between them. I've got a database master and several slaves. For initial replication the slaves need to ssh into the master and get a copy of the database. I'm…
soupdiver
  • 807
  • 2
  • 9
  • 26
11
votes
3 answers

Rollback the changes in Ansible

Is there any method to rollback the changes in Ansible? Suppose my play book contains different plays like create 5 users,install 3 rpms, start the services. If I want to rollback a certain play how can I do. Is there any possibility that we can…
KKE
  • 135
  • 1
  • 4
  • 11
11
votes
4 answers

Unable to create mysql database through ansible

I have mysql 5.7 installed on my remote syystem.I have to create a new database and a new user access to that database. As it is mysql-community-server 5.7 initially i have to grep password from /var/log/mysqld.log [root@lamp2 labadmin]# cat…
arun mohan
  • 183
  • 2
  • 2
  • 9
11
votes
2 answers

Can I use a dictionary variable to supply all task parameters?

I want to run a task where the parameters are filled using with_items, rather than having to manually write parameter:{{item.key}}. For example, I have this host var: HtpasswdsToSet: - path: /etc/nginx/passwdfile name: janedoe password:…
tom_nb_ny
  • 51
  • 1
  • 9
11
votes
1 answer

What is reasonable performance for a simple Ansible playbook against ~100 hosts?

We are starting to look at Ansible to replace an old cfengine2 installation. I have a simple playbook that: copies a sudoers file copies a templated resolv.conf (fed with group_vars and host_vars data) checks a couple of services are running checks…
user53814
  • 396
  • 1
  • 9
11
votes
2 answers

Why does an `"[Errno 2] No such file or directory", "rc"` issue occur when Ansible is executed remotely?

Running: - name: get vhosts command: rabbitmqctl list_vhosts register: vhosts changed_when: false by issuing sudo ansible-playbook file.yml results in: TASK [030.sensu : get vhosts] ************************************************** fatal:…
030
  • 5,901
  • 13
  • 68
  • 110
11
votes
2 answers

How to specify different hosts for different playbooks in one ansible script

As I understand, each playbook takes one hosts entry. I want to know that if I create a container playbook that includes other playbooks, can I parameterize the hosts for each playbook include. So something like --- - include playbook_1.yml …
Pankaj Lal
  • 231
  • 1
  • 3
  • 6
11
votes
3 answers

ansible manipulate file with a date format

In ansible, I would like to manipulate files/directories/archive that are composed or to composed like this: How would I do that. It seem Ansible is not able to handler that. (I doubt). So, what I do wrong ? Ex: - name: create file with a date in…
yield
  • 771
  • 1
  • 9
  • 24
11
votes
2 answers

Is it possible to synchronize contents of a directory only?

With the following task - name: synchronising ... synchronize: src=files/to/synchronize dest=/tmp/1 the files/to/synchronize directory is synchronized, and after it's done there is a /tmp/1/synchronize directory on the target machine. Is it…
zerkms
  • 431
  • 2
  • 5
  • 17
11
votes
2 answers

How to encrypt binary files in Ansible?

We are using Ansible Vault to store passwords, private keys for certificates etc. in our Ansible Playbook git repository. All of our existing private data is in text form, so we can store it in variables. These are then used in templates or with the…
Daniel Seither
  • 213
  • 2
  • 8
11
votes
3 answers

Ansible, Chef, Puppet or ____ : Which has the strongest Windows support and smallest init footprint

We do mostly (but not exclusively) win servers. Preferably, we can start the OS and do little or nothing to it to make it ready to receive commands (we know we may need to create a base image with an agent or ssh server on it). Need to be able to…
Jonesome Reinstate Monica
  • 5,445
  • 10
  • 56
  • 82
11
votes
2 answers

Kickoff Ansible Playbook after Cobbler install

I am working on implementing Cobbler and Ansible to do our server deploys and am having one final issue. My Ansible playbook works great, my Cobbler install works great, but the issue is in tying them together. I wrote a post-install trigger for…
Mildew
  • 111
  • 1
  • 3