Hi Omodotun,
I think that's because your Ansible config file is too old.
It's old format.
You should use new syntax in the config file.
Here is my example
ansible.cfg
=====
[defaults]
inventory = ./inventory
private_key_file = ~/.ssh/id_rsa.field.private
=====
inventory file :
=====
[cdp]
zzeng01.novalocal
zzeng02.novalocal
zzeng03.novalocal
zzeng04.novalocal
=====
Then
[centos@zzeng01 ~]$ ansible cdp -m ping
zzeng02.novalocal | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/libexec/platform-python"
},
"changed": false,
"ping": "pong"
}
zzeng04.novalocal | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/libexec/platform-python"
},
"changed": false,
"ping": "pong"
}
zzeng03.novalocal | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/libexec/platform-python"
},
"changed": false,
"ping": "pong"
}
zzeng01.novalocal | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/libexec/platform-python"
},
"changed": false,
"ping": "pong"
}
2022年3月28日月曜日 20:09:09 UTC+9 omodotun Babatope:
> Hello Anthony,
>
> Greetings to you.
>
> Hope my email finds you well.
>
> I am trying to connect to my linux ubuntu and centOS VM using this
> IP: 13.67.227.239 & 13.89.200.76
> I have this error: (/home/ansible/tutorials/chapter1/ansible.cfg): Source
> contains parsing errors: '<string>'
> [line 2]: '13.67.227.239\n'
> [line 4]: '13.89.200.76\n'
>
> Can you please advise.
>
> I would be happpy to get a response from you.
>
> Best regards.
> Dotun.
>
>
>
> On Tuesday, March 16, 2021 at 5:34:38 AM UTC-5 [email protected] wrote:
>
>> Hi Guys sorry new to this and thanks to Antony Stone - sorry if im being
>> dents but im determined to learn this and glad i found such a great group
>>
>> so actually i did have the lines and took them out - now i am getting the
>> following
>> [WARNING]: * Failed to parse /etc/ansible/hosts with yaml plugin: YAML
>> inventory has invalid structure, it should be a dictionary, got: <class
>> 'ansible.parsing.yaml.objects.AnsibleUnicode'>
>> [WARNING]: * Failed to parse /etc/ansible/hosts with ini plugin:
>> /etc/ansible/hosts:1: Expected key=value host variable assignment, got:
>> ubuntu2004
>> [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'
>> [WARNING]: Could not match supplied host pattern, ignoring: ubuntu2004*
>>
>> Basically all i am trying to do is the following - im going through th
>> basics
>>
>>
>> [root@sc-centos-1-2-1-build-1 ansible]# ansible ubuntu2004* -m file -a
>> "path=/home/user1/file2.txt state=touch mode=700"
>>
>> On Mon, 15 Mar 2021 at 19:53, Mohamed Rahiman <[email protected]> wrote:
>>
>>>
>>> Error reading config file (/etc/ansible/ansible.cfg): Source contains
>>> parsing errors: '<string>' [line 4]: ' 3 \n' #601
>>>
>>> Hi Guys
>>>
>>> I am learning Ansible as a newbie so that i can get into the industry of
>>> IT, I am learning everything from scratch
>>> I have two hosts - hosts 1 and 2
>>> i am trying to create a file from host 1 to host 2 - using ansible when
>>> i do this i get the following
>>>
>>> Error reading config file (/etc/ansible/ansible.cfg): Source contains
>>> parsing errors: ''
>>> [line 4]: ' 3 \n'
>>> [line 5]: ' 4 # nearly all parameters can be overridden in
>>> ansible-playbook\n'
>>> [line 6]: ' 5 # or with command line flags. ansible will read
>>> ANSIBLE_CONFIG,\n'
>>> [line 7]: ' 6 # ansible.cfg in the current working directory,
>>> .ansible.cfg in\n'
>>> [line 8]: ' 7 # the home directory or /etc/ansible/ansible.cfg,
>>> whichever it\n'
>>> [line 9]: ' 8 # finds first\n'
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ansible Project" group.
>>>
>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected].
>>
>>
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/6399a87a-5473-4acc-a974-c339eb458e0fn%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/ansible-project/6399a87a-5473-4acc-a974-c339eb458e0fn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/2d7b2c3f-41ae-4098-a507-ce9c30633229n%40googlegroups.com.