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
14 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 ...
1
vote
0answers
13 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
18 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 ...
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 ...
6
votes
1answer
23 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 ...
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
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 ...
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 ...
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 ...
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 ...
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 ...
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
127 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
0answers
131 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 ...
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 ...
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
118 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 ...
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
156 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
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: ...
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 ...
1
vote
0answers
66 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 ...
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 # ...
0
votes
1answer
72 views

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 vriable do i use? or how do i do this? template? how? I ...
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?
0
votes
1answer
86 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
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 ...
0
votes
1answer
447 views

How to do a git pull/push using ansible

I am trying to do a git pull/push using ansible. I am running ansible on one server and want to automate or orchestrate a git pull/push on a remote host. Now since i didn't find a mmodule to do this ...
1
vote
0answers
102 views

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 ...
4
votes
2answers
243 views

Ansible: a host appears in more than one group, and both groups have the same tasks in them; any way to run tasks once?

I have a playbook that looks something like this: --- - hosts: group1 roles: - role1 - role2 - hosts: group2 roles: - role2 - role3 Now say I have a hosts file that has an ...
2
votes
0answers
186 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 ...
0
votes
0answers
84 views

Ansible :: advanced nested looping

I have to process output from CloudFormation Outputs that is: Ansible code that produces this output: - debug: var: stack.stack_outputs Output: ok: [localhost] => { "stack.stack_outputs": ...
3
votes
1answer
243 views

dict as value for YAML key in an Ansible task

I am unable to figure out how to pass a dictionary/hash-map of key-value pairs as the value for an option in an ansible tasks. Default Options: # roles/ec2/defaults/main.yml ec2: key_name: "{{ ...
1
vote
2answers
376 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: ...
1
vote
1answer
64 views

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 ...
0
votes
1answer
128 views

sudo and --ask-sudo-pass on CentOS 6.6

I'm running command: [kamil@server.com ]# ansible example.com -a "sudo id" --ask-sudo-pass sudo password: example.com | FAILED >> { "failed": true, "msg": "[sudo] password for kamil: ...
1
vote
1answer
87 views

ansible cannot download git repo on centos 7

I have this in my drupal roles to download drupal git --- - name: Install git yum: name=git state=latest - name: Clone Drupal git: repo=http://git.drupal.org/project/drupal.git ...
1
vote
0answers
128 views

error creating database using ansible on centos 7

I am trying to install mysql AND setup database using ANSIBLE on CentOS7(i have no idea why every documention in the world now ONLY talks about Ubuntu and NO CentOS anymore...really SAD!) here is my ...
1
vote
1answer
288 views

Running Ansible task as a specific user

I am trying to run a specific Ansible task as a different user than the one who is running the playbook. My .yml file looks like this: --- - hosts: staging_servers tasks: - name: check ...
0
votes
0answers
22 views

Python in the debian-installer context

My broader question is about using Ansible to perform the late_command in a preseeded Debian/Ubuntu install. The specific question is, is there some straightforward or documented way to get a working ...
1
vote
1answer
162 views

Ansible SSH as one user and Sudo as another

I am having trouble with configuring Ansible and sudo to allow me to SSH into a server and run a command as another user. I have gone through the questions / answers below and the Ansible ...
1
vote
1answer
160 views

Pubsub-style notify/handler in Ansible (restart all services using source code when it changes)

I have a role that updates source code of my project from git, let name it source_tree. Git repository contains source used by multiple services so I want to restart all services using that source on ...