This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hey guys. I'm really new to Ansible and automation platforms but I'm diving in to get as much knowledge as possible and really appreciate all the work shown here and on the documentation. I'm working thru a series of errors right now and could use some help.
I'm trying to connect to a singular VM right now. Ansible is spun up with plugins installed, tested, and with a plugin for StrongDM, got successful connections. However, when I'm working on a VM that isn't there, am getting an error:
/etc/ansible$ ansible linux -m ping
[WARNING]: * Failed to parse /etc/ansible/hosts with yaml plugin: We were unable to read either as JSON nor YAML, these are the errors we got from each: JSON: Expecting value: line 1 column 1 (char 0) Syntax Error while loading YAML. did not find expected <document start> The error appears to be in '/etc/ansible/hosts': line 8, column 1, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: [linux] IP.x.x.x ^ here [WARNING]: * Failed to parse /etc/ansible/hosts with ini plugin: /etc/ansible/hosts:23: Expected key=value host variable assignment, got: ansible_host
[WARNING]: Unable to parse /etc/ansible/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
IP.x.x.x | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: [email protected]: Permission denied (publickey).",
"unreachable": true
}
I changed my username to run as a local acct on the target VM but it is still referring back to my specific username.
My hosts file:
# This is the default ansible 'hosts' file.
# It should live in /etc/ansible/hosts
#ssh user, this user should allow ssh based auth without requiring a password
#if using ssh key based auth
[linux]
IP.x.x.x
[linux:vars]
ansible_user=ansibleuseracct
ansible_password=P@ssw0rd
I also minimized the CFG file to this:
# ansible.cfg
[defaults]
# Specify the inventory file (list of hosts)
inventory = /etc/ansible/hosts
# uncomment this to disable SSH key host checking
host_key_checking = False
[inventory]
enable_plugins = yaml, ini
Am I missing something from the basic setup and config?
Subreddit
Post Details
- Posted
- 8 months ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/ansible/com...