only include configuration statements in your file (config.j2), not cli
commands.  remove the configure and commit statements

On Sun, Mar 12, 2017 at 11:39 AM, Dat Dao <[email protected]> wrote:

> Hi IAN,
>     I am a newbie in ansible sector, I wrote the playbook in which I used
> junos_template module, but when I run playbook, I got this error:
> he error is "msg": "Unable to load config: ConfigLoadError(severity:
> error, bad_element: junos.set, message: error: unknown command)" which is
> odd since using the juniper_config module with the lines: - set system
> host-name {{ inventory_hostname }} works fine.
>
> This is my jinja2 file:
>
> configure
> set system hostname DAT123
> commit
>
> and here is my playbook:
> ---
> - name: cau hinh doi hostname
>   hosts: juniper
>
>
>  tasks:
>  - name: tai config
>    junos_template:
>      src: config.j2
>      host: 100.100.100.100
>
> Please help me fix this issue.
>
>
> Vào 00:10:44 UTC+7 Thứ Sáu, ngày 13 tháng 5 năm 2016, Ian Cote đã viết:
>>
>> I've been kicking the tires on 2.1, specifically to start managing
>> network equipment.  I've had success with the junos_command and
>> junos_config modules, but cannot get the junos_template module to work for
>> even a trivial example.  I've tried the set and text formats -
>>
>> config.set:
>> set system host-name {{ inventory_hostname }}
>>
>> config.j2 (which according to the -vvv output was treated as text):
>> system {
>>     host-name {{ inventory_hostname }}
>> }
>>
>> The error is "msg": "Unable to load config: ConfigLoadError(severity:
>> error, bad_element: junos.set, message: error: unknown command)" which is
>> odd since using the juniper_config module with the lines: - set system
>> host-name {{ inventory_hostname }} works fine.
>>
>> Could someone post a (preferably text form) juniper template that they
>> have had success with?  I'm looking to merge the config here at first.
>>
>> Thanks,
>> -ian
>>
> --
> 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/c34975a6-0c04-491e-b20a-259115e73ca7%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/c34975a6-0c04-491e-b20a-259115e73ca7%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/CAEkdrMhkpFVLUbDvC8xQfZowbYVQtyMeEzpsarhBu-%2BB4FVK%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to