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
26 views

Root ssh key for ansible control node

Scenario: Deploy 30 VMs using terraform and then run ansible - how many ssh keys do you generate? Virtual machine definition in terraform requires administrator ssh key or password provided. Do you ...
1
vote
1answer
16 views

Ansible: Does the `hosts: all` pattern in a play only match hosts specified in inventory, or does it also match playbook `add_host` hosts?

I know "all" doesn't match the implicit localhost; the title succinctly expresses my question. Motivation: I have a playbook that needs to be run on cloud hosts generated dynamically and ...
1
vote
1answer
12 views

Ansible cli_command loop register issues

I can't seem to get the register to works with cli_command and looping of multiples commands. Any suggestions? - name: Run show commands hosts: - all connection: network_cli gather_facts: ...
2
votes
1answer
42 views

Using ansible to update remote Ubuntu servers that have no external internet access

I am quite new to Ansible, and have to been able to use it to install packages on 80 remote Ubuntu servers that have no external internet access. Is it possible to use Ansible to update/patch these ...
1
vote
1answer
37 views

Strategies for sharing Ansible vaults with root/administrator credentials?

Historically we've been a one man devops team and stored all our passwords in Ansible vaults - including things like domain admin passwords and root account passwords. However we're now growing and ...
0
votes
0answers
18 views

How to visualize your application ecosystem

Suppose you have an ecosystem of ~50 different applications of different sizes, running on ~100 virtual machines. These applications are interdependent, i.e. they talk to each other, as well as other ...
0
votes
0answers
31 views

/wsman (Caused by SSLError(SSLError(\“bad handshake: Error([('SSL routines', 'ssl_choose_client_version', 'unsupported protocol')])\”)))"

I'm trying to ping to windows server 2008 via ansible from ubuntu. my host file is [win] 192.168.10.6 [win:vars] ansible_user=Administrator ansible_password="password" ansible_port=5986 ...
0
votes
1answer
43 views

Kubernetes deploy workflow

I have an application (Django web app alongside couple of microservices) and have done deployment previously via Ansible tasks. Playbook was invoked from Ansible Tower and essentially breaks down into ...
1
vote
1answer
45 views

How can I add an apt-key without using the hardcoded url in an ansible playbook?

I am completely new to ansible this is my second day working with ansible, What I'm ultimately trying to do is configure a kubernetes cluster which has a master node and one worker node. But my ...
1
vote
1answer
79 views

Ansible - using facts from one host to perform actions on another host

In Ansible I'm trying to generate a variable from a task on one host and then use the variable to do something to another host. Specifically, I'm trying to create a Kubernetes cluster - On the control ...
1
vote
1answer
263 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 ...
1
vote
1answer
17 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....
1
vote
1answer
44 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
49 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
41 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 ...
2
votes
3answers
262 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
53 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
135 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" ...
1
vote
1answer
17 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
vote
1answer
36 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
1answer
123 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
25 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
30 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
179 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
57 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 ...
3
votes
1answer
1k 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
97 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
117 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
27 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
2answers
473 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
771 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
33 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
101 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
313 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
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
16 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 ...
1
vote
0answers
384 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
255 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
3k 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
351 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
106 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
1k 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
225 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
18 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
183 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
4k 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
428 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
2answers
2k 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
2k 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
353 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 ...

1
2 3 4 5
7