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.

learn more… | top users | synonyms

0
votes
0answers
13 views

Fire multiple instances of a handler in Ansible

(Related to Callbacks or hooks, and reusable series of tasks, in Ansible roles): Is there any way to have one notification in Ansible fire multiple handlers? Consider a webserver where each app ...
0
votes
0answers
6 views

Appending to lists or adding keys to dictionaries in Ansible

(Related to Callbacks or hooks, and reusable series of tasks, in Ansible roles): Is there any better way to append to a list or add a key to a dictionary in Ansible than (ab)using a jina2 template ...
0
votes
0answers
8 views

Immediate handler, or flushing just one handler, in Ansible

(Related to Callbacks or hooks, and reusable series of tasks, in Ansible roles): Does Ansible provide a way to flush notifications for just one handler? Like meta: flush_handlers, but for a single ...
0
votes
0answers
10 views

Callbacks or hooks, and reusable series of tasks, in Ansible roles

I'm struggling with making my Ansible roles somewhat composeable and re-usable. I have a role that performs several series of steps. Depending on the other roles being applied to a host, other roles ...
2
votes
1answer
17 views

Ansible Playbook With Inventory-based Tasks

Is it possible to use the content of the inventory file (or a dynamic inventory) to create tasks? For instance, let's say I wanted to configure a monit server dynamically to remotely monitor N ...
6
votes
1answer
22 views

Configure SSH credentials per environment

I'm trying to figure out how to configure the SSH credentials separately for a production and staging environment with Ansible. I understand that you can configure the server IP addresses and ...
1
vote
0answers
26 views

Ansible 'include' statements and autopath

My ansible's 'include' statement was working fine, but recently after including ymls in subfolder, it somehow brokes the role's path. Here's the tree of my role: . ├── site.yml ├── inventory.ini ...
4
votes
2answers
663 views

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 playbook to reconfigure it to use keys instead and disable root login with password on first run, so I need ...
0
votes
1answer
14 views

Ansible EC2 Hosts Script Missing Instance

For some reason, ansible's ec2 hosts is missing instances. ec2-describe-instances returns the correct instances, but /etc/ansible/hosts does not: [root@or-manage ec2-user]# ec2-describe-instances | ...
0
votes
0answers
32 views

create a record in Active Directory DNS for Openstack instance [closed]

I am working with Ansible to create an Openstack instance and assign a floating IP. I would also like to add a record for this IP to AD DNS following the creation of the instance. I have checked and ...
0
votes
1answer
433 views

Why doesn't nginx serve my 404 page under vagrant?

I have a static HTML site with a 404 page at /404/index.html. Vagrant is mapping port 80 to 9000 so I access my site at http://localhost:9000. The site is browsable, but if I try to force a 404 error ...
3
votes
1answer
469 views

Vagrant: I need a provisioning system with no dependecies

Getting off the ground with a vagrant config. Host is Windows. I have a really simple config, so I wanted to use Ansible, but got this: [default] Running provisioner: ansible... The executable ...
-6
votes
1answer
103 views

Does a tool like ansible make it possibly to get a secure server, without knowing a lot about security? [closed]

If I modified something like this into a server similar to the one described here with a minimal set of services (what you need for ssh, basically) would it be reasonably secure? sovereign: A set ...
4
votes
7answers
3k views

Install RVM with ansible

I am attempting to install rvm with ansible on a centos-based vagrant box. The command I am running is: vars: user: "foo" - name: install rvm action: command sudo -u $user bash ...
0
votes
2answers
99 views

How to see stdin of ansible commands

This is basically the same question as how to see ansible stdout only I wanted to see the commands generated and passed in by ansible. Is it possible?
1
vote
2answers
101 views

Display output with Ansible

I have a Ansible play for PGBouncer that displays some output from a stats module built into PGBouncer. My issue is that when Ansible prints the output to the terminal it mangles the newlines. ...
1
vote
2answers
41 views

How can I stop ansible from writing passwords to the logfiles?

I am setting up a MySQL server and want Ansible to set the mysql-root password during installation. With the help of the internet I came up with this solution: - name: Set MySQL root password before ...
1
vote
2answers
375 views

Using ansible to add users' public keys to one user's authorized_keys file

Trying to add two people's Github public keys to a user's authorized users file. I am able to successfully retrieve the SSH keys: --- - hosts: 127.0.0.1 connection: local vars: my_users: ...
4
votes
2answers
756 views

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: $ ...
0
votes
2answers
55 views

Managing thousands of machines with approval controls [closed]

We are a startup that is just getting up to speed and running into the problem of managing hundreds of machines, and having to do nightly and weekly releases to all of them as well as managing their ...
17
votes
5answers
905 views

When is it appropriate to use a configuration manager (eg Puppet / Chef / Ansible)?

At my current workplace, I look after two VMware host machines, an OpenBSD physical machine, three Debian VM's, and six Windows Server VM's (2008/2012). I'm considering implementing a configuration ...
0
votes
3answers
44 views

Ansible repeating roles

I use Ansible to manage some web- and database servers which run websites for multiple vhosts. For each website I need to assign a database role to the dbservers group and a website role to the ...
5
votes
1answer
61 views

Can't install PM2 services via Ansible on an Ubuntu EC2 instance

I'm using Ansible to create a pm2 service on a EC2 / Ubuntu instance. Below is the script. When I run it, PM2 is installed and the service is enabled. When I run pm2 list, I don't the see the ...
8
votes
3answers
2k views

how to unify package installation tasks in ansible?

I am starting with ansible and will use it, among others, to install packages on several Linux distros. I see in the docs that the yum and apt commands are separated - what would be the easiest way ...
1
vote
0answers
36 views

Ansible using role template vs copying static configuration file [closed]

I have been using ansible to manage the haproxy configurations for a few servers and I really like the tool. It makes deploying new servers and keeping the configurations in sync a breeze. One ...
2
votes
0answers
36 views

Centralized ubuntu update server

I am in the process of configuring a Central Update Server so we can better manage the security updates on our ubuntu based cloud servers. Here is my plan so far Install apt-mirror on cloud instance ...
2
votes
0answers
29 views

How do I make Ansible actually compile a config file having changed my debconf settings for an application?

I'm using Ansible to try to configure all of the workstations involved with a particular project to be able to use BitTorrent sync with a standard configuration (this is actually just an example of ...
0
votes
1answer
122 views

Convert value of an Ansible variable from lower case to upper case

I am working on a playbook to join linux systems to Active Directory. I can't seem to find a way to convert the value of ansible_hostname to uppercase. One of the commands I need to run requires the ...
0
votes
1answer
117 views

ansible-vault encrypt credentials

I have an inventory file with one host: 10.1.32.123 ansible_ssh_user=vagrant ansible_ssh_pass=vagrant My yaml file: - hosts: all sudo: yes gather_facts: yes serial: 20 roles: It's ...
0
votes
0answers
128 views

Ansible AWS dynamic inventory: `./ec2.py --list` unauthorized

I'm trying to use Ansible's ./ec2.py --list --refresh-cache to list my AWS EC2 instances. Via documentation, I've run through this checklist: AWS (docs via Amazon's Controlling Access to Amazon EC2 ...
0
votes
2answers
21 views

Automatic retrieval of current mapping debian stable -> released name

I'm automating my customary debian setup using ansible. The playbook is supposed to treat testing/unstable and stable differently: the former are to be maintained "clean", while the latte is to ...
2
votes
1answer
1k views

Ansible - Try to ping connection between localhost and remote server

I am beginner in Ansible and I am trying to learn it. I use the ansile docs Getting Started and I am faced with problem which stopped me. My problem rely on that when I've tried to use a command ...
0
votes
1answer
34 views

Sharing simple tasks across roles in ansible?

I have a couple of different machine types that all need to have the official postgres APT repo defined for them in order to be able to apt-get install the right version of tools. These different ...
0
votes
1answer
31 views

Correct way to model so that execution order is correct - Ansible

I wish to do 4 tasks on all machines in a group. Once complete in all machines fully, task 5 must be run on one machine (Assume this is a DB instance). Once task 5 completes, tasks 6 to 10 are run on ...
0
votes
1answer
39 views

Ansible failing on condition check for role. What is a proper one?

I'm trying to do an advanced version of your script where ansible running a role basing on a result of "when" condition. In my scenario ansible connects as root, creates ansible_bot user, grants him ...
5
votes
2answers
2k views

Ansible: Excecute task only when a tag is specified

Ansible tags can be used to run only a subset of tasks/roles. This means that by default all tasks are executed and we can only prevent some tasks to execute. Can we limit a task to be exectued only ...
3
votes
1answer
52 views

Validate nginx.conf during ansible deploy

I have a single Ansible-provisioned server running a number of sites. My Ansible tasks look roughly like: - name: site nginx config template: src="nginx-site.conf.j2" ...
0
votes
1answer
309 views

recommended way to configure a centos-7 network interface with static settings via ansible

I'm new to ansible and a little googling hasn't lead me quickly towards the right solution to my question. What's the 'with the grain' way to assign static network settings to a centos-7 host with ...
29
votes
4answers
7k views

How can I implement ansible with per-host passwords, securely?

I would like to use ansible to manage a group of existing servers. I have created an ansible_hosts file, and tested successfully (with the -K option) with commands that only target a single host ...
2
votes
0answers
66 views

Need to check whether you need to reboot for a kernel update?

I'm using Ansible to check hosts if they need to be rebooted if the /vmlinuz kernel doesn't resolve to uname -r. The if condition is although always identifing a reboot even though the test machine ...
1
vote
1answer
153 views

Ansible: restart service only if it was running

In an Ansible playbook, I'd like to restart a service after updating config file, but only if it was already running. I do not want to control the state of the service with ansible, only restart it ...
0
votes
1answer
85 views

Using an Ansible Do-Until loop to manage outdated directories

I have a directory that will have a series of subdirectories added to it, and I want to maintain only the most recent 5. Here are the two tasks that I think should accomplish this: - name: Get ...
0
votes
0answers
31 views

how to have one role deploy different files per hosts in ansible [duplicate]

I have a role in ansible but and want to use the copy module in ansible to copy the specific files for specific hosts. Not exactly but pretty same scenario .../roles/serverfiles/tasks/main.yml # ...
1
vote
1answer
220 views

Ansible Role include

I have a task that can be used by several roles. I added it to lib/mycommontask.yml On my playbook on roles/my-project/tasks/main.yml I have: -- - include: lib/mycommontask.yml vars: project: ...
0
votes
0answers
37 views

Ansible fails to create Amazon EBS-ctorage

I have a problem - trying to automate the purchase of new EC2 instances. Here's my playbook: --- - name: Provision new EC2 instance hosts: local connection: ...
2
votes
4answers
2k views

Command or Shell task hangs when using ssh to create a tunnel

I am using Ansible to push configuration. I have a task inside a playbook that I want to start an ssh tunnel in the background for MongoDB. The task command that i'm using is - name: Start tunnel ...
0
votes
1answer
48 views

Hudson GUI cannot run a job with same command that runs fine from the shell

I get this error while trying to run a job in hudson here is the log Started by user anonymous [workspace] $ /bin/bash -x /tmp/hudson3189813701500418318.sh + date Thu Feb 19 17:02:03 EST 2015 + fab ...
2
votes
1answer
513 views

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 ...
1
vote
0answers
63 views

Managing OpenVZ containers with Ansible

Is there any elegant way to manipulate OpenVZ containers with Ansible? Sure I can install an SSH daemon on each and put my public keys, but as soon as there is a vzcl enter command maybe there is a ...
2
votes
0answers
185 views

Ansible: setting hostname over inventory

I am new to Ansible, but a long time programmer, also worked with puppet a bit. Here is the situation, I need to initialize some network appliances, they don't talk bash so I'm using the raw module ...