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.
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.
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 |
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.
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:
export MIST_API_TOKEN='YOUR_PRIVATE_KEY_HERE'
you can also use
MIST_API_KEY
, if you prefer
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
Want to contribute? Great!
Submit a PR and let's work on this together :D