networktocode.nautobot.nautobot_server module – Manages Nautobot Server application.¶
Note
This module is part of the networktocode.nautobot collection (version 3.4.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install networktocode.nautobot
.
To use it in a playbook, specify: networktocode.nautobot.nautobot_server
.
New in version 3.0.0: of networktocode.nautobot
Synopsis¶
Manages Nautobot Server using the
nautobot-server
application frontend todjango-admin
. With thevirtualenv
parameterall management commands will be executed by the given
virtualenv
installation.
Requirements¶
The below requirements are needed on the host that executes this module.
nautobot
Parameters¶
Parameter |
Comments |
---|---|
|
|
|
|
Database password used in Nautobot. |
|
Database username used in Nautobot. |
|
A list of flags to append to the command that is passed to |
|
A list of additional arguments to append to the end of the command that is passed to These are appended to the end of the command, so that [“arg1”, “arg2”] is translated to “arg1 arg2”. |
|
The path to the root of the Nautobot application where nautobot-server lives. Default: “/opt/nautobot” |
|
A directory to add to the Python path. Typically used to include the settings module if it is located external to the application directory. |
|
The Python path to the application’s settings module, such as ‘myapp.settings’. |
|
An optional path to a virtualenv installation to use while running the nautobot-server application. |
Notes¶
Note
Inspired from Django_manage (https://github.com/ansible-collections/community.general/blob/main/plugins/modules/web_infrastructure/django_manage.py).
To be able to use the
collectstatic
command, you must have enabled staticfiles in your nautbot_config.py.Your
nautobot-server
application must be executable (rwxr-xr-x), and must have a valid shebang.
Examples¶
- name: Createsuperuser
networktocode.nautobot.nautobot_server:
command: "createsuperuser"
args:
email: "admin93@example.com"
username: "superadmin7"
db_password: "{{ db_password }}"
- name: Collectstatic
networktocode.nautobot.nautobot_server:
command: "collectstatic"
db_password: "{{ db_password }}"
- name: Post Upgrade
networktocode.nautobot.nautobot_server:
command: "post_upgrade"
- name: Make Migrations for Plugin
networktocode.nautobot.nautobot_server:
command: "makemigrations"
positional_args: ["my_plugin_name"]
db_password: "{{ db_password }}"
- name: Migrate Plugin
networktocode.nautobot.nautobot_server:
command: "migrate"
args:
verbosity: 3
flags: ["merge"]
positional_args: ["my_plugin_name"]
db_username: "{{ db_username }}"
db_password: "{{ db_password }}"
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Boolean that is true if the command changed the state. Returned: always Sample: true |
|
Full command executed in the Server. Returned: always Sample: “nautobot-server createsuperuser –noinput –email=admin33@example.com –username=superadmin” |
|
Raw output from the command execution. Returned: always Sample: “superadmin user already exists.” |
|
The path to the root of the Nautobot application where nautobot-server lives. Returned: always Sample: “/opt/nautobot” |