Skip to content

[Docs]: Provided examples for export_templates are for custom_link #1214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions plugins/modules/netbox_export_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,29 +75,37 @@
"""

EXAMPLES = r"""
- name: "Test NetBox custom_link module"
- name: "Test NetBox export_templates module"
connection: local
hosts: localhost
tasks:
- name: Create a custom link on device
- name: "Ensure export template for /etc/hosts entries exists"
netbox.netbox.netbox_export_template:
netbox_url: http://netbox.local
netbox_token: thisIsMyToken
data:
content_type: "dcim.device"
name: Custom Link
link_text: "Open Web Management"
link_url: !unsafe https://{{ obj.name }}.domain.local
content_types: ["dcim.device", "virtualization.virtualmachine"]
name: /etc/hosts
description: "Generate entries for /etc/hosts"
as_attachment: true
template_code: !unsafe |
{% for vm in queryset -%}
{%- if vm.primary_ip4 and vm.primary_ip6 %}
{{ vm.primary_ip4.address.ip }} {{ vm.primary_ip6.address.ip }} {{ vm }}
{%- elif vm.primary_ip4 %}
{{ vm.primary_ip4.address.ip }} {{ vm }}
{%- elif vm.primary_ip6 %}
{{ vm.primary_ip6.address.ip }} {{ vm }}
{%- endif -%}
{%- endfor %}

- name: Delete the custom link
- name: Delete the export template
netbox.netbox.netbox_export_template:
netbox_url: http://netbox.local
netbox_token: thisIsMyToken
data:
content_type: "dcim.device"
name: Custom Link
link_text: "Open Web Management"
link_url: !unsafe https://{{ obj.name }}.domain.local
content_type: "dcim.device"
name: /etc/hosts
state: absent
"""

Expand Down
Loading