Can't use ansible inventory file because it is executable

I am trying to run an Ansible inventory file ansible -i hosts-prod all -u root -m ping and it is failing with this message: ERROR: The file hosts-prod is marked as executable, but failed to...

Displaying a custom name for a host

I have an Ansible play-book for working with EC2 instances. I'm using dynamic inventory (ec2.py) to get the group of instances that I want to work with (hosts: tag_Service_Foo). When I run it, it...

Ansible: "Failed to connect to the host via ssh" error

I'm trying to get set up with Ansible for the first time, to connect to a Raspberry Pi. Following the official 'getting started' steps, I've made an inventory file: 192.168.1.206 .. but the...

ansible play_hosts template loop

I'm trying to use the play_hosts variable in an ansible template. I'm trying to setup a master / slave domain setup for wildfly. So I wish to loop over all hosts in the inventory group, without...

getting "skipping: no hosts matched" with ansible playbook

my below ansible (2.1.1.0) playbook is throwing "skipping: no hosts matched" error when playing for host [ec2-test]. The ansible hosts file has the fqdn of the newly created instance added. It...

Ansible: To use the 'ssh' connection type with passwords, you must install the sshpass program"

Recently I created new roles called spd in my existing project. While other script works fine in the setup. This newly created fails. Please point me to what is going wrong here ansible/roles ...

host_vars and group_vars are not getting loaded

I have below folder structure, which seem to make it build and load the roles, but the group and host vars are not being loaded. How come? /etc/ansible/ - hosts - requirements.yml - group_vars/ ...

How can I get the sequence number of host entry defined in inventory file (Ansible)?

I have an inventory file with two hosts defined as below [testservers] xx.xx.xx.106 ansible_ssh_user=johndoe xx.xx.xx.138 ansible_ssh_user=johndoe xx.xx.xx.141 ansible_ssh_user=johndoe I want to...

How Exactly Does Ansible Parse Boolean Variables?

In Ansible, there are several places where variables can be defined: in the inventory, in a playbook, in variable files, etc. Can anyone explain the following observations that I have made? When...

Ansible fails to connect with SSH (banner exchange)

Sorry in advance if the question is not clear and/or if i am not askin where i should. I have issues with connecting to hosts with ansible via SSH. It worked few days ago but i have been having...

Ansible "Failed to connect to host via ssh: Permission denied" when trying -m ping all

I've been at this all morning, and I've seen multiple posts about this error in other places, but none of the solutions seem to be working for me at this point. I'm playing around with Ansible and...

Using Host Group as Variable in Ansible Task

I'm working on putting together a playbook that will deploy local facts scripts to various groups in my Ansible inventory, and I would to be able to utilize the group name being worked on as a...

Ansible :Unable to parse /etc/ansible/hosts as an inventory source

I am new to ansible, got the below issue. I was able to ssh into my client machine .but unable to run playbook. Getting the error below: [WARNING]: Unable to parse /etc/ansible/hosts as an...

Ansible task fails when executed manually with: "skipping: no hosts matched"

I am trying to follow along with a DevOps book (for SharePoint), it describes a way to provision different environments (dev,prod,test) by using vagrant and ansible together an automated,...

Ping a host inside ansible playbook

I just want to ping a host(DNS host) to check reachability. Looks there is no proper way to do this? I'm not sure. Below is my playbook with net_ping --- - name: Set User hosts: web_servers ...

Timeout waiting for privilege escalation prompt

Context I'm asking this question because those two questions/answerse (one and two) have little context, and I'd liket o expand on it. I'm trying to provision CentOS7 production servers with...

Ansible dynamic inventory keyed groups gcp

I am trying to create a inventory file in ansible which groups all instances according to the instance group in the Google Cloud Platform. Ansible docs give the following example to group...

ansible returns with "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6))

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...

Ansible ad-hoc command: time to return output from host

I am running a simple ansible ad-hoc command across all hosts in inventory and I want ansible to also show time it took to return output from each host. I can see the time in log, but I want to...

ssh-copy-id Permission Denied AND ansible all -m ping Unreachable

[[email protected] ~]$ ssh-copy-id 172.31.81.164 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/ansible/.ssh/id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log...

How to decrypt a 'clear text YAML file' with vaulted variable?

I'm using ansible 2.7.16. The ansible documentation says: Single Encrypted Variable As of version 2.3, Ansible can now use a vaulted variable that lives in an otherwise ‘clear text’ YAML...

How do i use pre task module in ansible to validate input parameters?

I want to validate few things before i run my main play in Ansible. For example below command is taking 2 input arguments from the user so I want to validate them before executing the main...

Creating ansible inventory for multiple target hosts

I am using terraform to create resources then using templatefile approach to create ansible inventory in yaml language. I am creating multiple Virtual Machines in terraform and configure them...

Pass a list as inventory to ansible_runner python module

I want to use ansible_runner to do some parsing on hosts. I have a script which gathers a list of hosts from a database and then I want to pass that list to ansible_runner python module without...

Ansible "ERROR! Attempting to decrypt but no vault secrets found" but I'm not decrypting anything

Odd and Frustrating Error I'm trying to learn and create a python module for Ansible. I'm, following this page: Medium.com This is to a local module so I just want to use ./library/module.py. The...

Running ansible on the first node

I am trying to configure a series of web servers. I have the following in my inventory file: web_servers: hosts: 1.2.3.4: 1.2.3.5: I want to make sure the very first host (1.2.3.4) has...

Anisble Nmap inventory plugin

Hey I am trying to make a dynamic Inventory that scans the network looking for hosts to add, At the moment i am kinda stuck And i don't know what i should do to trouble shoot i used this turtorial...

ansible.inventory.manager check inventory for error in python

I have an Ansible hosts.ini with an error [linux] server01 pr_ip_address = 10.0.0.1 I wrote following function in python from ansible.inventory.manager import InventoryManager from...

Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}. by awxkit

I try to backup and restore AWX to another instance. They have the same environment and the same version ansible and AWX. I export data: awx export > all.json and import on another instance. awx...

Error was a <class 'jinja2.exceptions.TemplateRuntimeError'>, original message: no test named 'equalto'"} while running ansible playbook

Ansible Playbook: name: VMware VM Inventory Generator hosts: localhost gather_facts: no vars: hostname: xxxxxxxxxxx username: [email protected] password: xxxxxxxxxxx ...