Skip to content

jsnyder-juniper/Mist-Ansible-Collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Ansible Collection for Juniper's Mist products

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages