There are three ways to run the tooling in this repo:
- Locally in the native OS
- Using a container on top of your native OS
- Using GitHub actions from a fork of the repo (covered later)
First, clone and enter the repo:
git clone https://github.com/model-driven-devops/mdd.git
cd mdd
- Environmental Variables
- Docker (if running in a docker container)
The MDD tooling requires several environment variables. The first one required for base execution is:
export ANSIBLE_PYTHON_INTERPRETER=${VIRTUAL_ENV}/bin/python
You can define this variable from the envars
file:
. ./envvars
Next, it is highly recommended that you create a virtual environment to make it easier to install the dependencies without conflict:
python3 -m venv venv-mdd
. ./venv-mdd/bin/activate
Next, install the Python requirements via pip:
pip3 install -r requirements.txt
Reactivate virtual environment to ensure your shell is using the newly installed ansible.
deactivate
. ./venv-mdd/bin/activate
The MDD tooling is distributed via an Ansible Collection. To install the tooling and it's Ansible dependencies, use ansible-galaxy:
ansible-galaxy collection install -r requirements.yml
Note: If you want to develop a collection, you need to set
ANSIBLE_COLLECTIONS_PATH
(or set in ansible.cfg) before installing the requirements above to tell Ansible to look locally for collections, comment out the collection in requirements.yml, and clone the collection repo directly, e.g.
export ANSIBLE_COLLECTIONS_PATH=./
cd ansible_collections
mkdir ciscops
cd ciscops
git clone https://github.com/model-driven-devops/ansible-mdd mdd
If you are running the tools from a CI runner like GitHib Actions, you'll need to consult that CI runner's
documentation for how to run tooling from a container. Examples of how to run the tooling from a
container in GitHib actions can be found in .github/workflows
in this repo.
*** Need to put more verbiage on running in the container (e.g. Where does it get the tooling, where does it get the data)
If you are running the tooling locally instide a container, you can use the provided shell script
play.sh
. To use it, replace ansible-playbook
with ./play.sh
as follows:
./play.sh ciscops.mdd.show --limit=hq-rtr1
Note: The same applies as above to developing running in the container.
At this point, you should be able to show the config data for the hosts in the inventory.
To show the config data for hq-rtr1
, run:
ansible-playbook ciscops.mdd.show --limit=hq-rtr1