Giter Club home page Giter Club logo

ansible_modules's Introduction

Build Status Code style: black

Netbox modules for Ansible using Ansible Collections

Requirements

  • Netbox 2.5+
  • pynetbox 4.0.6+
  • Python 3.6+
  • Ansible 2.9+

Existing Modules

  • netbox_aggregate
  • netbox_circuit
  • netbox_circuit_termination
  • netbox_circuit_type
  • netbox_cluster
  • netbox_cluster_group
  • netbox_cluster_type
  • netbox_device_bay
  • netbox_device_interface
  • netbox_device_role
  • netbox_device_type
  • netbox_device
  • netbox_inventory_item
  • netbox_ip_address
  • netbox_ipam_role
  • netbox_manufacturer
  • netbox_platform
  • netbox_prefix
  • netbox_provider
  • netbox_rack_group
  • netbox_rack_role
  • netbox_rack
  • netbox_region
  • netbox_rir
  • netbox_site
  • netbox_tenant_group
  • netbox_tenant
  • netbox_virtual_machine
  • netbox_vm_interface
  • netbox_vlan_group
  • netbox_vlan
  • netbox_vrf

Netbox Plugins

  • netbox lookup plugin

How to Use

  • Install via Galaxy
    • ansible-galaxy collection install netbox_community.ansible_modules
  • Install via source
    • git clone [email protected]:netbox-community/ansible_modules.git
    • cd ansible_modules
    • ansible-galaxy collection build .
    • ansible-galaxy collection install netbox_community-ansible_modules-X.X.X.tar.gz
      • Can add -p to provide a different path other than the default path, but it must be within your ansible.cfg or provided via an environment variable.

Example playbooks

Using the collections at the play level

- name: "Test Netbox modules"
  connection: local
  hosts: localhost
  gather_facts: False
  collections:
    - netbox_community.ansible_modules

  tasks:
    - name: Create device within Netbox with only required information
      netbox_device:
        netbox_url: http://netbox-demo.org:32768
        netbox_token: 0123456789abcdef0123456789abcdef01234567
        data:
          name: Test66
          device_type: Cisco Test
          device_role: Core Switch
          site: Test Site
          status: Staged
          state: present

Using the collections at the task level

- name: "Test Netbox modules"
  connection: local
  hosts: localhost
  gather_facts: False

  tasks:
    - name: Create device within Netbox with only required information
      netbox_community.ansible_modules.netbox_device:
        netbox_url: http://netbox-demo.org:32768
        netbox_token: 0123456789abcdef0123456789abcdef01234567
        data:
          name: Test66
          device_type: Cisco Test
          device_role: Core Switch
          site: Test Site
          status: Staged
          state: present

Using the collections in a role's task files

---
- name: Create device within Netbox with only required information
  netbox_community.ansible_modules.netbox_device:
    netbox_url: http://netbox-demo.org:32768
    netbox_token: 0123456789abcdef0123456789abcdef01234567
    data:
      name: Test66
      device_type: Cisco Test
      device_role: Core Switch
      site: Test Site
      status: Staged
      state: present

OR

---
- name: Create device within Netbox with only required information
  collections:
    - netbox_community.ansible_modules:
  netbox_device:
    netbox_url: http://netbox-demo.org:32768
    netbox_token: 0123456789abcdef0123456789abcdef01234567
    data:
      name: Test66
      device_type: Cisco Test
      device_role: Core Switch
      site: Test Site
      status: Staged
      state: present

Using the collections lookup plugin at the task level

- name: "TEST NETBOX_LOOKUP"
  connection: local
  hosts: localhost
  gather_facts: False

  tasks:
    - name: "NETBOX_LOOKUP 1: Lookup returns exactly two sites"
      assert:
        that: "{{ query_result|count }} == 3"
      vars:
        query_result: "{{ query('netbox_community.ansible_modules.netbox', 'sites', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}"

How to Contribute

Please read Contributing

ansible_modules's People

Contributors

cpmills1975 avatar fragmentedpacket avatar loganbest avatar thomasadavis avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.