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
3
votes
1answer
24 views

Managing state (e.g. presence/absence) in Ansible, any established best practices?

Ansible lists a nice set of best practices in its documentation. One of the items is: Always mention the state For many modules, the state parameter is optional. Different modules have different ...
1
vote
1answer
14 views

IaC Deployment in Azure with Terraform + Chef vs. Puppet vs. Ansible for Data Engineers

I am an Azure Data Engineer and try to leverage the IaC benefits in this area of Azure Data Factory, Azure Databricks, Azure SQL & Synapse, Azure Power BI, Azure IoT. After some research I figured ...
1
vote
0answers
16 views

deploying my public key to multiple ec2 instances

I wrote a playbook to deploy my ssh keys across multiple instances. This my playbook, but I am experiencing some problems with it. I already created my ssh keys from my local instance. Please see ...
3
votes
1answer
60 views

Ansible: register variable with loop

What’s the best way to use registered variable ‘audit_tools’ to check if all items are own by root ? Do I need to use Jinja2 filter or something ? Thanks - name: Verify audit tools are own by root ...
1
vote
1answer
37 views

Ansible No such file or directory error message for any executable in Amazon Linux AMI

I'm trying to run this command in a Amazon Linux AMI instance - name: Run docker shell: systemctl enable docker && systemctl start docker And receiving this error message "stderr&...
1
vote
1answer
35 views

Using a combination of Terraform and Ansible to create dynamic AWS EC2 infrastructure

The company I work for wants to prevent provider lock-in adn therefore told us to use Terraform+Ansible instead of Cloudformation. We already decided to use terragrunt as an addon. While the ...
2
votes
0answers
15 views

Power on AWS EC2 hosts by specifying their ansible hostnames

I have inventoried my AWS EC2 hosts using the ansible Ec2 inventory plugin. I would like to be able to power on hosts that are currently powered off, by specifying hostname patterns in ad-hoc ansible ...
1
vote
0answers
21 views

Correct usage of community.aws.ec2_instance_info module in a playbook

I have successfully authenticated to AWS and pulled an inventory using the aws inventory plugin. I'm interested in getting facts about instances. The documentation says that this playbook should get ...
2
votes
1answer
59 views

How to store/retrieve multiple ansible-vault passwords within/from a single file

The manual says at storing passwords in files section: To store a vault password in a file, enter the password as a string on a single line in the file. Make sure the permissions on the file are ...
0
votes
1answer
39 views

Ansible URI module and skip SSL validation

I have a playbook which looks like - name: CURL post example uri: url: "https://dev-box.local/api/" method: POST body: '{ "max_conns": 0, "...
1
vote
1answer
23 views

Error 502 before execute Ansible playbook

I execute an Ansible playbook with an ansible user. The playbook executes properly, with no errors in the application log, no errors in the Ansible log. This .war usually deploys with user "...
0
votes
0answers
21 views

Docker mount volume on SELinux enabled server

I'm trying to run Nginx as the docker container on SELinux enabled server with mounted configuration as -v /host/path/nginx.conf:/etc/nginx/nginx.conf:Z That works fine till I will deploy updated ...
0
votes
1answer
53 views

Ansible multiple commands to a file

You can see bellow how it looks like my Ansible Script. My question is what i need to change to get output from multiple commands to a file.The problem is that i get output only from the first command....
0
votes
0answers
30 views

Handling configuration drift with Ansible

A criticism of Ansible being that it's not declarative, in that, if it's used to spin up n number VM's, and then need an additional one, it's not n+1 but just 1. Referencing: Playbooks and ...
0
votes
1answer
35 views

SSL Expiration Date

I play this playbook to get amount of days between two expiration certificates dates: --- - hosts: localhost gather_facts: no connection: local tasks: - name: Save the old date shell: ...
2
votes
0answers
13 views

Redirected `ansible-doc -s` output gets weirdly formatted

I'm preparing for Ansible certification, and I decided that ansible-doc -s may be useful to speed up creation of playbooks. It dumps a snippet of configuration of the requested module, with all ...
0
votes
0answers
13 views

Online help for playbook keywords

Ansible has a pretty decent online documentation using the command ansible-doc; using -t and -l, one can even learn some new stuff that Ansible is capable of, with that command. However, I can't find ...
0
votes
0answers
47 views

Ansible/AWS dynamic inventory — How to create groups based on tags?

I am trying to create custom groups, based on tags. I am using this doc as a reference: https://docs.ansible.com/ansible/latest/plugins/inventory.html#inventory-plugins As a baseline, in my aws_ec2....
1
vote
2answers
41 views

Ansible - merging inventories to share variables across?

Is it possible to merge inventories so I can share variables across them? Let's say I have two inventory files. Inventory A and Inventory B. They are both in a directory called inventories. Variables ...
0
votes
0answers
529 views

Ansible playbook error: “Connection timed out during banner exchange”

I am trying to connect to my bastion host and then tunnel that ssh connection to connect to a jenkins host but keep running into the connection timed out error. The error message in full is: fatal: [&...
2
votes
1answer
54 views

Pass Ansible parameters to include_role

I have a role that contains this task: - name: Download something via Git include_role: name: git_cached vars: params: repo: https://somerepo dest: /some/path I would really ...
1
vote
0answers
24 views

Ansible dynamic inventory using AWS plugin — how to obtain internal DNS records or private IP?

Seeking help from those who've worked with dynamic inventory in Ansible. I have Ansible set up with the aws_ec2 plugin (not using the python script as it's been too problematic). Currently, I'm only ...
0
votes
1answer
208 views

Convert AnsibleUnsafeText to String

I am using the ansible shell module to compare the chain of 2 SSL certificate with openssl (they have the same chain): openssl x509 -issuer -noout -in Certiticate1 openssl x509 -issuer -noout -in ...
0
votes
1answer
52 views

Ansible fails in Jenkins pipeline when run from docker

I'm trying to deploy a build via Jenkins pipeline using agent docker and Ansible playbook but it fails on Gathering Facts stage as shown below: TASK [Gathering Facts] **********************************...
1
vote
1answer
14 views

Ansible: Detecting in parent role when meta dependency role had change

I would like to make an ansible role that drops some credentials into /etc for a few services that are running. Each service is slightly different and requires different mechanisms for restarting to ...
0
votes
1answer
25 views

How to skip rest of hosts when item found in host - Ansible

I have a list of hosts using aws_ec2 and I want to find the first host where the ec2 instance has a specific docker container. I created a play book with a list of tasks, which ultimately executes a ...
0
votes
1answer
454 views

ansible error: skipping: no hosts matched

I've tried a few variations on running ansible locally as a test case: nicholas $ nicholas $ ls ansible.cfg ansible.cfg.orig first_playbook.yml inventory.txt playbook.yml nicholas $ nicholas $ ...
0
votes
2answers
73 views

network ansible command error: “msg”: “network os centos is not supported”

How do I get the ansible config for rolly below? remote: [nsaunders@rolly ~]$ [nsaunders@rolly ~]$ lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description: ...
0
votes
0answers
39 views

How to automate Asterisk on Kubernetes with Ansible?

From thirty-thousand-feet, how would I use an existing ansible playbook in the context of Asterisk using Kubernetes? Or, coming at this in a step-wise fashion, what's the smallest indivisible portion ...
0
votes
2answers
65 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 ...
0
votes
2answers
45 views

Ansible: Run tasks on specific hosts with var/fact from another host

I'm trying to get the output from a command on the first host in group managers and execute it on the other hosts in the same group. hosts file [managers] k8s01 k8s02 k8s03 [workers] worker1 worker2 ....
0
votes
1answer
121 views

The ansible_local var is not being populated when using the setup module to gather custom facts on windows

The ansible_local var is not being populated when using the setup module to gather custom facts on windows. Playbook: --- - name: Testing and Debug PB hosts: all tasks: - name: Gather Facts ...
3
votes
2answers
40 views

Can we use Ansible for monitoring configuration?

I understand how Ansible works and what it is used for. However, I was wondering if there is a way or feature (in open-source or enterprise edition) in Ansible using which, we can make sure that the ...
0
votes
1answer
123 views

How are ansible playbooks supposed to be imported into a collection?

I'm trying to develop a reusable collection of playbooks that I can run from docker containers. I don't want to share duplicate code between containers and I don't want to have containers that run ...
-1
votes
1answer
44 views

AWX cannot find matching host

I have on premise AWX and inventory (instances on AWS). To provision newly launched instance I want to use provisioning callbacks. But when executing this command from the instance $ curl -v -H '...
1
vote
1answer
151 views

How do I make ansible-playbook log its output in a machine readable format like xml or json?

Looking for information on how to output machine readable output form ansible-playbook.
1
vote
1answer
18 views

Are there serious problems with an EC2 auto-scaling AMI that automatically downloads newest server from git?

I'm converting some servers from manual scaling (with a load balancer) to auto-scaling. I'm currently using an Ansible script to manage upgrades, and I wouldn't want an automatically created instance ...
1
vote
1answer
40 views

Snake bites its tail problem automating configuration of Certbot with Ansible

I have a public web-site with Nginx in front of it. We use free Letsencrypt certificates to set up https. These are acquired and renewed by Certbot program. I want to implement entire servers ...
0
votes
1answer
142 views

Installing ingress controller, services and pods on K8s via Ansible

I've 3 Debian-10 VMs on a bare metal Proxmox host in my network and installed via Ansible the roles geerlingguy.docker and geerlingguy.kubernetes with complete default settings. The kubeadm on the ...
1
vote
1answer
38 views

Include pre- and post_tasks transparently for all Ansible roles

I am looking for a way to execute some actions before and after each role has run. pre_tasks and post_tasks look like a good candidate, but I have found no way to include them transparently for all ...
1
vote
2answers
33 views

How to log native commands run by Ansible Playbook [closed]

Ansible internally uses SSH Commands to run on the target machine . Is there a way to log the commands that are being executed ?
1
vote
1answer
114 views

How to automate the key exchange in WireGuard when you deploy a cluster of machines?

Let's assume you want to deploy a cluster of machines on Hetzer Cloud. For simplicity let's call them worker1, worker2, worker3. They need to communicate with a server called master, which will be ...
3
votes
1answer
42 views

Improving deployment process of agent software

I'm a developer on an agent software team, researching ways to streamline the mass deployment of our agent on clients' machines. Currently the process involves running a script to determine the exact ...
3
votes
1answer
37 views

Clarification about Operational Support System

I just started my career as a BA. As the first task, I have to study about operational support systems like ansible tower. I could not find any references to study about this. What are the similar ...
0
votes
2answers
446 views

how to set a variable from an ini file in ansible?

I would like to set a variable value in a playbook reading it from an ini file, possibly failing the play if the file is not found or the value is missing in the file. I have found the ini lookup ...
-1
votes
2answers
43 views

A tool to orchestrate cloud server (virtual machine) instances

Whenever I use search keywords such as "orchestration" or "server clusters" or "iaas" I'll always end up in hundreds of results that are going to talk about containers ...
4
votes
1answer
41 views

Tying playbooks together

Say, i have written bunch of ansible roles and playbooks, configured my playbooks structure and now i'm trying to tie them to one playbook which will do its thing depending on tags or inventory file ...
3
votes
1answer
28 views

How do a flaten a list mixed with nested dict in ansible playbook?

I have a variable named packages as showed below, it is not a plain list, I have some nested dict in it like browsers. --- packages: - apt-file - axel - ibus-rime - rofi - i3 - ffmpeg -...
1
vote
0answers
93 views

straight python alternative to ansible

Can anyone recommend an alternative to Ansible that lets one write straight Python code? In my group, we're finding that expressing pretty simple logic in Ansible ends up being too time-consuming and ...
1
vote
1answer
35 views

How to sort displayed tasks in the order they were run rather than by the time it took each task to run?

I've configured ansible.cfg to display the steps it has done during a playbook run and it looks like so: =============================================================================== common : ...

1
2 3 4 5
7