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
1answer
46 views

SSH and sudo over a pseudo-tty terminal

I am trying to overcome some limitations in our environment to write up an authorized SSH file for passwordless ssh keys. I am requiring to perform an ssh as a to a target system, and then run a "...
4
votes
2answers
2k 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 ...
1
vote
1answer
20 views

ansible: setting variable according to ansible_os_family

Using ansible 2.0.2.0, I want to deploy a file to destination server. The destination folder is different on Debian and RedHat family. I have used set_fact, but it seems that it used the last defined,...
0
votes
1answer
17 views

Add and remove instances from azure load balancer programmatically

I'm new to Azure, and my team and me are setting a production environment in the Azure cloud, there will be a load balancer with a few instances behind, in the deployment process using Ansible I'd ...
1
vote
1answer
56 views

Ansible deploy multiple authorized_keys on multiple hosts

We need deploy keys on the servers, but trick is that the keys are many and do not all of them must have deploy on all servers. Now we do it follows: in vars roles/authorized_keys/vars/main.yml ...
0
votes
1answer
85 views

Ansible known_hosts task fails

I'm new with ansible and I created small ansible-playbook, that adds github ssh host key to known_hosts in each server: --- - hosts: all tasks: - name: Add github to ssh known-hosts ...
18
votes
2answers
6k views

Adding a user to an additional group using ansible

How can I add a user to extra groups in ansible? I don't want to existing set of groups to be replaced, only add the user to the sudo group.
12
votes
5answers
5k 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
1answer
13 views

Using external variables inside of an Ansible template

Background I am writing a playbook that installs two of the same web application on different machines. Both applications require their own MySQL/MariaDB database. I plan to pass the MySQL ...
3
votes
2answers
132 views

Ansible: updating select packages if installed without installing if not

I have a few tens of hosts that are a mix of CentOS 6 and 7. I recently started using Ansible to help manage them, but I'm still very much a newbie. Like everybody, I have a periodic need to update ...
2
votes
0answers
205 views

Centralized ubuntu update server [closed]

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 ...
4
votes
1answer
35 views

What is the equivalent of using hiera as an ENC in Ansible?

I use hiera as an External Node Classifier in Puppet in order to avoid that roles are deployed on nodes that are for example incompatible. Now I have two servers that are provisioned using Ansible. I ...
0
votes
1answer
17 views

What is the equivalent of Puppetboard in Ansible?

I would like to have an overview of all facts of all nodes in the cluster that are provisioned with ansible like Puppetboard is doing for all nodes that are provisioned using Puppet
5
votes
1answer
9k views

Ansible playbook to upload and execute a python script

My playbook is as below: - hosts : mygroup user : user sudo : yes tasks : - name : Copy script copy : 'src=/home/user/Scripts/logchecker.py dest=/opt/root2/logchecker.py owner=root group=...
22
votes
3answers
15k views

Ansible: copy template only when destination file does not exist

I'm using Ansible 1.6.6 to provision my machine. There is a template task in my playbook that creates destination file from Jinja2 template: tasks: - template: src=somefile.j2 dest=/etc/somefile....
2
votes
0answers
36 views

What is the equivalent of r10k in Ansible?

Puppet modules like the ones from puppetforge could be deployed using r10k. Question What is the equivalent of this tool in Ansible? Attempt to answer the question This Google Q&A was found ...
1
vote
1answer
41 views

How do I get the ec2 tag Name from my ec2 hosts?

I'm wanting to extract the "Name" tag from ec2 instances. How do I do that? It doesn't seem to be part of ec2_facts
1
vote
1answer
2k views

Ansible role post tasks

Is it possible to have "post tasks" in a role? i.e tasks defined in a role, that would run at the end of the play? For example, I have a common role, which most other roles depend on. The common role ...
15
votes
4answers
13k views

Iptables management with ansible in huge environment

What is the best way to manage iptables from one point and have the ability to edit something on local server. We need to add some rules centralized on all servers, but we have specific servers with ...
1
vote
1answer
1k views

Ansible run ends up with MODULE FAILURE?

I am unable to figure out anymore on this as there's no way that I know of to get a "real" error message out of ansible. I run the below $ ansible -i /opt/ansible/ec2.py "tag_Function_app:&...
2
votes
1answer
80 views

Ansible-galaxy not working with sudo

I'm having problems instaling plugins with ansible-galaxy. I've tried 3 things: Instaling without sudo: ansible-galaxy install sfromm.epel [WARNING]: - sfromm.epel was NOT installed successfully: ...
8
votes
1answer
114 views

What is the current state of the art for user management with Ansible?

I have been using Ansible, to great success, for ~3 years now for managing an ever-growing flock of linux systems. Before diving into my question, I need to set some context. As part of my day job, I ...
0
votes
2answers
54 views

Failed to install the ansible with pip

I tried to install ansible with the following commands: docker run -ti --rm ubuntu:14.04 bash echo "===> Updating cache..." && \ apt-get update && \ \ \ echo "==...
6
votes
2answers
842 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 ...
-1
votes
0answers
39 views

ansible - create a loop directory

Can some please clarify me the ansible issues which I am having? On default main.yml I have below variables: my_path: "/etc/newfiles" my_plugin_location: "/etc/myfile/plugins" my_tmp_dir: '"{{ ...
0
votes
1answer
1k 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 ...
3
votes
3answers
6k 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: ...
0
votes
0answers
13 views

Running ansible role and dependencies with different ssh login method

I am writing an Ansible role (say role A) that should have dependency at another role (say role B). However role B has to be run with --ask-pass, i.e. you can only run it with password, not an ssh ...
1
vote
2answers
926 views

Ansible command line retriving ssh password from vault

I am trying to setup Ansible to manage Linux boxes from different customers and here are what we have to work with. No Pub key authentication - I wanted it as much as you do but it won't happen any ...
0
votes
1answer
26 views

Ansible not executing within Packer Build

I am currently experimenting with deploying using Packer’s Ansible local provisioning and for some odd reason, it doesn’t appear to be executing the tasks in the playbook. Packer, after installing ...
5
votes
4answers
9k views

ansible print debug msg variable

I try to print the previously registered mosh_version variable using the ansible debug msg command like this: - name: Print mosh version debug: msg="Mosh Version: {{ mosh_version.stdout }}" It ...
0
votes
0answers
16 views

Using ansible for multiple web apps on one server

So far, most of the ansible guides and documentation I have seen was about having one application that runs on multiple servers. But I would like to automate the opposite: I have several small rails ...
0
votes
0answers
59 views

How can I use variables in Ansible expect module questions?

I'm trying to use a variable in Ansible playbook using the expect module. It seems like I can use it for the answer, but not the question - is there some escaping I can do to make this work? ...
0
votes
1answer
108 views

Windows Server 2012 R2 not downloading recommended updates

I have multiple Windows Server 2012 R2 running on Azure (IaaS VM's). We perform monthly maintenances on these servers via Ansible, this includes Windows updates (recommended and critical updates). ...
2
votes
2answers
60 views

Ansible, AWS, other host based on tag

I am creating Ansible playbooks which create our system's infrastructure in AWS. Obviously dynamic inventories using ec2.py are involved. I first create a utility server, then a web server, and I ...
0
votes
1answer
24 views

create a user and associate with existing pem file

I have an ec2 instance on which i am running ansible.I want to create a user with a playbook, but without a password and the user must be using existing pem file for authentication and must be able to ...
0
votes
1answer
45 views

Deploying a windows machine with ansible and sysprep

I was wondering if you could help me? I'm trying to deploy a windows server 2012R2 base image using the vsphere ansible module. I have created a Vsphere template where the guest machine has WinRM ...
1
vote
0answers
36 views

How to run Ansible's gce.py script from inside an instance running in the cloud?

My goal is to create a compute engine instance in Google cloud from which I can run ansible scripts to further create additional instances that will run containers via GKE. I've figured out a number ...
1
vote
1answer
36 views

Why is module os_keypair not returning private_key?

I am deploying to Rackspace Cloud with the OpenStack ansible module. I am facing an issue with the SSH keypair creation. It creates the public key, and installs it on the host. However I can see that ...
1
vote
1answer
34 views

Ansible best practice for a file for every host

I need to have a different file for every host, where is the best place to store that? Is it considered good practice to store it under files folder and store the path under host_vars?
0
votes
1answer
19 views

How to create a vagrant box in a remote server

I've been using vagrant since a few months to test server configurations (with ansible). At work we have some spare internal servers that I would like to use for our continuous integration system. ...
1
vote
1answer
29 views

Parse through a list of Ansible variables and refer to itself while running task

Problem I have a simple Ansible playbook that creates a list of tmux sessions and then runs a script inside of each session. I am trying to give the tmux sessions names in my vars.yml file. My ...
0
votes
1answer
2k views

Issues with ssh and Ansible

When running an ansible task (with a script action), I'm getting this error message: stderr: OpenSSH_6.0p1 Debian-4+deb7u2, OpenSSL 1.0.1e 11 Feb 2013 debug1: Reading configuration data /etc/ssh/...
0
votes
2answers
32 views

Ansible - multiple statements withe the same variables

I'm new to ansible, so I might be missing something obvious. I have a playbook doing the following: - name: Create real users user: name="{{item.user_name}}" comment="{{item.user_description}}" ...
11
votes
7answers
6k views

Ansible stuck on gathering facts

I'm having some odd issues with my ansible box(vagrant). Everything worked yesterday and my playbook worked fine. Today, ansible hangs on "gathering facts"? Here is the verbose output: <5.xxx....
0
votes
1answer
34 views

How do I organize Ansible's hosts file per role and location?

My project is to use Ansible to manage three server clusters each of which live in different cities and states, Boston, Chicago and Los Angeles. So in each data center I have two httpd servers, three ...
-1
votes
1answer
103 views

How can i check software version with Ansible?

I have three linux servers and i created the ansible inventory file: [web] 192.168.0.155 192.168.0.165 192.168.0.175 And i have playbook.yml: --- - hosts: web tasks: - name: Check drinks ...
-1
votes
3answers
38 views

How to manage hosts with multiple sites using Ansible?

I have this sample inventory file: [web1] // Web Server 1 contains the following sites: example1.com example2.com [web2] // Web Server 2 contains the following sites: example3.com example4.com But ...
0
votes
1answer
75 views

resolvconf coupled with dnsmasq and lxd

Q: How do I programmatically add a persistent resolvconf entry for my lxd based dnsmasq? I have a very base installation of Ubuntu 16.04 server. I have installed and configured lxd and created a ...
14
votes
6answers
24k views

SSH aborts with Too many authentication failures

I'm attempting to run this simple provisioning script but I'm encountering errors when running vagrant up and then vagrant provision commands. I read that I needed to create a /etc/ansible/hosts file ...