Skip to main content

Questions tagged [ansible]

Ansible is an open-source software platform for configuring and managing computers. It combines multi-node software deployment, ad-hoc task execution, and configuration management.

0 votes
2 answers
139 views

skip hosts with unsupported Python3 version

Assume a setup where there is a central git repository with inventories, roles, playbooks, etc. used to manage a lot of VMs with varying versions of installed software. The oldest Debian in question ...
mirabilos's user avatar
  • 755
4 votes
1 answer
390 views

How to generate reproducible ssh key?

I want to set up a local docker dev environment for ansible (semaphore ui container) and a dev docker container for testing tasks. To avoid storing the ssh key somewhere I thought I create a ...
John Doe's user avatar
  • 155
0 votes
1 answer
247 views

ansible ssh remote login failing to google compute engine VM

Just starting to work with ansible. I have a private ssh key on my local system, and a public ssh key in ~/.ssh/authorized_keys on the remote host. For test purposes, I have set the following ...
Gary Aitken's user avatar
0 votes
0 answers
32 views

Issues using Amazon plugin for Ansible dynamic inventory

I'm trying to generate a dynamic inventory for Ansible using the AWS plugin: plugin: amazon.aws.aws_ec2 regions: - us-west-2 filters: instance-state-name: running tag:management: ansible ...
Daniel Carrington's user avatar
1 vote
1 answer
171 views

localhost setting in Ansible automation platform

I would like know how the AAP containerization works. Usually in Ansible cli we use to give command like below if I want use some file from local system ansible-playbook -i localhost, -e “a=b” ...
Prade's user avatar
  • 63
0 votes
0 answers
34 views

AWX24 Ansible Smart Inventory Filter Syntax?

I'm trying to create a very basic Smart Inventory in AW24 to subdivide my Alma 8 and 9 hosts using ansible_facts, but I am really struggling to find the correct filter syntax. I have tried all of the ...
motorleague's user avatar
2 votes
1 answer
136 views

Running an ansible playbook against dynamically defined hosts

Sometimes part of a deployment is to create new hosts from scratch. I want my playbook to continue against such dynamically created hosts. Here is an example: - name: Deploy a node hosts: localhost ...
Fadeway's user avatar
  • 165
0 votes
1 answer
53 views

Ansible causing SSH connections to drop when used

I'm starting to get Ansible setup to manage a proxmox based homelab. The current setup is: Proxmox server, with a mix of VMs and LXC containers Proxmox firewall configured to allow SSH access. I've ...
Adam Luchjenbroers's user avatar
0 votes
1 answer
671 views

Ansible jinja2 formatting in assert statement gives "Conditional is marked as unsafe, and cannot be evaluated."

I have the following task code, when run it pulls back the Linux df output of the /var/tmp and /opt/Tanium file systems. When I execute the task, I get: fatal: [company.domain.abc]: FAILED! => ...
Greg Michael's user avatar
0 votes
1 answer
77 views

Is there an way to sync user accounts, packages & conda envs across computers?

I have 3 nodes (hostnames: server1, server2, server3) on the same network all running Proxmox VE (Debian essentially). The OSs of each are on NVME drives installed on each node, but the home ...
Shookti's user avatar
0 votes
1 answer
310 views

Make a sound on an Ansible control node during a play

I would like to add a task to an Ansible playbook that plays a sound on the control node, so that for a long running playbook I get an audible alert when certain things happen. I normally accomplish ...
Matt Pennington's user avatar
0 votes
1 answer
407 views

Ansible vmware.vmware.vms Dynamic Inventory plugin

I want to create dynamic inventory with the vmware.vmware.vms ansible plugin. I want to customize my inventory to select Linux hosts only. I don't understand how the plugin is working and the ansible ...
Suffren's user avatar
  • 31
0 votes
0 answers
220 views

Ansible WinRM random connection timeout to Exchange 2016 server with NTLM

In our ansible playbook we are sometimes getting an Connection Timeout error on Microsoft MS Exchange 2016 server. This issue happend almost every time on the first ansible run, when i run the ...
Martin Kollár's user avatar
2 votes
1 answer
127 views

Ansible loop while with Post method

I am trying to rotate a list from the command line and pass it to a Post method to Servicenow using the Ansible URI module. I am very close, but not getting what exactly I wanted. would appreciate it ...
Prade's user avatar
  • 63
1 vote
2 answers
308 views

Ansible filter hosts with specific registered value

I would need help to filter hosts with specific previous result, to be able to use add_host module. It seems add_host is ignoring the "when" condition, so probably I need to make a loop for ...
Balange's user avatar
  • 11
1 vote
1 answer
138 views

Ansible variable maps not returning values

I'm just getting started using Ansible and am trying to create playbooks that can use variable maps for certain values that might be different from one Linux distribution to another. The first one is ...
Daniel Carrington's user avatar
1 vote
1 answer
158 views

Trying to write a CSV line from a multi-line results variable

- name: Build out CSV file ansible.builtin.lineinfile: dest: "{{ csv_path }}/{{ csv_filename }}" line: "{{ result.stdout_lines[0] }},{{ result.stdout_lines[1] }},{{...
user1073624's user avatar
0 votes
1 answer
203 views

Ansible module ansible.builtin.user not working with Ubuntu generic boxes

Try to up generic/ubuntu18(20|22) image and add users there by ansible.builtin.user module. It goes OK, but user not adding really. Why does it goes? Ansible: 2.16.3 Vagrant: 2.4.3 Host OS: Ubuntu 24....
Hvprvtr's user avatar
  • 23
0 votes
1 answer
221 views

Ansible: what i'm doing wrong? I want to check if service active (by shell, not by builtin modules) then install it

I have this playbook: - name: push ssh key for all lxc hosts: proxmox_host vars: lxc_cts: - 100 - 102 - 106 - 107 - 108 - 109 - 111 ...
NSWH's user avatar
  • 13
0 votes
0 answers
69 views

Is it possible to populate list of values in ansible's defaults/main.yml?

Having a custom inventory data structures and input arguments of a role, I want to populate those input arguments from inventory data structures. Is it possible to somehow populate list in a loop? For ...
X bl lJJ H i K's user avatar
0 votes
2 answers
70 views

ansible task to use lxc exec to extract a tarball

I am trying to push a static website to an LXD Container. I could use lxc file push for every file, but I thought I'd push a single archive and then extract it. I can run tar -xvf /home/ubuntu/public....
Terry G Lorber's user avatar
0 votes
1 answer
293 views

Cut the ansible-playbook output

Is any way here to reduce the ansible-playbook command output (ansible_facts in that case)? I couldn't find a way to cut the command verbosity. My config file is [defaults] verbosity=0 log_path = /var/...
Ilya Shmadchenko's user avatar
2 votes
1 answer
294 views

Ansible oneline log output

I've just write the Ansible config to keep my ansible.log at one logline per action. [defaults] log_path = /var/log/ansible.log nocows=true stdout_callback=ansible.builtin.oneline host_key_checking = ...
Ilya Shmadchenko's user avatar
0 votes
1 answer
121 views

Proper YAML configuration for ssh_security ansible role

I am creating an ansible rolke for configure ssh security on servers, following the documentation. Here is my YAML configuration file: --- - name: Enable SSH security hosts: webservers tasks: ...
fccoelho's user avatar
  • 113
-1 votes
1 answer
83 views

Match only exact string not partial

- name: Installed packages. ansible.builtin.shell: cmd: apt list --installed | cut -d'/' -f1 | uniq register: installed_packages - name: Install packages. ansible.builtin.apt: name: &...
crkinard's user avatar
2 votes
1 answer
305 views

Ansible replace: regex/replace multiple lines?

In ansible, I'd like to replace this: pgsql: useCluster: false addr: 127.0.0.1:5432 password: "" email: to: [email protected] port: 465 password: "" replace to this: pgsql:...
user25613212's user avatar
0 votes
1 answer
132 views

Check progress when running ansible-pull with cloud-init

I am provisioning an Ubuntu VM in Kubernetes. To set it up I am using ansible. How can I see the logs of ansible-pull executed in cloud-init? I would like to monitor the process and check when it's ...
devamat's user avatar
  • 101
-1 votes
2 answers
2k views

"Missing sudo password" when trying to 'become_user' as a user that has no password and is configured 'ALL=(ALL) NOPASSWD:ALL'

I am trying to use the options 'become; and 'become_user' in a playbook where the user in question has passwordless sudo on the target machine. But every time I try and run the playbook I get the ...
crkinard's user avatar
0 votes
1 answer
1k views

Ansible: how to explain that sometimes $HOME environment variable is set and sometimes not?

With ansible it seems that sometimes the following code will work as expected: - name: "copy some script" become: yes become_user: "{{ tomcat_user }}" ansible.builtin.copy: ...
Nico's user avatar
  • 156
0 votes
1 answer
253 views

Ansible vmware module keep getting permission denied

I'm writing a playbook to perform some VMware tasks. The first step is to gather VM facts. However, I'm keep getting permission denied error. That's the part of my code for getting the VM facts: - ...
NeilWang's user avatar
  • 401
1 vote
1 answer
91 views

Ansible-map fuction

employees: sarav: city: Coimbatore email: [email protected] mobile: '985643210' tasks: - name: gathering_complete_data ansible.builtin.debug: msg={{ ['sarav']...
learnansibe's user avatar
0 votes
1 answer
1k views

Ansible global group_vars/all.yml taking precedence over inventory group_vars/all.yml

In Ansible 2.16.8 on a Mac (M1) running Python 3.12.4 (via homebrew) I am trying to setup a global group_vars/all.yml that can be overwritten by inventory/x/group_vars/all.yml if needed. However, it ...
Panduar's user avatar
-2 votes
1 answer
49 views

ansible Q. RSA, passwd

Ansible Installation Completed Host IP input completed in /etc/ansible/hosts Attempt to ssh with each node - Enter password and succeed Successful RSA [enter image description here][1]...
kazuha's user avatar
  • 1
1 vote
1 answer
208 views

Ansible Automation Platform not Syncing with Gitlab project

AAP 2.4 Project not syncing GitLab using PAT and my error is SSL certificate problem: self signed certificate in certificate chain. I really don’t want to disable https and not sure if I download the ...
Andreas's user avatar
  • 21
0 votes
0 answers
98 views

Ansible variable precedence in a play vs in a task

I'm struggling a bit with variables precedences in my play and in a task. I'm using this play, which works great but I've add a last task to reboot my windows server BUT i have to use a special ...
motorbass's user avatar
  • 453
6 votes
1 answer
1k views

Why does ansible reevaluate a variable on each access

I need to generate some unique id in ansible. The generation works but accessing the variable results in some "not expected" behaviour. The playbook is very simple: --- - hosts: localhost ...
Martin Garbe's user avatar
2 votes
2 answers
1k views

Ansible: How to merge a list and dict into new nested dict

I'm trying to build reverse look-up (PTR) records for bind. I have a CSV file with IP and Hostname fields loaded into a dict (from read_csv), so I guess it's a list of dicts actually: ok: [localhost] =...
Matt Wagner's user avatar
1 vote
1 answer
805 views

I am getting an error in the ansible playbook file

I am trying to learn ansible and I have coded my first playbook but it gives me the error saying ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each: JSON: ...
nagesh naga's user avatar
0 votes
1 answer
944 views

Building SAMBA AD DC container with Docker and Kubernetes gives wrong content to volumes

I am building a container for Kubernetes that runs a SAMBA Active Directory Domain Controller. I am doing the job through Ansible and the container is being deployed in a Kubernetes cluster (K3S). ...
Lasse Michael Mølgaard's user avatar
3 votes
2 answers
82 views

How can management efficiently handle 10 servers with the same stack?

I have a problem with my server structure. I have a scraper script on more than 10 servers. btw. This server is on a different provider, etc. Currently, I am installing the same library on each server,...
robokonk's user avatar
0 votes
1 answer
594 views

Why does this code generate an Ansible deprecation warning?

# Build a list of Adtran AP mac addresses found on directly connected switch ports - name: PARSE AND FILTER MAC ADDRESS-TABLE ansible.builtin.set_fact: macs: "{{ macs + [item] }}" ...
Appleoddity's user avatar
  • 3,980
0 votes
0 answers
342 views

Use yum or versionlock to ignore packages associated with a repository

I have a RHEL-8 bash script that installs several packages including ansible. Some of the packages come from epel while others come from the default rhel-8-baseos-rhui-rpms. dnf-automatic has exposed ...
John R's user avatar
  • 413
0 votes
2 answers
1k views

How to make ingress-nginx use provided certificate to user?

I am installing Home Assistant in my K3S Kubernetes cluster through Ansible and I want to use a Let's Encrypt certificate for my ingress that has been generated by Cert-Manager running on my cluster. ...
Lasse Michael Mølgaard's user avatar
0 votes
1 answer
272 views

Getting permission error from Unifi Network Application when connecting to MongoDB in Kubernetes

I running K3S Kubernetes on a cluster server consisting of a mixture of Raspberry 4 and Raspberry 5 nodes. I want to install Unifi Network Application on the cluster server and have come pretty far in ...
Lasse Michael Mølgaard's user avatar
0 votes
1 answer
242 views

How can I hide a file or folder using Ansible on Windows?

Is there a way to mark a file or folder as hidden using Ansible on Windows? I've checked the win_file module, https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_file_module.html ...
Saaru Lindestøkke's user avatar
1 vote
0 answers
206 views

[ANSIBLE][FORTIGATE] Error in repo for the module fortios_log_webtrends_filter

I am having trouble using ansible to push playbook on fortigate. In fact, I am writing a playbook to filter urls through categories. To do that i use the module fortinet.fortios....
Pierre C's user avatar
0 votes
1 answer
122 views

Unset SDKROOT in Ansible

I'm running an Ansible play that is cross-compiling with Xcode on MacOS. When I run printev in my playbook, I see this value: SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX....
jackwise's user avatar
  • 269
3 votes
1 answer
2k views

Ansible Lint not finding community.general included with Homebrew-installed Ansible

I am having an issue with Ansible Lint not finding community.general modules: > ansible-lint <redacted>.yml WARNING Listing 1 violation(s) that are fatal syntax-check[unknown-module]: couldn'...
Dave Dribin's user avatar
2 votes
2 answers
499 views

How can I set Ansible command arguments based on what keys a loop item has?

Context I'm using Ansible to setup Windows servers using the win_chocolatey module. In my group_vars/windows_servers.yml file I have: choco_packages: - 7zip - git - vscode And in my playbook ...
Saaru Lindestøkke's user avatar
0 votes
1 answer
515 views

How to create Persistent Volume Claim in Kubernetes with Ansible?

I am trying to install Unifi on a Kubernetes cluster server (K3S) using Ansible and ran into troubles when trying to define a persistent volume claim. I am using Kubernetes.Core module and I have ...
Lasse Michael Mølgaard's user avatar

1
2 3 4 5
37