Now the issue is caused by indentation:

- name: configure provider
   set_fact:

set_fact must start at the same position as 'name' above it.

kind regards
Pshem


On Tue, 21 Nov 2017 at 18:39 SK <[email protected]> wrote:

> Thank you for the suggestion about dash before name.  I have updated that
> and still receive the same error.  The error is pointing towards set_fact.
> I will take a look into text editors for YAML.
>
> ansible-playbook -vvvv configs.yml
> Using /etc/ansible/ansible.cfg as config file
> ERROR! Syntax Error while loading YAML.
>
>
> The error appears to have been in '/etc/ansible/configs.yml': line 12,
> column 8, but may
> be elsewhere in the file depending on the exact syntax problem.
>
> The offending line appears to be:
>
>       - name: configure provider
>        set_fact:
>        ^ here
>
>
> On Friday, November 17, 2017 at 5:16:24 PM UTC+8, Pshem Kowalczyk wrote:
>
>> Hi,
>>
>> You need a space between the dash '-' and 'name:' in the task list.
>> I suggest you find a text editor that supports YAML validation to make
>> your life easier.
>>
>> kind regards
>> Pshem
>>
>>
>>
>> On Fri, 17 Nov 2017 at 20:42 SK <[email protected]> wrote:
>>
> Hi,
>>>
>>> I am using Ansible for the first time to test basic commands on Network
>>> devices.  When I run the playbook, I am encountering errors even though the
>>> configuration looks normal.  Below is the OS of my source machine where
>>> Ansible is installed:
>>>
>>> CentOS Linux release 7.3.1611 (Core)
>>>
>>> My ansible version is below:
>>>
>>> ansible 2.3.2.0
>>>   config file = /etc/ansible/ansible.cfg
>>>   configured module search path = Default w/o overrides
>>>   python version = 2.7.5 (default, Nov  6 2016, 00:28:07) [GCC 4.8.5
>>> 20150623 (Red Hat 4.8.5-11)]
>>>
>>> the config.yml file I am using to test is below:
>>>
>>> ---
>>>   - name: DEPLOY SNMP CONFIGURATIONS
>>>     hosts: mgmt
>>>     gather_facts: False
>>>     connection: local
>>>     vars_files:
>>>     - creds.yml
>>>
>>>     tasks:
>>>
>>>       -name: configure provider
>>>        set_fact:
>>>          provider:
>>>            username: "{{username}}"
>>>            password: "{{password}}"
>>>            host: "{{inventory_hostname}}"
>>>
>>>       - name: DEPLOY SNMP COMMANDS WITHIN PB
>>>         ios_config:
>>>           commands:
>>>             - snmp-server community Test1ng rw
>>>
>>> The content of creds.yml file is below:
>>>
>>> username: xxxxx
>>> password: xxxxx
>>>
>>> grep inventory ansible.cfg
>>> inventory      = /etc/ansible/inventory
>>>
>>> The content of the inventory file is below
>>> [mgmt]
>>> sltnrmgmt
>>>
>>> Error message I am noticing:
>>>
>>> ansible-playbook -vvvv configs.yml
>>> Using /etc/ansible/ansible.cfg as config file
>>> ERROR! Syntax Error while loading YAML.
>>>
>>>
>>> The error appears to have been in '/etc/ansible/configs.yml': line 12,
>>> column 16, but may
>>> be elsewhere in the file depending on the exact syntax problem.
>>>
>>> The offending line appears to be:
>>>
>>>       -name: configure provider
>>>        set_fact:
>>>                ^ here
>>>
>>> *The set_fact seems to be defined the way it should be.  Appreciate any
>>> help on this.*
>>>
>>> Other details I am yet to figure out:
>>>
>>> How does Ansible communicate with Network devices by default in version
>>> 2.3?  Do I need to setup any SSH keys on the Cisco Network device?
>>>
>>> --
>>> 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 post to this group, send email to [email protected].
>>
>>
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/a58e6bb6-4e54-4c3c-94cd-faabddad33d2%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/a58e6bb6-4e54-4c3c-94cd-faabddad33d2%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/cc741e12-b495-4ec2-87e3-cff3d63302e8%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/cc741e12-b495-4ec2-87e3-cff3d63302e8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEaZiRXYvOSU7JMtvp%3Dd2qxHdRqDoC%2BSnQh_GzihCx39k%3Dv%3DtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to