Questions tagged [ansible-inventory]

Use this tag if a question is about ansible-inventory

Filter by
Sorted by
Tagged with
1
vote
1answer
51 views

Ansible: Does the `hosts: all` pattern in a play only match hosts specified in inventory, or does it also match playbook `add_host` hosts?

I know "all" doesn't match the implicit localhost; the title succinctly expresses my question. Motivation: I have a playbook that needs to be run on cloud hosts generated dynamically and ...
0
votes
1answer
163 views

ansible playbook cannot apply, giving host unreachable error

I'm completely new to ansible and I'm having a hard time with it. I have an inventory.yml file which is as the following: EDIT: changed my inventory.yml now looks as follows inventory.yml: [master] ...
1
vote
1answer
171 views

Ansible dynamic inventory using AWS plugin -- how to obtain internal DNS records or private IP?

Seeking help from those who've worked with dynamic inventory in Ansible. I have Ansible set up with the aws_ec2 plugin (not using the python script as it's been too problematic). Currently, I'm only ...
3
votes
2answers
4k views

Custom inventory file failing to parse properly

I've got the following production inventory file (playbooks/production.yaml) for Ansible: all: children: control: moriarty.server.com toby.server.com managed: sherlock....
1
vote
2answers
350 views

Ansible - merging inventories to share variables across?

Is it possible to merge inventories so I can share variables across them? Let's say I have two inventory files. Inventory A and Inventory B. They are both in a directory called inventories. Variables ...
1
vote
0answers
482 views

Ansible/AWS dynamic inventory -- How to create groups based on tags?

I am trying to create custom groups, based on tags. I am using this doc as a reference: https://docs.ansible.com/ansible/latest/plugins/inventory.html#inventory-plugins As a baseline, in my aws_ec2....
1
vote
1answer
5k views

ansible error: skipping: no hosts matched

I've tried a few variations on running ansible locally as a test case: nicholas $ nicholas $ ls ansible.cfg ansible.cfg.orig first_playbook.yml inventory.txt playbook.yml nicholas $ nicholas $ ...
0
votes
2answers
534 views

network ansible command error: "msg": "network os centos is not supported"

How do I get the ansible config for rolly below? remote: [nsaunders@rolly ~]$ [nsaunders@rolly ~]$ lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description: ...
3
votes
2answers
150 views

Can we use Ansible for monitoring configuration?

I understand how Ansible works and what it is used for. However, I was wondering if there is a way or feature (in open-source or enterprise edition) in Ansible using which, we can make sure that the ...
1
vote
1answer
31 views

Ansible: Backing up variable value doesn't work as expected

Attempting to save a variable's value for backup before modifying it doesn't work. I have the following inventory file (note the custom ansible_port and user): all: hosts: test: ...
1
vote
0answers
77 views

Per machine credentials for privileges escalation using AWX [duplicate]

I have an inventory with a lot of hosts in it using the same credentials, but one host needs a different approach. For the ssh connection a different user is used, after the connection is established, ...
1
vote
1answer
218 views

Can I check whether ansible is on last batch of rolling update (serial: 25%)?

I'm using Ansible to update a pool of EC2 servers with a rolling update, in batches of 25%. In between batches, I'm pausing long enough for the server health checks to start to pass again (since they'...
0
votes
1answer
1k views

Ansible - stop when host is success, exit with IP

Basically, my use case is that I want to run on list of hosts (group from inventory). It will run one by one, until it finds machine answer my standards, when it find the one with free RAM as I say e....
3
votes
1answer
780 views

Unable to run playbooks using Ansible best practices layout

I am very new to ansible and I think I am lacking something basic that I am not finding in the examples or on github as to the directory structure and its use. I have set up my directory structure ...
1
vote
2answers
568 views

Ansible authorized copy from remote source to remote destination

How to use ansible authorized_key to authorize a ServerA (not the controller machine) to access Server B. Scenario: Need a playbook to execute from a ansible controller that should append id_rsa.pub ...
1
vote
1answer
859 views

How to write logs for certain tasks only?

I am using Ansible and created a Playbook for deployment. I defined log_path in ansible.cfg and now tasks output are going to this log file. I want to send only few task's log into this log file. How ...
2
votes
1answer
1k views

Ansible YAML inventory - Groups that are allways members of other groups

Situation: I have a group "webservers" where I put all webservers in. As well as a group "mysqlservers" for the database servers respectively. Now I do also manage some LAMP servers and I want them ...
7
votes
1answer
2k views

How to notate ipv6 addresses in inventory file?

I have a machine, that is accessible via ipv6 only. It is setup for ssh with rsa key. Now I'd like to manage it with ansible. Unfortunately, this is not covered in the inventory documentation. So I ...