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
0
votes
0answers
3 views

ansible-playbook: how to dynamically, conditionally set a large deployment environment (variable space) in a playbook?

I am using an ansible playbook to deploy a php web application in aws. The deployment is repeated many times, with a different environment, for each customer. The different scenarios range from ...
0
votes
0answers
4 views

Are package facts getting invalidated automatically when I install remove packages?

In Ansible I can use a task such as: - name: Gather the package facts package_facts: manager: auto to gather the package facts and a condition such as: when: "'foobar' in ansible_facts....
0
votes
0answers
10 views

Ansible does not send Email

I have 2 Ansible jobs. both of them compare files to find their differences. one of them is for crontab and the other one is for users. they are run first of each month and send their report via Email....
0
votes
0answers
57 views

How to clone or remote pull-through galaxy.ansible.com with GalaxyNG

I setup a GalaxyNG server (which is a Pulp Project plugin) to act as an Ansible Galaxy repository on an isolated network. The server will periodically have internet access to sync with it's upstream ...
0
votes
0answers
10 views

How to integrate Certbot with Ansible managed NGINX config?

I'm using Ansible to manage NGINX server configurations, i.e., my playbooks contain some roles that roll out NGINX server config templates. This is my first contact with the topic SSL and I've been ...
0
votes
1answer
22 views

Ansible Playbook fails start Apache Cassandra

I have been tried ran a Ansible Playboo, but after change the cassandra.yml when the service tries start I received this error bellow: ● cassandra.service - LSB: distributed storage system for ...
0
votes
1answer
29 views

Unexpected type error in ansible community.aws.cloudfront_distribution: “origins” parameter: “'list' object has no attribute 'get'”

I get an unexpected type error, for what I assume to be the "origins" argument to the community.aws.cloudfront_distribution module: "Error validating distribution origins: 'list' object ...
2
votes
1answer
30 views

Ansible - Variable expansion inside hostvars declaration?

I have a hardcoded hostvars line, like so: node1_hostname={{ hostvars['192.168.0.162']['node1_hostname'] }} I have a set_fact variable from a previous play that I'd like to expand in the host section ...
1
vote
3answers
61 views

Add item(s) to yaml array only if defined (ansible)

How do I write a yaml file such that it defines an array with a list of values, and it skips those values from being added to the yaml array if the given value is undefined? Specifically, I'm trying ...
2
votes
1answer
33 views

Problem with Ansible Asynchronous actions

I'm trying to run two simple tasks Task A starts an Ipref3 server and waits for a client to connect Task B starts to run from host-1 until the given timeout once Task B (host-1) is over another Task B ...
1
vote
2answers
64 views

ansible & jinja2: How to reference JSON structure items whose keys are variables?

I am using ansible's community.aws.iam_server_certificate_info module to get information about a server certificate on aws ec2, and registering it as a variable "server_cert_info_result" ...
0
votes
0answers
43 views

Error passing multiple EXTRA_VARS to Ansible playbook

DISCLAIMER: My question is NOT a duplicate of this question. I am trying to run a playbook with two vars passed to it. Here's the playbook: [ andriim@mtr-vdi-273 ~/work/NFSoRDMA ] $ cat ansible/...
1
vote
1answer
7 views

Looping an Array with Missing Keys in Ansible Tasks

I'm attempting to create an Ansible Role to create users... I want it to be able to accept a list of dicts and if a key is missing from the dict, it will fall back to Ansible's default. For example, ...
-1
votes
1answer
13 views

ansible ad hoc issue

I though it should be possible to run a ansible ad hoc to enable or disable a cron job. ansible shows success with "changed": true, but the cron jobs is not enabled. I see this as a false ...
0
votes
1answer
21 views

Ansible - Azure resource referencing

My aim is to have my vnet and subnet in a seperate resource group from the other parts of my infrastructure i.e Virtual Machines. I have a short playbook that creates the resource group for my network ...
0
votes
0answers
24 views

Best way to organize e2e testing in separate environment without intervention to stable development process

Hello DevOps community! TL;DR What are your cases where you integrated cypress end-to-end testing to your project? What are the best approaches? Pitfalls? Long story... I got the QA engineer asking me ...
0
votes
1answer
26 views

How can we prepare GitLab runners using Ansible deploys

Given We run an in-house GitLab server, with many projects (aka "repositories") We provision all servers using Ansible (and deploy projects using pip) We deploy to dev.project.example.com ...
1
vote
1answer
24 views

trying to display 3 - 5 commands

I was trying to display a few commands with .stdout - the gives me the mixed output also with "item" with item it gives me: just the strings: uname -a uptime but not the output of those ...
1
vote
1answer
26 views

Ansible hosts group reference does not work

I'm trying for hours already to run a docker installation on a specific group of hosts. This is my hosts.yml all: hosts: 01-dev: ansible_host: <IP1> 02-dev: ansible_host: &...
3
votes
1answer
30 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
38 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 ...
0
votes
0answers
24 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
542 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 ...
0
votes
1answer
61 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
56 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 ...
1
vote
0answers
19 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 ...
0
votes
0answers
110 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 ...
1
vote
2answers
239 views

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

Update: As @yaobin pointed out. It appears they removed the part about the multiple passwords being in a single file. It was here as can be seen from web archive: https://web.archive.org/web/...
0
votes
1answer
327 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, "...
0
votes
1answer
29 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 "...
1
vote
0answers
56 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
147 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
103 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
44 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: ...
1
vote
0answers
15 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
14 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 ...
1
vote
0answers
226 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
90 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
1answer
2k 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
188 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
1answer
48 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
641 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
143 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
17 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
92 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
2k 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
246 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
110 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
336 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 ...
1
vote
2answers
700 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 ....

1
2 3 4 5
7