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

2
votes
0answers
25 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 ...
-5
votes
0answers
66 views

which is the fastest between puppet, chef, ansible, salt and cfengine? [on hold]

I am using puppet and ansible and haven't tested much of chef and never tried salt and cfengine, but for those that have worked with all, which is the fastest? In terms of speed. Thanks PS. Yes i ...
1
vote
1answer
26 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
18 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
27 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 ...
0
votes
0answers
20 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
29 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
50 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
1answer
34 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
23 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
55 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
60 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
45 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 ...
3
votes
2answers
60 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
38 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
38 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": ...
2
votes
1answer
69 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
1answer
69 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
32 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
47 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
41 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
63 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
90 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
19 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
69 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
56 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 ...
1
vote
1answer
81 views

Prevent rsync from deleting excluded directories

I'm using rsync through Ansible's synchronize-module with the following task definition: synchronize: src='{{ local_app_path }}/.' dest='{{ remote_app_path }}/' perms=no owner=yes ...
0
votes
1answer
93 views

Ansible/Capistrano with fixed sudo command (“sudo su -”)

I have to administer some half-managed servers (monstly CentOS 6), where we are only allowed to login as a regular user, then do "sudo su -" and type the regular user password, and then run the ...
3
votes
2answers
197 views

Ansible Fails to Authenticate Sudo Even When Sudo Pass is Given

Problem Using the latest, stable Ansible build, I have an odd problem where my playbook hangs on one server during "Gathering_Facts" but works fine on other similar servers when using Sudo. On the ...
2
votes
1answer
56 views

Detecting a network from ansible playbook using nslookup

I am working on a Vagrant + Ansible configuration for my team that sets up a developer VM, some of the artifacts needed are only available from my corporate network either by being physically on it or ...
1
vote
2answers
143 views

Ansible - Exception: host not found: {{ item }}

I have some task which I wish to delegate_to some hosts (finally I want to list them in some var rather than use group from inventory). For this question lets simplify this to (I did exactly the same ...
0
votes
0answers
41 views

How to set scp_if_ssh = True for a group?

It's simple to set this variable in an ansible.cfg but it makes sense only for hosts that do not have sftp (and most likely python as well). So I have a group for routers – is it possible to set this ...
4
votes
2answers
595 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 ...
4
votes
1answer
146 views

How can I have a nested loop with a fileglob pattern?

I'm trying to create a set of authorized SSH keys for a set of users in Ansible. I have a users variable set up like so: users: - { username: root, name: 'root' } - { username: user, name: 'User' ...
1
vote
1answer
467 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 ...
1
vote
1answer
190 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 ...
3
votes
1answer
443 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
313 views

Issues with Ansible's default/error handling in a playbook

I'm having some issues with Ansible and the way it defaults to values. What I'm trying to accomplish is to bind a Docker container to on eth1, if it exists, otherwise use lo. My initial approach was ...
1
vote
1answer
642 views

Ansible: How to access hostvars in task?

I'm trying to use hostvars in my task. But it seems that ansible is interpolating the variable and then trying to look it up in the main variable dict object. Here's my code: - name: Configure the ...
1
vote
1answer
75 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
1answer
567 views

Avoid repeating 'with_items' in Ansible role

I've got an Ansible role with several tasks that I run for several virtual hosts. My playbook works, and it looks like this: --- - name: Create vhost configuration # action with_items: vhosts - ...
-1
votes
1answer
423 views

How to make sudo -u not require password [closed]

I'm using ansible with vagrant and ansible is trying to sudo as postgres user to run some postgres commands. Ansible running as vagrant user seems to run something like sudo -u postgres psql This ...
3
votes
1answer
839 views

how to access host variable of a different host with Ansible?

Let's say a have a host that collects some data and it's in a group [collectors]. I also have hosts in group [reporters]. So I want to set a variable on reporters from groups['collectors'][0] ip ...
0
votes
1answer
48 views

Ansible error when unpacking some archives into /usr/local/lib

I'm running an ansible playbook on my machine, and every task completes successfully except for several steps that involve unpacking various zip and tar.gz archives into /usr/local/lib. Here's an ...
3
votes
1answer
112 views

Tweaking Ansible output

I want to use Ansible to collect information from a number of servers. The information should be postprocessed locally, so it should be presented in a certain format. Other than grep and sed and awk ...
2
votes
0answers
104 views

How can I run a delegated task for an offline host using Ansible?

I have Ansible tasks for enabling and disabling Nagios checking for some hosts. They use "delegate_to" the Nagios server. However, I can't use them when the host in question is offline, because ...
1
vote
2answers
50 views

Ensuring a given set of RPMs, and only those RPMs, are installed

I have multiple lists of RPMs (one per configuration), and a set of remote machines. Each list includes all of the RPMs needed to run my machine in the configuration I choose. For a given ...
0
votes
1answer
161 views

passing list of lists in a playbook to a single command (not with_items)

I two groups of hosts: dc1 and dc2. Also combined to a DC group. I need to pass a list of IP addresses of hosts from a foreign DC to a command. with_items doesn't work here at all. Should look like ...
0
votes
1answer
627 views

Associative array in Ansible playbook

I'm trying to add users to my servers using Ansible. Each user have a different encrypted password. I have something like that: vars: users: - myuser1 - myuser2 password: ...
0
votes
1answer
155 views

file created by ansible seems to have mangled permissions

Issue with files created by Ansible I’m looking at using to setup some new servers at a new ISP and I’ve been doing some basic steps to test first. I am new but have done some testing on diff servers ...