Questions tagged [ansible-facts]

Use this tag for questions regarding Ansible facts - values discovered by the setup module of Ansible or pulled from ohai/facter.

768 questions
-2
votes
2 answers

Ansible - "stdout_lines": ["inactive"]} interpreted as fatal error

I am using Ansible to get a service status on my machines. Unfortunately I get a fatal error that I am not so sure on how to fix. The code is working but this fatal error is really bothering me. Code: - name: Edit application.properties hosts:…
-2
votes
1 answer

How can I filter 'stdout_lines'?

I am trying to filter out a line out of Ansible stdout_lines result. The output script is then sent by email. Cannot get the display format I wanted. Required output format: host1: Service1: Status Service2: Status host2: Service1:…
Ivan
  • 1
  • 1
-2
votes
1 answer

Ansible - Escape double curly braces in fact used for password

I'm currently troubleshooting an issue we have in which we have an Ansible playbook which retrieves the password of a system using LAPS, assigns that password to a fact and then uses that to connect to a remote server to run an ansible role. For the…
Lagamorph
  • 1
  • 3
-2
votes
2 answers

How to lookup 'env' when Managed Node is a Windows host?

I need to get the Windows path variable %UserProfile% into an Ansible playbook; e.g. $env:USERPROFILE. If my Managed Node was a Linux host, I imagine something like ... vars: - wPath: "{{ lookup( 'env','USERPROFILE')}}" ... would work. But the…
GlennRA
  • 57
  • 3
-2
votes
1 answer

Problem using ansible facts defined using set_fact

So I'm having trouble making use of something I'm setting using set_fact. I'm making use of the community.windows LAPS module to retrieve the password for a given server which is working, but I'm having issues when attempting to then use that…
Lagamorph
  • 1
  • 3
-2
votes
1 answer

parsing json data in ansible using shell

I am unable to read a list using shell module. It's working fo one element in list but fails for two or more elements. tasks: - name: Create a List variable and print it set_fact: UserRecords: [ "[3/2/23 9:09:04:013 GMT+5:30] 0000…
-2
votes
1 answer

Ansible - How to run tasks on specific host only and not on all 'inventory_hosts'?

I have 3 applications hosted on three separate hosts and mentioned in the my.hosts file like below: [app1_webapp] host3.mybank.com [app2_webapp] host5.mybank.com [app3_webapp] host8.mybank.com My requirement is to run two types of raw module…
Ashar
  • 2,942
  • 10
  • 58
  • 122
-2
votes
3 answers

Adding values in a YAML file via loop

As a part of the Kubernetes Resource Definition, I want to whitelist certain IPs. The list of IPs can be found by $ kubectl get nodes -o wide --no-headers | awk '{print $7}' #This prints something like 51.52.215.214 18.170.74.10 ..... Now, In the…
java_enthu
  • 2,279
  • 7
  • 44
  • 74
-2
votes
1 answer

using loop_var on item from parent task, avoid or control over looping in child task for values only pertaining to parent item

Team, I have a parent task that runs child IncludeTask and from this I have a value item.item.0.device Now, in child IncludeTask, I have to use this item.item.0.device just in replacement of one value and rest of the values in loop are to be from…
AhmFM
  • 1,552
  • 3
  • 23
  • 53
-2
votes
1 answer

Unable to read stderr in results dictionary from ansible task output

Team, I am trying to learn how to read results. I tried searching online but no luck. Basically, I am trying to write a message based on when condition and it is failing as i might not be following how to intercept. vars: local_volume_mount_disks: …
AhmFM
  • 1,552
  • 3
  • 23
  • 53
-2
votes
1 answer

Ansible fail when condition not equal != not work on my play

The below playbook to check and compare input package name and version with our system when condition working fine on == but not works on != I don't why, And I'm stuck on this for the last couple of days --- - hosts: "{{ cluster_name }}" user:…
Mamoun
  • 13
  • 1
  • 6
-2
votes
1 answer

Add string to list by analyzing list item value (agregar string a lista if item=='valor' )

necesito agregar un string en una lista, con un valor dependiendo del valor de un atributo de la lista I need to add a string in a list, with a value depending on the value of an attribute in the list #ambprueba.yml LIST_BASES: - { BASE:…
upszot
  • 1
  • 1
-2
votes
2 answers

Getting error when trying to run python script using ansible

- name: Create directory for python files file: path=/home/vuser/test/ state=directory owner={{ user }} group={{ user }} mode=755 - name: Copy python file over copy: src=sample.py dest=/home/vuser/test/sample.py …
user583088
  • 989
  • 1
  • 6
  • 10
-3
votes
1 answer

Creating a list from json output

Given the below output of application_stop_time_output, I want to create a list of dicts which contain only item and stdout. stdout should be an interger. - debug: msg: "{{ application_stop_time_output }}" gives: ok: [ebppdoxs10] => { …
-3
votes
1 answer

Ansible get search domain from DNS in Ansible facts

How can I use the search domain in a variable? When I use "{{ ansible_dns['search'] }}" there are brackets in the output.
Andre
  • 39
  • 4
1 2 3
51
52