ansible-facts Questions
2
Solved
I'm habituated to use --tags when I'm using ansible-playbook to filter what tasks will be executed.
I recently switched from Ansible 2.7 to 2.9 (huge gap, eh ?).
I was surprised ansible did not gat...
Sleepwalk asked 4/9, 2020 at 10:59
3
Solved
I'm trying to pass a fact from host1 to host2, but when ansible reaches hosts2 it returns "undefined variable":
- name: some playbook
gather_facts: false
hosts: host1
tasks:
- set_fac...
Gillian asked 6/7, 2021 at 18:31
3
Solved
I would like to include variables from a file on the remote host, rather than the control machine Ansible is running on.
For example I have a file /var/database_credentials.yml (on my webserver)
...
Chase asked 15/2, 2016 at 13:10
4
Solved
i ve an ansible role which looks like this :
my-role
├─── files
│ my-file-one
│ my-file-two
│ my-file-...
│ my-file-n
└─── tasks
main.yml
in my main.yml , i ve this recursive copy task ,
and i...
Coleridge asked 3/1, 2020 at 14:1
14
Solved
How do you get the current host's IP address in a role?
I know you can get the list of groups the host is a member of and the hostname of the host but I am unable to find a solution to getting the...
Graphite asked 2/10, 2016 at 16:54
2
Solved
Has anyone faced the following issue with "{{ ansible_hostname }}" while calling in a playbook task directly?
Please suggest if there is other way around to do it or if I'm doing anything wrong he...
Pownall asked 30/6, 2017 at 4:39
4
Solved
I have a situation where i am trying to remove the item from a list. but i am not getting expected result. Please help me what I am doing wrong here?
here is the list :
"get_ec2_id.instances[0]...
Caralie asked 24/5, 2018 at 16:45
6
Solved
I am running myserver in ubuntu:
+ sudo cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL...
Heterologous asked 18/12, 2019 at 2:36
3
Solved
I'm having an issue with using the package_facts module in Ansible. Basically, I just want to get the version of zabbix-agent installed as I need to do some stuff depending on which version is inst...
Episiotomy asked 3/7, 2019 at 3:57
1
I am gathering ansible facts . A serial number is coming in upper and lower case. see below.
5A2c32a-f1G85g-2035-0483-1fe9c129216d
I need to compare that fact with another serial number which is ...
Hillaryhillbilly asked 26/9, 2019 at 2:55
2
To speed up execution of Ansible playbooks, I occasionally want to disable gathering facts during the setup phase. This can be done in the playbook by adding:
gather_facts: False
but how can it be...
Yarkand asked 3/5, 2022 at 4:34
10
Solved
I can do that with shell using combination of getent and awk like this:
getent passwd $user | awk -F: '{ print $6 }'
For the reference, in Puppet I can use a custom fact, like this:
require 'etc'
...
Smitten asked 26/10, 2015 at 10:16
2
Solved
Here is inventory file.
[abc]
host1
host2
[123]
host3
And main.yml
#play1
- hosts: abc
roles:
- { role: abc }
tasks:
...
#play2
- hosts: 123
roles:
- { role: 123 }
tasks:
debug: msg...
Colner asked 12/6, 2020 at 17:16
2
Solved
I have a playbook that contains roles for localhost and roles for remote hosts.
In one of the localhost roles I set a fact called git_tag.
I want to use this fact in a template for the remote hos...
Sulfaguanidine asked 3/7, 2017 at 12:8
3
Solved
I am trying to write an Ansible playbook which will identify newly added disks on a RHEL machine. The plan is to run the playbook and cache the disks at that point in time as a fact prior to creati...
Brok asked 18/7, 2019 at 21:15
3
I have the following code
- set_fact:
MY_HOSTNAME: "SOME VALUE"
MY_SERVER: "00.00.00.00"
- name: Get MY server
set_fact:
MY_SERVER: "{{ groups[MY_HOSTNAME][0] }}"
when: groups[MY_HOSTNAME] is...
Coniine asked 8/12, 2017 at 7:21
2
Example on Ubuntu 18.04 reporting distribution info in 'ansible_facts':
$ ansible -i hosts ubuntu1804 -u root -m setup -a "filter=ansible_distribution*"
ubuntu1804 | SUCCESS => {
"ansible_fact...
Argon asked 27/4, 2020 at 13:35
1
Solved
I am trying to extract the major distro version (which ansible_facts holds as a string) and store it as an integer for later < or > comparison to an integer. When I do this:
- set_fact:
dist...
Optometrist asked 8/9, 2021 at 20:5
2
Solved
Context: I have a system that has a combination of disks from different storage controllers, so each type of disk has different purpose. I'm new to ansible and learning as I go. Writing a playbook ...
Emmetropia asked 30/12, 2017 at 17:3
2
Solved
---
- hosts: "{{ run_on_node|default('mysql_cluster_sql[0]')}}"
connection: "{% if migrated is defined and migrated == 'yes' %}local{% else %}ssh{% endif %}" # This works as we...
Belletrist asked 6/7, 2021 at 12:53
3
Solved
When we check hostvars with:
- name: Display all variables/facts known for a host
debug: var=hostvars[inventory_hostname]
We get:
ok: [default] => {
"hostvars[inventory_hostname]": {
"ad...
Slue asked 16/4, 2016 at 16:58
1
Solved
On a M1 MacBook, ansible_architecture and ansible_machine returns the same value that is arm64:
shuuji3@momo mac-dev-playbook
> ansible -m setup localhost | egrep '_architecture|_machine'
"...
Inexecution asked 28/3, 2021 at 7:14
1
Solved
I'm trying to find the architecture of the machine by using Ansible facts.
We can gather information about the machine by running ansible -m setup <host-name> command, as described in the doc...
Herrenvolk asked 27/3, 2021 at 5:33
2
Solved
How can I pass a relative path so that Ansible can copy files from node/keys and copy them to a server?
The playbook is ansible/playbook.
My directory structure is:
├── ansible
│ ├── inventory
│ ...
Otter asked 11/9, 2019 at 11:37
1
I would like to get a list of variables used in an ansible playbook.
I looked into the setup and debug module, but I doubt I can do this.
Is there any generic way ?
Ottie asked 28/8, 2020 at 8:35
1 Next >
© 2022 - 2025 — McMap. All rights reserved.