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
-1
votes
1 answer

How to find 'product_id' for the 'win_package' Ansible module?

I'm tried to automate installation of a range of programs, including 7-zip, Adobe Reader, Beyond Compare, etc, for about 30 different programs. For the first 2, I was able to find something that worked for product_id. Adobe Reader required hunting…
Josh
  • 700
  • 5
  • 14
-1
votes
1 answer

Ansible: How to obtain a list of Windows services along with their current status?

I am looking to get list of Windows services that is running along with their state by using win_service_info module – Gather information about Windows services. --- - name: Service Status hosts: test gather_facts: yes tasks: - name:…
Raj
  • 1
-1
votes
2 answers

A role in Ansible to compare and output the common packages installed in all the servers?

I tried to implement a new YML to list and give me the common packages in my 60 plus servers. Here is the draft: - name: Save list of common packages hosts: all gather_facts: false tasks: - name: Get list of installed packages shell:…
Galileo59
  • 1
  • 1
-1
votes
1 answer

ansible assign a fact to a variable

I am trying to get the set_facts assigned but I keep getting error that item not found. Could you please help me how to get this working - name: set facts identification hosts: all gather_facts: false become: true vars: dir_path: -…
-1
votes
1 answer

ansible: "variable is not defined" even with ignore_erros: True & failed_when: 0 > 1 | How to define variable when task is failed/ignored/skipped?

Trying to get a variable defined when the task is partially failed/ignored. When a VM is not found in Vsphere it throws an error: "msg": "Unable to gather information for non-existing VM vm2" I tried with and without ignore_errors: True and…
trainin99
  • 109
  • 10
-1
votes
1 answer

Is there a way to set AWX Tower's: Azure AD OAuth2 Callback URL or Azure AD OAuth2 Key via an API call?

Just wondering if there is any way I have not seen yet that is able to set Azure AD OAuth2 Key or Azure AD OAuth2 Callback URL via any type of API?
-1
votes
1 answer

How can I take a list of server names and append a resource URI and port to ] each be

i have this list of ansible inventory servers: - server01 - server02 - server03 - server04 i want to do like this example I want: https://server01:8000;https://server02:8000],https://server03:8000;https://server04:8000 but using set_fact
ahmed
  • 39
  • 7
-1
votes
1 answer

ansible jinja template pass variable

I want to pass multiple ip list and same port in single variable using ansible jinja. I want output in configuration file like this. value=["10.0.0.1:8200", "10.0.0.1:8200", "10.0.0.1:8200", "10.0.0.1:8200"] or if I can pass ["10.0.0.1:8200",…
-1
votes
1 answer

Ansible Java 17 priority task has no permission

I am trying to create a task in Ansible which makes my GraalVM Java JDK as the default installation. I do the following: - name: Make GraalVM Java as the selected version community.general.alternatives: name: java path:…
-1
votes
1 answer

Using Ansible, can we edit kernel level setting?

How can we set kernel settings using Ansible playbooks? I have gone through ansible.posix.sysctl module, but I am not able able to find threads.max.
-1
votes
1 answer

Ansible read remot_host:port lines from file and verify port is open

I am new to ansible and need help here. There is a file with 500+ remote_host:port line entries like below. remote_host1:port1 remote_host2:port2 remote_host3:port1 Using ansible how to loop over the lines from file, split the lines with 2…
kumarprd
  • 906
  • 2
  • 8
  • 21
-1
votes
1 answer

Access variables at play level

I use localhost and set_fact to store variables and access them in different playbooks. --- - hosts: localhost connection: local gather_facts: False tasks: - name: set_variables set_fact: cloudinit_fqdn:…
FDo
  • 17
  • 3
-1
votes
1 answer

Ansible Undefined variable in vars_files item but the variable was defined using set_fact

I'm trying to select a local file based on what motherboard version exists on the machine on which Ansible will deploy those files. So my approach was to use dictionary in format {"" : ".yml"}. And use this dictionary to…
Inc0gnito
  • 21
  • 6
-1
votes
1 answer

Why is ansible creating a new host scoped list variables for each host?

I need to create a variable of ip addresses that are derived from the run state of all hosts. I expect to insert a new string value and have it appended to the list. When I run the following ansible-playbook, it creates what looks to be a new list…
Jack Murphy
  • 2,952
  • 1
  • 30
  • 49
-1
votes
1 answer

referencing dictionary variable value in ansible task

Team, I have a task where am trying to reference value from a dictionary defined in my values file. but getting below error, any hint? am doing this exercise to use this reference in my other tasks later but first debug step itself is failing. I…
AhmFM
  • 1,552
  • 3
  • 23
  • 53