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

Filtering included data for specific criteria to run tasks

I have directory with yml files in there which set parameters for different instances of the software I'm to deploy. It looks something like this: instance1: ip: 127.0.0.3 servername: mycoolserver ...
0
votes
0answers
16 views

Ansible playbook - defining var based on condition

I want to create a var based on condition so I created the below : tasks: - name: set IN_PROGRESS backup folder set_fact: v_target_backup_folder_in_progress: >- {% if node_type == &...
2
votes
1answer
25 views

What are minimum permissions required for an IAM user to provision EC2 instances?

I want to provision an EC2 instance with Ansible. So for that purpose I want to create a separate IAM user to keep things clear. I can assign the full EC2 access to the user. But I don't want any ...
0
votes
0answers
16 views

Сontrol Windows-containers from Ansible directly through "docker" connection-plugin

Is it possible to control Windows-containers from Ansible with "docker" connection-plugin? I.e. with ansible_connection=docker in inventory-file? My current environment: Running dockerd -H ...
0
votes
1answer
21 views

Ansible Playbook always interactively asks for Become password, even though no become user is specified?

I have a simple ansible playbook that copies a script and executes a script on an EC2 instance. - name: Playbook Deploy jar hosts: all remote_user: ubuntu tasks: - name: Copy Provisioning ...
0
votes
0answers
64 views

Ansible in venv: how to pip install globally on localhost?

Ansible is installed and is running in a virtual environment: (env) ansible-playbook -vvvv -i localhost playbook.yml I'm trying to install a Python package globally, but it either installs in venv ...
0
votes
0answers
13 views

Filter jobs by inventory

I'm using Ansible AWX and I'd like to find all jobs that were done for a specific inventory , I can do that by going to the inventory and then in the "completed jobs" tab, but is there a way ...
0
votes
1answer
20 views

Copy and unarchive Ansible Module

I tried below ansible tasks with copy and unarchive modules and facing error - name: find and archive hosts: localhost tasks: - name: find the file copy: src: "{{ item }}&...
0
votes
1answer
10 views

How to prompt when win_service service exists?

I'm trying to figure out the steps needed to get when or other conditionals to react when service is present on hosts targeted on my task. With this I get report that service is on one of the nodes ...
1
vote
1answer
71 views

ansible Unsupported parameters for (command) module:

I'm trying to run a shell command in an ansible task but I keep getting an error. This is the task item and the shell command I want to run: - name: Set File Watch Limit ansible.builtin.shell: ...
0
votes
1answer
34 views

Why does Ansible ignore tasks after failing?

My ansible playbook has a task named 'Copy the build script to the system and run it'. It is prone to errors, so I've created a debug task to debug it: - name: Copy the build script to the system and ...
1
vote
1answer
63 views

Testing for EL with Ansible facts; distribution or os_family?

Sometimes in an Ansible playbook, you'll want to condition running a task on whether or not the distribution is CentOS, RHEL, etc, or if it's something else. A very common example is when a package is ...
1
vote
0answers
15 views

Ansible : 'NetworkManagementClient' object has no attribute 'private_endpoints'

I try to deploy a private endpoint for a storage account with Ansible. I am using azure.azcollection.azure_rm_privateendpoint. My playbook code is as below: - name: Create PE hosts: localhost ...
0
votes
0answers
25 views

Github deploy keys - success with Curl, failure with Ansible

I'm trying to learn Ansible. One of my tasks is to have Ansible add deploy keys to github for a project. This command runs perfectly fine from bash command line: # replace blahblahblah with ...
0
votes
1answer
10 views

Ansible user_module exit with "rc: -25" if UID is large

Ansible user_module exit with rc: -25 if trying to create user with UID provided from Active Directory (AD) domain controller (DC). main.yml - name: Configure local user for example.com user: ...
0
votes
0answers
42 views

Ansible Tower on a Free Linux Distro?

Red Hat's Ansible Tower's documentation states that it can only be run on Red Hat Enterprise Linux. I can see once upon a time it could be run on other distros, such as Ubuntu. Is there a free Linux ...
0
votes
1answer
34 views

How to check the status of Ethernet port using ansible?

I want to check status of Ethernet port whether it is up or down on remote server using Ansible?
2
votes
1answer
120 views

What do skipped, rescued, and ignored results mean in ANSIBLE playbook execution?

What do skipped, rescued, and ignored results mean in an Ansible playbook execution? What would be a possible scenario where these results would be different from 0? PLAY RECAP ************************...
1
vote
2answers
49 views

Dynamic environments per client, which is the best approach, if any?

I don't know how to explain this problem better, but I'll try to explain it clearly: Where I work our customers are companies, with lots of users We offer a SaaS solution for them to manage stuff For ...
0
votes
1answer
28 views

How can I detect if an Ansible playbook is executed by ansible-pull rather than ansible-playbook?

I am looking for a when condition which is fullfilled when the playbook is executed by ansible-pull.
1
vote
1answer
53 views

Can not install mysql client and server using a playbook Ansible

Do you know how I can fix this error? I'm getting 404 response from my node machibe when I'm trying to install default-mysql-client and server using Ansible-playbook apt module or shel. Facts I do ...
1
vote
1answer
104 views

Ansible with OpenSUSE transactional server

When using an OpenSUSE transactional server, transactional-update must be used instead of Zypper. Is there any way of doing this with Ansible?
1
vote
1answer
95 views

How to add a string to a line when it doesn't exist?

I'm trying to solve a problem where I want to add a setting 'pci=noaer' to all kernel definitions in /boot/grub/grub.conf, but only if the setting doesn't exist. I've managed to get the basic ...
1
vote
1answer
40 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
57 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
84 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
88 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
45 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
98 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
51 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
115 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
233 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
390 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
26 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
100 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
106 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
63 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
508 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
135 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
311 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
37 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
59 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
223 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
26 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
33 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
607 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
72 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
2k 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
191 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
165 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
2 3 4 5
8