22,986 questions
0
votes
0
answers
17
views
Finding all objects matching a neighboring key in XML
I have a playbook I am working on in Ansible that will allow me to identify a specific set of firewalls, and then update them to a higher version of software. However, I need to take the existing ...
0
votes
0
answers
38
views
Ansible playbook fails on Windows environment
I have made some Ansible playbooks that retrieve information from hostvars to build a host inventory and upload it to a mariaDB database. It runs on our AWX server, myawxserver, a Linux machine.
The ...
0
votes
0
answers
44
views
Ansible playbook running a command on a server that's not in the host file [duplicate]
From within an Ansible playbook, after reading a file, I have retrieve two host names that are not in the host inventory file.
On the two retrieve host names, I want to execute a UNIX shell command ...
2
votes
1
answer
86
views
How to parse multiple email addresses from json data in Ansible via map(regex_search) filter
I've been trying to parse email addresses from the below json data:
"msg": [
{
"fqdn": "www.westero.local",
"function": "",
...
-1
votes
1
answer
46
views
How to make Ansible templates ignore certain changes
We use Ansible to maintain a large distributed application, which keeps various credentials scattered among multiple configuration-files (in different formats, too!)
These credentials aren't known to ...
1
vote
1
answer
62
views
In Ansible YAML, how do I pass different variables to an include_tasks to make it reusable?
I have a workflow where I download a file, do some stuff to it, upload it, and then download it again to verify that the changes took place. I want my download logic to be in a reusable YAML file that ...
1
vote
1
answer
80
views
Ansible Automation Platform: How to pass variable into Python script?
In a Bash script we need to write $1 instead the variable, remove the read command, define the survey in the AAP to execute the Bash file, and add the arguments in the shell module. It works. Now, how ...
0
votes
1
answer
66
views
Why is a JSON list parsed by Ansible Jinja not an iterable [closed]
I am attempting to write an ansible playbook that will need to iterate over items returned from an API. I am getting a JSON response from the ansible.builtin.uri module which includes a JSON list.
...
2
votes
2
answers
76
views
How can I transform a list of dictionaries containing two keys into a string?
I created an Ansible role that is setting up cron jobs for a user in a wide variety of Linux distros and versions. The cron jobs to be set up are defined in crontab_entries variable. Also there are ...
1
vote
1
answer
105
views
How to sum up numbers across inventory?
CSV files on each host contain certain figures and I need to add them all up.
To that end, I find the matching files first, and invoke awk to parse the CSV content and output the per-host total.
Where ...
0
votes
2
answers
109
views
Ansible (Jinja2) Case Insensitive selectattr
I am looking to perform a case insensitive comparison in Ansible with selectattr.
The below works, but does not guarantee a case insensitive comparison.
__app_pools_info.app_pools | selectattr('...
2
votes
1
answer
54
views
Ansible code using with_sequence with when condition applied
- name: ABC
block:
- include_tasks: abc.yaml
with_sequence: start={{ (x | int) + 1 }} end={{ y | default(1, true) | int }}
loop_control:
loop_var: item
when:
- (y | ...
3
votes
2
answers
92
views
Can an ansible collection query its own metadata?
Assuming an ansible collection with the following galaxy.yml file:
namespace: my-company
name: test
version: "1.0.0"
... is there a way from a task in my collection to find the 1.0.0 in the ...
1
vote
1
answer
78
views
Ansible `from_yaml` on a value from a vault
I am trying to use the from_yaml filter on a value stored in an Ansible vault. The exact same value works just fine when it is not stored in a vault value.
- hosts: all
vars:
unenc_yaml: "...
1
vote
1
answer
68
views
Ansible script is not generating a text document
I wrote a script to try and create a .txt document with a list of local user accounts across the enterprise. I'm not getting any errors, but it doesn't seem to create the document at the end with the ...