Questions tagged [ansible]

Use this tag for questions about Ansible, an open-source automation engine, related to using Ansible for topics such as cloud provisioning, configuration management, application deployment, etc.

Filter by
Sorted by
Tagged with
54 votes
5 answers
16k views

How is Ansible different from simply running a provisioning bash shell in Vagrant?

A team of IT sysadmins that have exprience using shell scripting to solve their problems, are contemplating to start using Ansible instead. Are there substantial differences and good reasons to start ...
Evgeny Zislis's user avatar
37 votes
6 answers
6k views

How to test provisioning and configuration in Ansible setup?

Looking at trying to build some resilience into our Ansible setup which deals with provisioning and configuration. I understand a few methods of testing on the configuration side of things but I'm ...
Naphta's user avatar
  • 627
34 votes
3 answers
69k views

Can I bypass host key checking in Ansible?

I'm running an Ansible playbook with a subtle hack to work on an arbitrary port forwarded port (so I can use one machine with no direct access to lots of machines). I've got a pre-task to change ...
Peter Turner's user avatar
  • 1,430
34 votes
5 answers
24k views

Where to put ansible-vault password

We are planning to use ansible vault in our project to prevent leaking passwords or keys in git. The idea is to put all our sensitive data into a plain file then encrypt this file with ansible-vault ...
storm's user avatar
  • 1,759
33 votes
3 answers
45k views

Is there a way to run with_items loops in parallel in Ansible?

I'm running Ansible 2.2, but can upgrade if it helps. I saw this and was pretty excited, but it doesn't seem to be in this (or any) version of Ansible documentation. The problem I'm trying to solve ...
Peter Turner's user avatar
  • 1,430
25 votes
1 answer
17k views

Ansible: What's the difference between task, role, play and playbook?

Ansible has tasks, roles, plays and playbooks. Are those just names for different levels in a playbook organization? If not, how, exactly, do they differ from and relate to each other?
caxcaxcoatl's user avatar
24 votes
4 answers
46k views

Ansible: Other option available for telnet check of open ports?

I'm new to Ansible. Here's my task ... I have 400+ hosts, and I need to verify if 5 different ports are open from their end to our web server. Individually, I could log in and run: telnet ...
AWhitaker's user avatar
  • 351
23 votes
1 answer
1k views

Git clean/smudge filters for ansible vault secrets

I am trying to setup clean/smudge filter in git to have automatic encrypting and decrypting of files containing secrets thru ansible-vault command. Peculiarity of the ansible-vault command is that it ...
ᴳᵁᴵᴰᴼ's user avatar
22 votes
3 answers
53k views

Execute multiple Ansible tasks with the same list of items

I am using an ansible playbook to configure Apache for a list of sites. The playbook has to copy the virtual host configuration template for each site into place, and then enable each site using ...
Stephen Ostermiller's user avatar
21 votes
3 answers
2k views

What are the limitations of Puppet in comparison to Ansible?

I would like to understand the differences between Puppet and Ansible, especially what kind of Puppet limitations has in comparison to Ansible. Are there any things you cannot do it in Puppet, but ...
kenorb's user avatar
  • 7,841
20 votes
2 answers
12k views

What is Ansible's config equivalent of `--vault-password-file`?

According the help of ansible-playbook one could use --user=REMOTE_USER to define the ssh user, but one could also define ansible_ssh_user: REMOTE_USER in either the host- or group_vars. Question ...
030's user avatar
  • 13.2k
18 votes
2 answers
7k views

How do I run ansible on one host at a time and break on a failure

I've got an Ansible playbook where I want to update a number of flaky devices in sequence. I can use serial:1, but I want to stop the playbook altogether if I get a failure so I can fix it before ...
Peter Turner's user avatar
  • 1,430
18 votes
1 answer
6k views

How to keep configuration files automatically during apt-get upgrade or install?

When performing and apt-get update; apt-get upgrade -y on a server I encountered the message: Setting up sudo (1.8.16-0ubuntu1.5) ... Configuration file '/etc/sudoers' ==> Modified (by you or by ...
Steven K7FAQ's user avatar
17 votes
4 answers
24k views

How do I configure SSH keys in a Vagrant multi-machine setup?

I have 4 VMs in my Vagrantfile - 3 application servers and an Ansible control host. I only use Vagrant to create the VMs as I provision them manually from the ansible control host because I am still ...
opticyclic's user avatar
15 votes
2 answers
4k views

What is ansible-runner about?

I've read the README file from the github repository as well as the documentation site of ansible-runner (from the official ansible project) but I don't understand what is ansible-runner about and in ...
Baptiste Mille-Mathias's user avatar
14 votes
1 answer
725 views

How do you manage your inventory of spot instances on AWS with Ansible

I am new to Ansible, with some experience in Chef. I am considering learn and use Ansible to manage environments. I was wondering, what would be the best practice to manage inventory of AWS spot ...
Berlin's user avatar
  • 780
13 votes
2 answers
4k views

How do I run Ansible Azure playbooks while avoiding storing credentials in files?

Background We use Ansible to provision and manage Azure infrastructure. At the moment we run Ansible "manually" i.e. we manually execute playbooks for various automated tasks. No CI infrastructure. ...
Vish's user avatar
  • 601
12 votes
5 answers
2k views

Are configuration management tools appropriate to use as deployment tools?

Off the back of my answer to the question: How can DevOps help to improve Software Escrow procedures? Tensibai had the question: What would necessitate Capistrano on top of puppet or chef? My ...
Richard Slater's user avatar
12 votes
2 answers
19k views

Ansible Playbook Localhost Invocation Working Directory

I want to run an ansible playbook locally (host is localhost, like -i "localhost,") and inside the Playbook obtain the working directory from which the ansible-playbook command was invoked. However, ...
hakre's user avatar
  • 223
12 votes
3 answers
452 views

How to safeguard Ansible deployment to mitigate accidents?

Recently the Amazon S3 had a major outage in the us-east-1 region. It looks like it was likely caused by a spelling error when running a maintenance playbook in Ansible or a similar tool. You can put ...
Jiri Klouda's user avatar
  • 5,807
12 votes
7 answers
67k views

How Do I Log Task Output To A File?

One of my ansible tasks imports an Oracle database using impdp. This generates a lot of output to the console so I have set no_log: True. However, when this fails I want to see the log! How can I ...
opticyclic's user avatar
12 votes
1 answer
1k views

How to deterministic and reproducibly assign increasing port numbers in Ansible?

I am new to Ansible, but I have to maintain a set of playbooks, which correspond to services to be setup in a given environment. They need to be assigned a port, certificates, etc. This results in ...
midor's user avatar
  • 221
11 votes
4 answers
3k views

How to structure DevOps related code and configs in a code repository?

We've been growing as a company, our products are expanding and our DevOps related activities and efforts are growing as well - we've switched from Bamboo to a more flexible and configurable Jenkins, ...
alecxe's user avatar
  • 849
11 votes
2 answers
2k views

How should I store my environment variables?

This is a very broad question about methods and advice regarding environment variables / structure. But ultimately I'm looking for answers for the very specific question of 'How should I store my ...
Naphta's user avatar
  • 627
11 votes
3 answers
18k views

ansible: difference between a variable and a fact

While I'm using Ansible for quite some time, I'm not sure I really understand the differences between a variable and a fact. Would it be any difference doing - set_fact: nginx_ssl: /etc/nginx/ssl ...
Baptiste Mille-Mathias's user avatar
11 votes
2 answers
3k views

Ansible Dynamic Inventory - generate inventory with ip addresses under specific tag with underscore instead of dot

I am new to Ansible. When I am using ec2.py dynamic inventory to generate inventory, after the playbook is finished to run, the results are shown as list of IP addresses under specific tag with ...
Berlin's user avatar
  • 780
11 votes
1 answer
3k views

How to automatically remove a dead node from RabbitMQ cluster

I am planning to create RabbitMQ cluster using Ansible on AWS VPC with Amazon internal load balancer as the frontend to point connections to it. Any suggestion how to remove a dead node from RabbitMQ ...
Berlin's user avatar
  • 780
10 votes
4 answers
22k views

Playbook without relative path to vars

I had already bunch of playbooks, so I started to organize them in playbooks dir. It cause there must be relative paths to vars files. Actual playbook: --- - hosts: aws_instance.jenkins-agents ...
Mailo Světel's user avatar
10 votes
2 answers
259 views

Deploying VMs using roles and hosts in Ansible based on operating system

I'm having issues working out how to best apply hosts/roles to different operating systems in Ansible. I'm currently using Ansible to generate Windows/Mac/Linux VMs, and each of the VMs have ...
Rekovni's user avatar
  • 933
9 votes
3 answers
9k views

Is there an ansible module that check whether a port is not in LISTEN state?

The Ansible module index has been consulted, but no module was found that checks whether a port is available? Is there a module that supports this? What does available mean? Available means that a ...
030's user avatar
  • 13.2k
9 votes
5 answers
2k views

Questions about Ansible connection to remote hosts

I want to ask some questions about working of Ansible. 1 - Which shell Ansible uses when logging to remote host ? https://askubuntu.com/questions/937354/track-logins-made-via-non-interactive-shells/...
luv.preet's user avatar
  • 223
9 votes
2 answers
19k views

How to run Ansible with sudo no password commands with become syntax

When I run ansible against a host machine that has some commands I need to run as root, I can't run these with "become" because it runs the commands as root instead of just running them with sudo. ...
Peter Turner's user avatar
  • 1,430
9 votes
2 answers
13k views

Modify sudoers file with ansible playbook template

I am trying to create a sudoers file with ansible template. The sudoers file should look like below: Cmnd_Alias LS = /bin/ls Cmnd_Alias LESS = /usr/bin/less Cmnd_Alias DU = /usr/bin/du %support1 ALL=...
Prakash's user avatar
  • 349
9 votes
1 answer
4k views

How to notate ipv6 addresses in inventory file?

I have a machine, that is accessible via ipv6 only. It is setup for ssh with rsa key. Now I'd like to manage it with ansible. Unfortunately, this is not covered in the inventory documentation. So I ...
tgr's user avatar
  • 448
8 votes
2 answers
7k views

Artifactory vs Git for Infrastructure Version Control / Configuration Management

I'm trying to understand the difference between managing configuration files for the purposes of simplifying automated deployment. We have 5 environments to build. So far 2 have been built with no ...
Khadijah Celestine's user avatar
8 votes
1 answer
5k views

Ansible: Exclude a parameter if variable is not set

Is there a way to exclude a parameter entirely if a variable is not set? I do not want to use a default value for this, I simply do not way the parameter referenced at all. For example, --- - name: ...
Dave L's user avatar
  • 83
8 votes
2 answers
57k views

Passing variables between scripts in a Jenkins pipeline

I have a declarative Jenkins pipeline that looks like the following: pipeline{ agent { ... } stages { stage("Provision EC2 Instance and Set ENV Variable"){ ...
Preston Martin's user avatar
  • 3,278
8 votes
1 answer
2k views

How to organize infrastructure as code projects?

I have completed an Infrastructure-as-Code project using Terraform and Ansible. Currently, I organize my project as follows: Project1 Terraform ec2.tf rds.tf … variables....
user389955's user avatar
8 votes
1 answer
2k views

Referencing current variable in Ansible conditional statement?

I'm using the willshersystems.users role from ansible galaxy for creating users on ubuntu servers. Now that I've got it working consistently, I'm trying to set the state attribute based on whether the ...
bradym's user avatar
  • 556
8 votes
1 answer
705 views

Vagrantfile change with Ansible playbook to control file permission on Vagrant synced folder for Trellis

I use Trellis for my WordPress development. It works great, except I'm finding it hard to change file (or directory) permission within the synced folder. Generally I'm OK with the default permission ...
Scott's user avatar
  • 183
8 votes
2 answers
2k views

Ansible sporadic errors with Windows machines

I'm running into some on and off issues when using windows hosts in my Ansible playbooks. I'm running Ansible 2.3 with pywinrm 0.2.2 installed. I'm using basic authentication with the local ...
Asaf Haim's user avatar
  • 161
8 votes
1 answer
313 views

Ansible playbook for configuring runit to supervise an uberjar?

We are using Ansible 1.9 for deploying Spring Boot microservices. We are using CentOS 6 and the services are packaged as rpms. We intend to configure the executable jar files to be supervised by ...
ᴳᵁᴵᴰᴼ's user avatar
8 votes
1 answer
1k views

What are best practices of deploying docker-compose using Ansible?

Ansible is used to deploy docker-compose on a system and subsequently start the container. When ansible runs from the local system, the docker-compose file is deployed using Ansible. When the code ...
030's user avatar
  • 13.2k
7 votes
2 answers
14k views

Applying ansible playbook to a docker container on a remote host

I have automated the setup of several docker containers with ansible. This works pretty well but there are certain recurring tasks that have to be executed within the docker containers. It is possible ...
davidb's user avatar
  • 399
7 votes
3 answers
3k views

Re-using Python virtual environments on a build server

Currently, every time we run a build through Jenkins+Ansible, we are re-creating a virtual environment and re-installing all the dependencies listed inside the requirements.txt file. This is very ...
alecxe's user avatar
  • 849
7 votes
1 answer
15k views

Ansible how to know what return value is provided by a specific module

From Ansible's official doc Ansible modules normally return a data structure that can be registered into a variable, or seen directly when output by the ansible program and Ansible modules ...
Tran Triet's user avatar
7 votes
4 answers
3k views

Ansible - private git repositories - SSH agent forwarding vs copying private SSH key

I recently started playing around with Ansible and it seems very nice. I don't have much experience in DevOps stuff and never really had to handle any complex scenarios. I started creating my Ansible ...
pzaj's user avatar
  • 171
7 votes
3 answers
3k views

Using SSH to open interactive session in ansible

Is there a semi-easy way to use Ansible to open an interactive session? I've spent a good amount of time making use of keys and other credentials stores to make a stellar ansible inventory file. ...
Peter Turner's user avatar
  • 1,430
7 votes
1 answer
1k views

How does Vagrant differ from Ansible and Docker?

I understand that Ansible is a Configuration Management (CM) tool for orchestrating, deploying (and continuously upgrading) software and conf via a special YAML format created for that software, and ...
user avatar
7 votes
2 answers
1k views

How to solve "E405: Remote package tasks should have a retry" in Ansible?

E405 v4.0.0 Remote package tasks should have a retry Package operations are unreliable as they require network communication and the availability of remote servers. To mitigate the potential ...
030's user avatar
  • 13.2k

1
2 3 4 5
9