Questions tagged [ansible-inventory]

Use this tag if a question is about ansible-inventory

Filter by
Sorted by
Tagged with
0 votes
0 answers
80 views

Ansible-Playbook to install Kubernetes cluster gives GPG error

For my virtualisation class, our lab assignment at the moment is to create a kubernete's cluster with 3 VM's / Nodes. I have a fourth machine where i installed ansible on that sends all correct ...
user42818's user avatar
2 votes
1 answer
29 views

Creating a cmd task with all the private ip address details collected from gather_facts

I am running an Ansible playbook from my local laptop to AWS connecting on the public IP address. The infra is being spun up by terraform so I don't know the private IP address before hand. I have ...
ranjit abraham's user avatar
1 vote
1 answer
83 views

Ansible inventory for restart on worker node

I looking to execute a simple reboot via Ansible using its playbook - name: Worker-node Reboot hosts: node1 gather_facts: no remote_user: team become: true tasks: - name: Reboot the ...
Terra's user avatar
  • 13
1 vote
1 answer
49 views

ansible_become has no effect despite the ability to execute sudo on GCP hosts

Say I want to execute the following command on target hosts (deployed on GCP): ansible all -a "head -1 /etc/shadow". The command demands the root access. With the default Ansible ...
SkogensKonung's user avatar
1 vote
4 answers
295 views

What is a good strategy to prevent Ansible playbook runs against the wrong hosts? [duplicate]

It is too easy to run playbooks on the wrong hosts in Ansible I know the best practice would be to use --limit to make sure you can not select the wrong host. I do not trust --limit to ensure Ansible ...
timfox123's user avatar
1 vote
1 answer
75 views

Creating a hostgroup from a super-set of hosts

I have two host files with different hosts, hostGroups and super-set in each file like below. /ets/hostFiles/TestBoxes [TestBox:children] groupA groupB [groupA] ... ... [groupB] ... ... /ets/...
Siva's user avatar
  • 223
2 votes
1 answer
224 views

Ansible: How to run ad-hoc command with multiple environnements?

Given the following architecture: ├── ansible.cfg ├── hosts │ ├── production │ └── staging ├── production │ ├── group_vars │ │ ├── all.yml │ │ ├── mygroup.yml │ │ └── mygroup2.yml │ ...
Tanuki's user avatar
  • 163
1 vote
1 answer
204 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 ...
Life5ign's user avatar
  • 130
0 votes
1 answer
1k 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] ...
user2152012's user avatar
2 votes
0 answers
1k 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....
synth45's user avatar
  • 71
2 votes
2 answers
1k 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 ...
synth45's user avatar
  • 71
1 vote
1 answer
1k 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 ...
synth45's user avatar
  • 71
6 votes
1 answer
22k 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 $ ...
Nicholas Saunders's user avatar
0 votes
2 answers
2k 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: ...
Nicholas Saunders's user avatar
3 votes
2 answers
615 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 ...
Amit Yadav's user avatar
5 votes
2 answers
13k 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....
Lucky The Rabbit's user avatar
1 vote
1 answer
44 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: ...
PaperTsar's user avatar
  • 113
1 vote
0 answers
89 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, ...
Jonas Hüsser's user avatar
0 votes
1 answer
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....
UnityNewb's user avatar
  • 101
3 votes
1 answer
939 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 ...
Daniel Flick's user avatar
1 vote
2 answers
922 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 ...
AVS's user avatar
  • 123
2 votes
1 answer
498 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'...
piojo's user avatar
  • 161
2 votes
1 answer
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 ...
devnull's user avatar
  • 129
1 vote
1 answer
1k 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 ...
user2187367's user avatar
9 votes
1 answer
4k 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 ...
tgr's user avatar
  • 448