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

Ansible Setup Module to search and find an IP address

My hosts have 3 network IP addresses and one of them is needed later in my playbook. In my playbook I have ran the following setup module: - name: Gather Networks Facts into Variable setup: register: setup - name: Debug Set Facts debug: …
PatchSte
  • 11
  • 1
  • 3
0
votes
1 answer

Ansible playbook gating facts in a temporary folder

There are a useful ansible command that gathing the facts and store them, like this, ansible -m setup --tree out/ all But how could do it by ansible-playbook -i inventory.ini ? just store the facts but not actually run the playbook and only for…
James.Y
  • 1,427
  • 1
  • 11
  • 16
0
votes
2 answers

Simplest non-shell way to confirm set of mount points exist with custom minimum size for each

ansible_mounts is an array of dictionaries, like so - "ansible_mounts": [ { "device": "/dev/mapper/vg_centos67template-lv_root", "fstype": "ext4", "mount": "/", "options": "rw", …
Paul Hodges
  • 13,382
  • 1
  • 17
  • 36
0
votes
1 answer

ansible playbook is failing

part of playbook is given below:This is the ansible playbook(main.yml) - name: setting Info data set_fact: application_data: log_file_name: "{{ log_file_name }}" log_file_dir: "{{…
Vishnu Imp
  • 5
  • 1
  • 7
0
votes
1 answer

How to regex replace nested values in Ansible

This question is about looping in Ansible, not about AWS, but for the sake of clarity I will use an AWS deployment problem as an example. For our deployment scripts I am trying to loop over some clusters in the Amazon EC2 container service. What I…
titusn
  • 1,201
  • 1
  • 12
  • 43
0
votes
1 answer

Fact access from another role in Ansible

I have set some facts during my ansible play using pre_tasks: - name: set site name variables set_fact: site_name: '{{ ansible_hostname | regex_replace("^([a-z]{3}[0-9]).*", "\1") }}' site_name_upper: '{{ ansible_hostname…
ebarrere
  • 222
  • 1
  • 12
0
votes
1 answer

Loop over ansible_devices and select any physical disk that is not sda for inclusion into volume group

I have a requirement to build two logical volumes. sda1 will always form /root and be partitioned up for logs and such, but /application may include anywhere from one to four additional disks. I know they will always begin with sdb and continue on…
0
votes
1 answer

remove colons from macaddress in ansible

I need to create a file from an ansbile fact such as ansible_default_ipv4.macaddress by removing the colons from the mac address I've tried everything I could think of and can't get it to work
Bill Nolf
  • 21
  • 3
0
votes
1 answer

not able call more than one roles by using include_role

needed help to see what is wrong with this include_role. This work without any problem: #US East (N. Virginia) - hosts: localhost gather_facts: false connection: local vars: region_services: - "us-east-1" tasks: - name: 3 run -…
0
votes
1 answer

YAML/ANSIBLE -> save variable key and value to new variable

I'm working on a small ansible project for myself. I have a main.yml in the defaults folder of my role. Structure: master-folder `- roles `- some_role |- tasks | `- main.yml `- defaults `-…
Shai Shvili
  • 99
  • 1
  • 1
  • 6
0
votes
1 answer

changing values directly on the destination system instead of copying file from the source

using ansible looking for some idea for changing values directly on the destination system instead of copying files from source. example: I have many files in tmpl format on the destination system and would like to change the values related to this…
0
votes
1 answer

Is it possible to use and ansible-fact with the with_dict module?

I'm trying to write a role to configure a keepalived cluster. I was hoping to pass unique info into the a template based on the IP of the target box. In this scenario: Server A is 192.168.1.140 and Server B is 192.182.1.141 and the VIP would be…
0
votes
2 answers

copy and running configfiles programatically in ansible

There is a ansible code i am writing. It does two tasks, first is to copy a configuration file to target instance in groups. Second is running that config file to install the application. I am creating configuration file and inventory…
Krishna Sharma
  • 131
  • 2
  • 3
  • 12
0
votes
1 answer

Ansible regex_findall multiple sets

I am attempting to gather data from an IOS device with Ansible, and then use the collected data to run tasks against. I am running a task to do a show running-config command to find interfaces with a specific description: - name: get current…
hiddenicon
  • 551
  • 2
  • 11
  • 23
0
votes
1 answer

How to make arch specific decision in Ansible playbooks?

I am trying to use Ansible playbooks to run a multi-arch cluster. Now, to do that I need to make arch specific decisions. Is there any ansible module that can help me do that? Or is there any way where I can know the arch and use that in "when"…
Pensu
  • 3,263
  • 10
  • 46
  • 71