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
17 views

Restarting network interfaces that have changed with ansible

I've got an ansible role that - name: add virtual interface configs for vlan template: src=ifcfg-eth.vlan.j2 dest=/etc/sysconfig/network-scripts/ifcfg-{{ item.device }} with_items: "{{ ...
2
votes
2answers
857 views

Ansible with Github: Permission denied (Publickey)

I'm trying to understand the GitHub ssh configuration with Ansible (I'm working on the Ansible: Up & Running book). I'm running into two issues. Permission denied (publickey) - When I first ran ...
1
vote
1answer
64 views

Ansible host “unreachable”: true

I just started learning the basics of Ansible. And facing some problem related to server connectivity via SSH. I created a folder named publich_html and put my code into that folder and changed the ...
1
vote
1answer
11 views

Via ansible change password of non-root account using passwd command and picking old password from ansible files

I have got a lot of systems having a common username to login. The password is also same for most of the systems. I have 1 inventory file with all the systems. For the systems that have a different ...
0
votes
0answers
13 views

Automate vm creation and configuration with ansible

I am looking at different ways to consistently, quickly and automatically provision and configure linux VMs. I am currently using ansible to configure all my servers. It really is the business. I ...
4
votes
3answers
4k views

How to fetch multiple files from remote machine to local with Ansible

I would like to copy files from remote directory to local directory with Ansible but fetch module allows me to copy only one file. I have many servers from which I need files (same directory each ...
0
votes
0answers
13 views

Ansible fails on AWS domain name, but not on ip and other domain name

I have a machine which I am trying to ping via ansible to test my connection. Originally we were using the AWS domain name (note, not using the actual addresses): ...
2
votes
1answer
49 views

How can I use Ansible to conditionally append a line in a file?

I'm trying to create an Ansible task that sets up trim/discards. I have a playbook that takes care of everything else (LVM, fstrim), but I can't figure out how to get crypttab configured properly. ...
1
vote
1answer
36 views

How to fetch specific data from a module in ansible to be used under another host

Here is a Linode playbook to spin a cloud server instance: --- - hosts: 127.0.0.1 connection: local tasks: - name: Create Linode Machine linode: api_key: 'blablabla' name: ...
3
votes
1answer
134 views

Ansible Playbook: Ensure a process is running on any one node of a cluster?

Ansible makes it easy enough to ensure that a process is running on every host. I could do something like: --- - hosts: app_cluster tasks: - name: Look for the "foo" process shell: ps -ef ...
2
votes
0answers
21 views

Passing parameters to ansible callbacks

I have recently been alerted to the existence of ansible callbacks, which appear to be a way to modify some of the defaults under given conditions. However, I have scoured the ansible documentation ...
8
votes
3answers
12k views

How set to ansible a default user/pass pair to ssh connection

I am using ansible and I have it configuration in my inventory/all: [master] 192.168.1.10 ansible_connection=ssh ansible_ssh_user=vagrant ansible_ssh_pass=vagrant [slave] 192.168.1.11 ...
6
votes
2answers
145 views

Immutable Server model with Docker/Ansible vs. Ansible, Puppet, and Foreman in AWS?

We are running into an interesting argument and are falling into two camps. I'm interested in any particular problems with either idea or gotchas we might be missing. Really, anything that can help us ...
1
vote
0answers
19 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 ...
0
votes
1answer
2k views

Ansible shell command fails under sudo when it should succeed

I have an Ansible task based on https://github.com/al3x/sovereign/blob/master/roles/tarsnap/tasks/tarsnap.yml#L2 that keeps failing when it should succeed. I used to run the role with ...
0
votes
0answers
20 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: ...
1
vote
1answer
33 views

Unable to get module for managing windows system working in ansible

I am learning ansible. My laptop is running Windows 7 and is part of a domain. I have installed Ubuntu linux inside a VM on my laptop and installed Ansible in it, and other python and kerberos ...
0
votes
1answer
24 views

Ansible and fact dependent variables

Can an inventory variable in Ansible be dependent on a fact? Namely, I have a variable in group_vars/all/cars.yml that I would like to set to a value dependent on ansible_fqdn. Like: --- ...
0
votes
2answers
34 views

Setting up icinga2 nodes via Ansible: how do I get the ticket from the master?

I'm trying to write an Ansible playbook to set up Icinga2 nodes, but each host needs a unique ticket from the Icinga2 master to authenticate. Right now I'm thinking of ssh'ing out from the node to the ...
0
votes
1answer
24 views

Ansible stat, register and when while looping

I have this: - stat: path=/etc/pki/tls/certs/{{ item.ServerName }}.crt with_items: - "{{ prod }}" register: sslcheck - debug: var=sslcheck - name: Create self-signed SSL ...
1
vote
1answer
57 views

Changing the IP of a vSphere guest VM using Ansible

I want to deploy a VM from a template on vSphere and change the new instance IP via Ansible (2.x). I've managed to clone the template with vsphere_guest module but I didn't find a way to change the IP ...
1
vote
1answer
261 views

SSH ProxyCommand not working with ansible_ssh_common_args

I'm using a jump box (server A) to access server B. As per the ansible docs here, I have the following: ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q ec2-user@A.A.A.A"' Server B is, ...
1
vote
1answer
44 views

Ansible & rbash

I want to manage a bunch of devices running /bin/rbash as the default shell with Ansible. The problem is that Ansible always tries to execute a list of commands that rbash doesn't like at all: umask ...
0
votes
0answers
21 views

looping using with_items while registering it

I am passing 3 variable values from inventory file. Now i want to confirm that all the 3 variables values are present in inventory file. I am registering the values with with_items but how to check ...
1
vote
2answers
62 views

Ansible cannot check service status and restart it

I am new in ansible. Now I try to restart my Tomcat service. It looks like ansible cannot detect service status (started/stopped) and cannot (re)start it. Please tell how to do diagnostic? See here ...
1
vote
1answer
102 views

ansible-playbook with group_vars

I'm trying to organize ansible from a ssh model to pull. Before I had a setup like group_vars/ all prod stage dev Now I'm trying to run everything via cron so I tried this setup staging/ ...
0
votes
1answer
25 views

how to store value of ansible fact variable in another variable

I wanted to store value of ansible fact variable in some other variable, and also wanted to check is that fact variable is empty or not Below is my code where i can print the value of ansible_local ...
0
votes
1answer
19 views

I am trying to use vars_prompt but when i run the playbook it directly gives me prompt and ask for the value, it doesn't checks in inventory file

What I want is set the priority of variables. I am passing the variable from inventory file and if the variable is not defined in inventory file then it should ask for user prompt. I am trying to ...
1
vote
1answer
38 views

Can I use ansible to startup jboss service in domain mode?

I used sh /usr/local/jboss/bin/domain.sh manually, and jboss works fine. When I use ansible to start jboss automatically, jboss log always shows "Container is down". File /root/startup_jboss.sh : ...
1
vote
0answers
692 views

Ansible: Failed to connect to the host via ssh

Anyone know why this isn't working? I'm using Ansible on Cygwin using a compiled version of sshpass. I followed the instructions at http://www.jeffgeerling.com/blog/running-ansible-within-windows ...
9
votes
2answers
2k views

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 ...
1
vote
1answer
1k 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 ...
0
votes
0answers
37 views

How to use variables inside hostvars lookups in Ansible?

I'm using Ansible and dynamic inventory to provision servers in AWS. To initialize a clusterd service I need to lookup the private dns hostnames of other nodes in the cluster based on a variable. ...
0
votes
1answer
20 views

become root when running on specific OS

I want Ansible to become root only if it is running on a specific OS, let's say, Ubuntu. I've tried: become: ansible_os_family == 'Darwin' become: (ansible_os_family == 'Darwin') become: {{ ...
1
vote
1answer
44 views

error while playing ansible playbook

I just installed ansible on a server in aws and then created a playbook to run the same but while running i am getting error as below : ERROR! 'copy' is not a valid attribute for a Play The error ...
2
votes
1answer
40 views

How to secure configuration management server

There are many configuration management software options nowadays (Chef, Puppet, CFEngine, Ansible...) which offer an architecture with their repository on a central server and clients communicating ...
9
votes
3answers
5k views

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 ...
1
vote
2answers
26 views

What is the correct way to export environmental values through ansible playbook?

I wrote an ansible playbook which is supposed to install a tool called kafkacat. Most of the tasks in the playbook work, all but one (the most important one). I'm compiling the tool from source and ...
0
votes
0answers
46 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 ...
3
votes
2answers
5k 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
29 views

Which local user accounts should I use for Ansible?

I can't find any official (ansible.com) doc where they suggest which user or class of user to use on the target machines, those machines that are to be managed. I suppose any local user would be OK ...
0
votes
1answer
33 views

How to create a local fact in Ansible playbook which will skip steps which are already done in previous runs?

I wrote a playbook which clones from git three repo's and compiling them from source. Whenever I provision a machine which uses this playbook, the repos are cloned, no matter if the local copy of the ...
0
votes
1answer
31 views

How can I set an Ansible variable whose value won't be known until after running the playlist?

I'm working on an Ansible script to set up a new TeamCity build agent, and there's one part of the process that I don't know how to automate. After installing a TeamCity build agent, it must be ...
2
votes
1answer
42 views

Ansible : How to find the route ID connected to a subnet

I have a VPC with some routes and subnets. I want to get ansible to work with it but I can't see a way to link the subnet with the route table ID. I've used the ec2_vpc_route_table_facts, ...
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 ...
1
vote
1answer
15 views

Ansible generating task per runtime object

I'd like to make Ansible run a task per some object found at runtime. For example one per file in a specified directory or one per running process. Is there a way to implement this inside of ...
0
votes
1answer
13 views

Unable to form a link of a file which is in sites-available to a directory sites-enabled in remote server using ansible?

Unable to form a link of a file which is in sites-available to a directory sites-enabled in remote server using ansible? This is command I want to execute using file module of ansible: ln -s ...
0
votes
1answer
20 views

How to override the previous defined PHP value via Ansible PHP role?

I'm trying to apply override PHP's opcache.max_accelerated_files setting via geerlingguy's Ansible Role for PHP onto geerlingguy/centos6's VM using the following lines (as part of provisioning ...
18
votes
2answers
3k views

Will Ansible prevent the execution of 'rm -rf /' in a shell script

This is based upon this hoax question here. The problem described is having a bash script which contains something to the effect of: rm -rf {pattern1}/{pattern2} ...which if both patterns include ...
5
votes
2answers
2k views

Force Ansible to throw out error when vars is missing in yml?

Is it possible to force Ansible when replacing the var in yml files, which is undefined, throw out an error instead silently replaced by an empty string?