Package: nautobot-chatops-ansible
nautobot-plugin-chatops-ansibleA plugin forNautobotChatops PluginBuild StatusBranchStatusmaindevelopSummaryChatbot that allows users to communicate directly with Ansible AWX/Tower from various chat platforms.The Nautobot Chatops Ansible plugin extends the capabilities of the Nautobot Chatops plugin to include a new command available to the plugin. This is done by registering to the Python entry point in Nautobot Plugin Chatops, that provides functionality to the code written to interact with Ansible. This plugin introduces the following sub commands to theansiblecommand:get_dashboardget_inventoryget_projectsget_job_templatesrun_job_templateget_jobsGet DashboardThe dashboard command provides an Ansible Tower/AWX status dashboard. This gives a summary of:How many hosts are on the Tower systemHow many failed hosts (last job is failed)Total number of inventoriesHow many inventories have failedHow many project sync failures have occurredGet InventoryThe inventory sub-command provides inventories available and the details of those inventories.Get ProjectsGet projects will gather information about the projects available within the Ansible Tower/AWX instance. Information such as the name, description, SCM URL, and SCM branch are provided.Get Job TemplatesThis gathers the information about the defined job templates on the Ansible Tower/AWX instance. It will provide the name, description, project, and the associated inventory with the Job Template configured.Run Job TemplateThe natural progression of gathering job templates is then to execute a particular job template. Executes a Job Template that does not require extra vars or surveys to be completed. The Job ID for the executed job template will be provided via a chat response.Get JobsThe get jobs sub command will ask Tower for the last number of jobs, with a default count of the last 10 jobs. This will give the status of the jobs including:Job IDName of the JobUser that launched the jobCreatedFinish timeStatus of the jobInstallationThe plugin is available as a Python package in PyPI and can be installed with pippipinstallgit+https://github.com/nautobot/nautobot-plugin-chatops-ansible.gitThis ChatOps Plugin to Nautobot ChatOps Plugin requires the following list of environment variables to be added into the environment.NAUTOBOT_TOWER_URI: Ansible Tower HTTP URINAUTOBOT_TOWER_USERNAME: Ansible Tower usernameNAUTOBOT_TOWER_PASSWORD: Ansible Tower passwordOnce you have updated your environment file, restart both nautobot and nautobot-worker$ sudo systemctl restart nautobot nautobot-workerUsageCommand setupAdd a slash command to Slack called/ansible.
See thenautobot-chatops installation guidefor instructions on adding a slash command to your Slack channel.You may need to adjust yourAccess Grants in Nautobotdepending on your security requirements.ContributingPull requests are welcomed and automatically built and tested against multiple version of Python and multiple version of Nautobot through TravisCI.The project is packaged with a light development environment based ondocker-composeto help with the local development of the project and to run the tests within TravisCI.The project is following Network to Code software development guideline and is leveraging:Black, Pylint, Bandit and pydocstyle for Python linting and formatting.Django unit test to ensure the plugin is working properly.CLI Helper CommandsThe project is coming with a CLI helper based oninvoketo help setup the development environment. The commands are listed below in 3 categoriesdev environment,utilityandtesting.Each command can be executed withinvoke <command>. All commands support the arguments--nautobot-verand--python-verif you want to manually define the version of Python and Nautobot to use. Each command also has its own helpinvoke <command> --helpLocal dev environmentbuild            Build all docker images.
  debug            Start Nautobot and its dependencies in debug mode.
  destroy          Destroy all containers and volumes.
  start            Start Nautobot and its dependencies in detached mode.
  stop             Stop Nautobot and its dependencies.Utilitycli              Launch a bash shell inside the running Nautobot container.
  create-user      Create a new user in django (default: admin), will prompt for password.
  makemigrations   Run Make Migration in Django.
  nbshell          Launch a nbshell session.Testingtests            Run all tests.
  pydocstyle       Run pydocstyle to validate docstring formatting adheres to NTC defined standards.
  bandit           Run bandit to validate basic static code security analysis.
  black            Run black to check that Python files adhere to its style standards.
  unittest         Run Django unit tests for the plugin.QuestionsFor any questions or comments, feel free to swing by theNetwork to Code slack channel(channel #networktocode).
Sign uphere