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
1
vote
1answer
12 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 ...
0
votes
0answers
11 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
42 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
24 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] **********************************...
0
votes
1answer
13 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
20 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
41 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
38 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
17 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
35 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
35 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
57 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 ...
2
votes
2answers
34 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
0answers
45 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
25 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
69 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 ...
0
votes
1answer
37 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
40 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
20 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
30 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 ?
0
votes
0answers
19 views

HAProxy container, created with Ansible, is not responding although container is running

I have a playbook which deploys one HAProxy container and 2 Apache containers. Moreover, I also mapped ports and volumes in order to distribute client requests with HAProxy to Apache servers, but ...
0
votes
0answers
29 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 ...
2
votes
1answer
41 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 ...
2
votes
1answer
36 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
0answers
15 views

How to resolve template variables with values defined not in global level

I need to resolve variables in my jinja2 templates with variables defined in an inventory file NOT in global definition level: --- all: hosts: default: ... vars: objects: obj1: ...
0
votes
0answers
20 views

Ansible does not send multi email

i want to send a report to bunch of emails. when i have only one email address it works but when i want to send to multi email addresses it does not send anything. here is the code in playbook: - ...
0
votes
2answers
164 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
38 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 ...
3
votes
1answer
38 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 ...
2
votes
1answer
21 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
66 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
26 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
vote
1answer
28 views

Ansible: how to display the name of the currently running included_tasks playbook file?

I wrote an Ansible role which does lots of things, it's called "common" and all Ansible hosts are using it. The directory structure is as follows: ./common │   ├── ./common/README.md │   ├── ./...
1
vote
3answers
48 views

Run integration test with ansible playbook using terraform provisioning

Ok so I am totally new to devops! I am an experienced developer, but at my new job I have been tasked to automate CI/CD. Non-existing so far. Only CI with Travis. So the ideal workflow is: Push to CI ...
5
votes
1answer
113 views

Ansible: Use inventory_hostname variable in lineinfile module

I'm using Ansible 2.7.9 and I'm having trouble with the regex definition in the lineinfile module. My file has the following line: host.example.com = /path/to/a/directory I want to remove that line. ...
1
vote
2answers
99 views

How do we move to a modern CICD approach

This may also be a general pulse; but here lies the issue We use EKS, we have Jenkins, we have Ansible, we have Terraform, we have BitBucket; but none of these really form a pipeline and I'm stuck ...
2
votes
1answer
579 views

Doing map and filter of a list of dictionaries in ansible

Given a list of users: # Python Syntax users = [{'name': 'alice', 'sudo': True}, {'name': 'bob'}, {'name': 'charlie'}] # YAML Syntax users: - name: alice sudo: yes - name: bob - name: ...
2
votes
1answer
102 views

Ansible event driven capacity

I've been using SaltStack a lot in my previous job, and loved its event driven model. Now, in my new job, we are using Ansible, and definitely not in an event driven model. I was wondering if there ...
3
votes
2answers
24 views

Install apache on awa ec2 from locally installed ansible server on my laptop

I would like to install apache2 remotely on aws ec2 instance from my locally installed ansible server on my laptop. I have also the. pem key of the instance. Now what Ip need to put in /etc/ansible/...
3
votes
2answers
281 views

Combine Lists of Objects in Ansible

I'm really trying to merge lists of objects along with defaults so I can loop over them and create resources in kubernetes. I've gotten it down to a simple(ish) playbook and will post it here. - ...
1
vote
2answers
59 views

How to sync two directories on same host using Ansible?

I am using the below playbook for mounting partitions on another EBS volumes while provisioning instance on AWS --- - name: Mounting necessary partitions hosts: localhost become: ...
1
vote
1answer
48 views

Ansible seems to execute infinite loop

I wrote some roles for my home lab to setup a GlusterFS cluster. But when I run it on my 2 nodes, some tasks get executed over and over again and it seems that it never ends. Here is the log output (...
0
votes
2answers
811 views

Ansible: When 'directory/file exists' in a loop

I have written some Ansible code to put users from the users.yaml file in the variable 'nexus_local_users' to be used by a role. When doing this a random password is created and written to the '...
2
votes
2answers
153 views

Ansible warning that host key has changed, even though I've taken multiple steps to prevent this warning

I've followed the recommendations I could find to prevent this from happening. I am using Vagrant, but once the boxes are spun, I'd like to do things with the ansible command sometimes. $ grep ...
0
votes
2answers
3k views

How to run multiple commands with command module in Ansible

I want to run couple of commands in ansible playbook I am trying below: - name: Running multiple cmds command: - | cmd2 cmd2 cmd3 cmd4 But i am getting an error on ...
2
votes
1answer
46 views

Creating ec2 instances and installing mongoDB using automation

I am trying to create a 3 node MongoDB replica set using automation (ansible or terraform) in AWS. I am able to do this in the management console of AWS, but I'm not sure how to approach it. ...
2
votes
2answers
44 views

I don't fully understand how to use variables in Ansible roles

Original question: I want to roll out a partitioning layout for a home lab setup of GlusterFS and also want to do it using Ansible so I can re-use the configuration for a more stable setup later on. ...
2
votes
1answer
1k views

Creating Keycloak Realm via Ansible

Currently there is no module to create a Keycloak realm with Ansible. There is a PR but it is stucked since half a year or so. So I though, there is a Keycloak REST API (https://www.keycloak.org/docs-...
-1
votes
1answer
49 views

Can't ping client on ansible ,

$ ansible 192.168.254.150 -m ping [WARNING]: Unable to parse /etc/ansible/hosts enable callback plugins as an inventory source [WARNING]: Unable to parse /etc/ansible/they can output to stdout but ...

1
2 3 4 5
7