diff --git a/README.md b/README.md index 14e19ce..80e6c53 100644 --- a/README.md +++ b/README.md @@ -1,56 +1,56 @@ -# NITA Ansible 22.8-2 +[branch]: https://github.com/Juniper/nita/tree/23.12 +[readme]: https://github.com/Juniper/nita/blob/23.12/README.md +[create_ansible_job_k8s]: https://github.com/Juniper/nita-jenkins/blob/23.12/create_ansible_job_k8s.py -Welcome to NITA 22.8-2. This is an update release that includes scripts for building ansible execution environment for use with AWX. The execution environment is based on the nita-ansible docker build. Also included is a script to install AWX. See the individual readme files under the ansible-ee and awx folders for more information. +# NITA Ansible 23.12 -This branch also contains patches from other branches or minor modifications as required to support the stability and usability of the release. -There are also some backwards compatibility packages here for ansible and robot that allow projects written for NITA 3.0.7 to work without having to make any changes. +Welcome to NITA, an open source platform for automating the building and testing of complex networks. -Note that NITA 22.8-2 should be backward compatible with NITA 22.8 and 21.7 projects, provided the correct ansible and robot containers are installed. However, see the note below about ansible 2.10 changes. +# Release Notes +The major change in this version is that all components now run within pods under the control of Kubernetes, rather than as Docker containers. Consequently we have updated the way that Ansible runs because it is now controlled by Kubernetes instead of Docker. -# Copyright +Please refer to the [README][readme] for more details. -Copyright 2023, Juniper Networks, Inc. +# Installing -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The simplest way to install nita-ansible is by installing the nita repositories, which can be done by running the ``install.sh`` script located and in the parent [nita repo][branch] as described [here][readme]. You can also install nita-ansible as a standalone Docker container, which can run independently of the NITA containers that are running under Kubernetes. -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +## Accessing the nita-ansible container -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +Note that the nita-ansible container is ephemeral, i.e. it is started and stopped by Jenkins when it is needed for a job. However, you can start an instance of a new Ansible container and access it via the shell simply be running the following command: + +``` +user@host$ nita-cmd ansible cli +If you don't see a command prompt, try pressing enter. +nita-ansible:~# exit +exit +pod "nita-ansible" deleted +user@host$ +``` -# Stable releases +:warning: Unlike docker, many of the arguments needed by kubectl are defined in YAML files rather than being passed on the command line. For example, if you wish to mount a volume in a container from the host, you will need to define it in a YAML file. We use a python script ``create_ansible_job_k8s.py`` ([see link][create_ansible_job_k8s]) to create the required job_yaml, and you can use this as an example if you want to create your own ansible containers. -The idea here is to provide multiple NITA based projects with a firm foundation that they can use to focus on solving customer problems rather than continually tweaking the underlying software. +If you want to run a standalone Ansible container with your own playbooks and/or roles, we recommend doing so as a Docker container, described below. -It allows NITA projects to declare exactly which version of NITA they are compatible with. +# Running a Standalone Ansible Docker Container -Projects must explicitly use the versions of the containers provided by this package in order to avoid docker attempting to download from the registry. -No containers tagged as "latest" are provided by the package. +We provide the ability for you to run Ansible as a standalone Docker container, without having to use the other parts of NITA that are controlled by Kubernetes, such as Jenkins, Robot Framework or the Webapp. This is very handy if you want to be able to quickly just run an instance of Ansible with your own playbooks or roles, as is explained below. -## Ansible 2.10 and greater +## Ansible Versions: 2.10 and greater -Starting with Ansible 2.10, juniper.device and junipernetworks.junos ansible collections are added. This collection has been included in the requirements.yml file and will be built-in the container automatically. Existing juniper.junos role is still supported and works with Ansible 2.10. For more information on this transition see https://www.juniper.net/documentation/us/en/software/junos-ansible/ansible/topics/concept/junos-ansible-modules-overview.html and https://galaxy.ansible.com/juniper/device. Juniper.junos roles has been removed and superceded by the newer collections. If the old roles are still required, simply uncomment the line from the ``Dockerfile``: +Starting with Ansible 2.10, juniper.device and junipernetworks.junos ansible collections are available. This collection has been included in the requirements.yml file and will be built into the NITA container automatically. The existing juniper.junos role is still supported and works with Ansible 2.10. For more information on this transition see https://www.juniper.net/documentation/us/en/software/junos-ansible/ansible/topics/concept/junos-ansible-modules-overview.html and https://galaxy.ansible.com/juniper/device. Juniper.junos roles has been removed and are superceded by the newer collections. If the old roles are still required, simply uncomment the line from the standalone ``Dockerfile``: ``` RUN ansible-galaxy install Juniper.junos -p /etc/ansible/roles/ ``` -The network-roles the container copies over to support the NITA Project have been updated to remove the dependencies on the old roles and will use the collections. - -# Installing - -## Dependencies - -NITA depends on docker-ce and docker-compose. +The network-roles that the Docker container copies over have been updated to remove the dependencies on the old roles and will use the collections. -* For the **docker-ce** installation the instructions found here: https://docs.docker.com/engine/install/ -* It is recommended to follow this steps after installing docker-ce: https://docs.docker.com/engine/install/linux-postinstall/ -* To install **docker-compose** follow the instructions found here: https://docs.docker.com/compose/install/ +## Using Standalone nita-ansible -# Using nita-ansible +This Docker container holds Ansible executables, related libraries, and files for managing Juniper devices using Ansible. The NITA framework uses the nita-ansible container to run ansible playbooks included with the framework. Nita-ansible can also be used as a standalone container for executing your own playbooks. Simply put your inventory file and playbooks into a new project folder on the system hosting the Docker container. You will also want to put a bash script to execute the ```ansible-playbook``` command. -This container holds Ansible executables, related libraries, and files for managing Juniper devices using Ansible. The NITA framework uses the nita-ansible container to run ansible playbooks included with the framework. Nita-ansible can also be used as a standalone container for executing your own playbooks. Simply put your inventory file and playbooks into a project folder on the system hosting the container. You will also want to put a bash script to execute the ```ansible-playbook``` command. - -### Simple Project Folder Example +### A Simple Project Folder Example A simple project folder with a single playbook may look like this: @@ -66,24 +66,20 @@ The ```runme.sh``` should execute the playbook pointing to the hosts file as fol #!/bin/bash ansible-playbook -i hosts playbook.yml ``` +### Using Standalone nita-ansible with your project folder -### Using nita-ansible with your project folder - -To use the nita-ansible container with your project folder, simply use the ```docker run``` command, mounting your project folder onto the container and passing the command to run your script like the example below: +To use the standalone nita-ansible Docker container with your project folder, simply use the ```docker run``` command, mounting your project folder onto the Docker container and passing the command to run your script like the example below: ``` docker run -u root -v /project_folder:/container_folder:rw --rm -it --name ansible juniper/nita-ansible: /bin/bash -c "cd /container_folder; ./runme.sh" ``` - ### Troubleshooting playbooks -You can execute the playbook into a bash shell and troubleshoot from the project folder mounted inside the container if your playbooks are not operating correctly by issuing the ```docker run``` command above with just the bash shell (remove everything after ```/bin/bash```). +You can execute the playbook into a bash shell and troubleshoot from the project folder mounted inside the Docker container if your playbooks are not operating correctly by issuing the ```docker run``` command above with just the bash shell (remove everything after ```/bin/bash```). -# Roles +## Built-in Ansible roles -## Built-in roles - -This container contains many built-in roles for building Juniper configuration files related to an EVPN VXLAN IP fabric. An example of a project using these roles can be found at https://github.com/Juniper/nita-webapp/tree/main/examples/evpn_vxlan_erb_dc. When invoking the container to use these roles an additional output directory needs to be mounted for the configuration files to be built and stored in the /container_build_folder (the example uses /var/tmp/build) folder as follows: +Standalone nita-ansible contains many built-in roles for building Juniper configuration files related to an EVPN VXLAN IP fabric. An example of a project using these roles can be found at https://github.com/Juniper/nita-webapp/tree/main/examples/evpn_vxlan_erb_dc. When invoking the Docker container to use these roles an additional output directory needs to be mounted for the configuration files to be built and stored in the /container_build_folder (the example uses /var/tmp/build) folder as follows: ``` docker run -u root -v /project_folder:/container_folder:rw -v /local_output_folder:/container_build_folder --rm -it --name ansible juniper/nita-ansible: /bin/bash -c "cd /container_folder; ./runme.sh" @@ -96,7 +92,7 @@ ansible-playbook -i hosts playbook.yaml --extra-vars "build_dir=container_build_ ``` ### ebgp_ip_fabric -Builds the configuration stanzas that make up a Junos eBGP IP fabric underlay. It includes configurations for forwarding, routing, and policy options as well as interfaces participating in the fabric and BGP protocol configuration. In the sample Excel file included with the NITA package for EVPN data center mentioned above, the tabs that hold the variable information include "underlay_ebgp+", "core_interfaces+", "underlay_ebgp+" +Builds the configuration stanzas that make up a Junos eBGP IP fabric underlay. It includes configurations for forwarding, routing, and policy options as well as interfaces participating in the fabric and BGP protocol configuration. In the sample Excel file included with the NITA package for EVPN data center, the tabs that hold the variable information include "underlay_ebgp+", "core_interfaces+", "underlay_ebgp+" Invoking this role from ansible playbook can be accomplished as follows: ``` @@ -121,7 +117,7 @@ Included in the evpn_vxlan_common role is junos_commit_config role which ### evpn_vxlan_dci -Builds the configuration stanzas that make up a eBGP routing for DCI connectivity. In the sample Excel file included with the NITA package for EVPN data center mentioned above, the tab that holds the variable is "dci_ebgp+". Invoking this role from an ansible playbook can be accomplished as follows: +Builds the configuration stanzas that make up a eBGP routing for DCI connectivity. In the sample Excel file included with the NITA package for EVPN data center, the tab that holds the variable is "dci_ebgp+". Invoking this role from an ansible playbook can be accomplished as follows: ``` - hosts: leaves @@ -133,7 +129,7 @@ Builds the configuration stanzas that make up a eBGP routing for DCI connectivit ### evpn_vxlan_erb_leaf Builds the configuration stanzas that make up iBGP EVPN overlay configuration for leafs in spine/leaf IP fabric. Also includes configuration for related switch-options stanza in Junos (vtep source interface, route-distinguisher, vrf-target). -In the sample Excel file included with the NITA package for EVPN data center mentioned above, the tabs that hold the variable information include "evpn_ibgp+" and "base". Invoking this role from an ansible playbook can be accomplished as follows: +In the sample Excel file included with the NITA package for EVPN data center, the tabs that hold the variable information include "evpn_ibgp+" and "base". Invoking this role from an ansible playbook can be accomplished as follows: ``` - hosts: leaves @@ -145,7 +141,7 @@ In the sample Excel file included with the NITA package for EVPN data center men ### evpn_vxlan_erb_spine Builds the configuration stanzas that make up iBGP EVPN overlay "lean" spines as iBGP route-reflectors for family evpn signaling. Of particular interest the configuration implicitly allows all neighbors from the defined loopback_subnet. This means all the leafs will initiate the BGP connection. -In the sample Excel file included with the NITA package for EVPN data center mentioned above, the tabs that hold the variable information include "evpn_ibgp+" and "base". Invoking this role from an ansible playbook can be accomplished as follows: +In the sample Excel file included with the NITA package for EVPN data center, the tabs that hold the variable information include "evpn_ibgp+" and "base". Invoking this role from an ansible playbook can be accomplished as follows: ``` - hosts: spines @@ -156,7 +152,7 @@ In the sample Excel file included with the NITA package for EVPN data center men ### evpn_vxlan_port -Builds the configuration stanzas that make up L2 port information for devices connected to leafs in an EVPN VXLAN IP Fabric. Configures ports, ESIs, VLANs, LAGs, and IP addresses. In the sample Excel file included with the NITA package for EVPN data center mentioned above, the tabs that hold the variable information include "evpn_port+" and "base". Invoking this role from an ansible playbook can be accomplished as follows: +Builds the configuration stanzas that make up L2 port information for devices connected to leafs in an EVPN VXLAN IP Fabric. Configures ports, ESIs, VLANs, LAGs, and IP addresses. In the sample Excel file included with the NITA package for EVPN data center, the tabs that hold the variable information include "evpn_port+" and "base". Invoking this role from an ansible playbook can be accomplished as follows: ``` - hosts: leaves @@ -168,7 +164,7 @@ Builds the configuration stanzas that make up L2 port information for devices co ### evpn_vxlan_vni Builds the configuration stanzas that make up VNI information for EVPN VXLAN configuration. -In the sample Excel file included with the NITA package for EVPN data center mentioned above, the tabs that hold the variable information include "vnis+". Invoking this role from an ansible playbook can be accomplished as follows: +In the sample Excel file included with the NITA package for EVPN data center, the tabs that hold the variable information include "vnis+". Invoking this role from an ansible playbook can be accomplished as follows: ``` - hosts: leaves @@ -179,7 +175,7 @@ In the sample Excel file included with the NITA package for EVPN data center men ### evpn_vxlan_vrf -Builds the configuration stanzas that make up VRF for EVPN VXLAN configuration. In the sample Excel file included with the NITA package for EVPN data center mentioned above, the tabs that hold the variable information include "vrfs+" (and indirectly "vnis+". The example datacenter uses route-targets and does not create unique policies for each VRF. Invoking this role from an ansible playbook can be accomplished as follows: +Builds the configuration stanzas that make up VRF for EVPN VXLAN configuration. In the sample Excel file included with the NITA package for EVPN data center, the tabs that hold the variable information include "vrfs+" (and indirectly "vnis+". The example datacenter uses route-targets and does not create unique policies for each VRF. Invoking this role from an ansible playbook can be accomplished as follows: ``` - hosts: leaves @@ -202,7 +198,7 @@ Builds the configuration stanzas that make that includes configuration stanzas c ### junos_qfx_common -This includes the configuration templates for the base Junos config portion of a QFX switch. In the sample Excel file included with the NITA package for EVPN data center mentioned above, the tabs that hold the variable information related to this role include "base" and "password_hashes". +This includes the configuration templates for the base Junos config portion of a QFX switch. In the sample Excel file included with the NITA package for EVPN data center, the tabs that hold the variable information related to this role include "base" and "password_hashes". Invoking this role from ansible playbook can be accomplished as follows: @@ -215,7 +211,7 @@ Invoking this role from ansible playbook can be accomplished as follows: ### srx_common and srx_firewall -This includes the configuration templates for the base Junos config portion of an switch. In the sample Excel file included with the NITA package for EVPN data center mentioned above, the tabs that hold the variable information related to this role include "base", "password_hashes", "vrfs+", and "firewall_port+". +This includes the configuration templates for the base Junos config portion of an switch. In the sample Excel file included with the NITA package for EVPN data center, the tabs that hold the variable information related to this role include "base", "password_hashes", "vrfs+", and "firewall_port+". Invoking this role from ansible playbook can be accomplished as follows: @@ -241,10 +237,9 @@ Once the device configuration files have been built and stored in the build fold - { role: junos_commit_config } ``` - ## Additional roles -If you need additional roles for your playbooks, create a folder in project directory called ```roles``` and copy the appropriate files from your local ansible installation's role folder. Ansible will look in ```/container_folder/roles``` for any roles that are not already installed in the container itself. +If you need additional roles for your playbooks, create a folder in project directory called ```roles``` and copy the appropriate files from your local ansible installation's role folder. Ansible will look in ```/container_folder/roles``` for any roles that are not already installed in the Docker container itself. ## mx_common @@ -252,11 +247,16 @@ This role is not actually included in the default container build but is an exam This role contains junos configuration statements for the MX router in the WAN role in the NITA example project. -# Examples +## Examples -More complex examples of project folders can be found in the larger NITA project itself, particularly at https://github.com/Juniper/nita-webapp/tree/main/examples +More complex examples of project folders can be found in the larger NITA project itself, particularly at https://github.com/Juniper/nita/tree/main/examples. +# Copyright -# Misc +Copyright 2024, Juniper Networks, Inc. -For more information on NITA releases refer to the [README.md](https://github.com/Juniper/nita-webapp/blob/22.8/README.md) for the NITA Webapp. +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/VERSION.txt b/VERSION.txt index 8dc248c..dbc391f 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -22.8 +23.12