GithubHelp home page GithubHelp logo

jangliss / mist-ansible-collection Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jsnyder-juniper/mist-ansible-collection

0.0 1.0 0.0 149 KB

Ansible Collection for Juniper's Mist products

License: GNU General Public License v2.0

Python 100.00%

mist-ansible-collection's Introduction

Juniper Mist Ansible Modules

N|Solid

Build Status

Overview

The goal of this collection is to provide an easier way to interact with Juniper Mist. While nothing will stop you from using the built-in module, you may find that working with pre-packaged modules can help simplify the development of your playbook, or it may just be easier to support as a team.

๐Ÿ“‹ Ansible version compatibility

There are significant changes to Ansible within version 2.10.x, and while those changes get worked out we will continue to test for Ansible 2.9.x.

It is very likely that something will break on Ansible 2.10.x versions as of this pre-release version of the project.

โš™๏ธ Batteries Included

Here is a short list of modules included within the collection, expect feature parity with the official Postman collection before this project hits version 0.1.0

Name Description
cremsburg.mist.mist_site Manage the lifecycle of a site
cremsburg.mist.mist_site_groups Manage the Site Groups of your organization
cremsburg.mist.mist_wlan Manage the lifecycle of a WLAN
cremsburg.mist.mist_wired Manage the configuration of an EX switch

๐Ÿš€ Executing the playbook

After installing the collections, you can call the modules by using their full name path.

test.yaml

---
- hosts: localhost

  ### ####################################################
  ### # make sure you created environmentals on the
  ### #   ansible host that store your sensative info
  ### #   in this case, i am using the following
  ### #     - MIST_API_TOKEN
  ### #     - MIST_ORG_ID
  ### #   this prevents me from needing to declare a value
  ### #   for 'api_token' and 'org_id' in this module
  ### ####################################################
  tasks:
    - name: create a site
      cremsburg.mist.mist_site:
        name: katy
        address: 5000 Katy Mills Cir, Katy, TX 77494, USA
        country_code: test_project
        latlng: 
          lat: 29.7785301
          lng: -95.8154901
        notes: this is a test
        state: present

Then simply run your playbook

ansible-playbook test.yaml

If you used Ansible Vault to encrypt your secrets, you need to append the --ask-vault-pass to your command.

โš ๏ธ Very Important! โš ๏ธ

Please make sure to manage your sensative information carfully. While the modules support the parameter of api_key, this should never be statically entered with your token in clear text.

Here are better alternatives:

Manage your API token as an environmental

export MIST_API_TOKEN='YOUR_PRIVATE_KEY_HERE'

you can also use MIST_API_KEY, if you prefer

Manage your API token as a secret with Ansible Vault

create a file to store your API token in

$ vim vault.yaml

api_token: "MY_MIST_API_TOKEN_HERE"

encrypt the new file

ansible-vault encrypt vault.yml

update your playbook to look for variables within this new, encrypted file

---
- hosts: localhost
  vars_files:
    - vault.yml
  tasks:
    - name: create a site
      cremsburg.mist.mist_site:
        name: katy
        address: 5000 Katy Mills Cir, Katy, TX 77494, USA
        country_code: test_project
        latlng: 
          lat: 29.7785301
          lng: -95.8154901
        notes: this is a test
        api_token: "{{ api_token }}"
        state: present

and now you'll need to pass your vault password when using the playbook

ansible-playbook --ask-vault-pass test.yaml

Development

Want to contribute? Great!

Submit a PR and let's work on this together :D

mist-ansible-collection's People

Contributors

cdot65 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.