networktocode.nautobot.nautobot_server (5.1.1) — module

Manages Nautobot Server application.

| "added in version" 3.0.0 of networktocode.nautobot"

Authors: Network to Code (@networktocode)

Install collection

Install with ansible-galaxy collection install networktocode.nautobot:==5.1.1


Add to requirements.yml

  collections:
    - name: networktocode.nautobot
      version: 5.1.1

Description

Manages Nautobot Server using the C(nautobot-server) application frontend to C(django-admin). With the C(virtualenv) parameter

all management commands will be executed by the given C(virtualenv) installation.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Createsuperuser
    networktocode.nautobot.nautobot_server:
      command: "createsuperuser"
      args:
        email: "admin93@example.com"
        username: "superadmin7"
      db_password: "{{ db_password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Collectstatic
    networktocode.nautobot.nautobot_server:
      command: "collectstatic"
      db_password: "{{ db_password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Post Upgrade
    networktocode.nautobot.nautobot_server:
      command: "post_upgrade"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Make Migrations for Plugin
    networktocode.nautobot.nautobot_server:
      command: "makemigrations"
      positional_args: ["my_plugin_name"]
      db_password: "{{ db_password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - 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 }}"

Inputs

    
args:
    default: {}
    description:
    - 'A dictionary of the optional arguments and their values used together with the
      command.

      This translates {"name_arg": "value_arg"} to "--name_arg value_arg".

      '
    required: false
    type: dict

flags:
    default: []
    description:
    - A list of flags to append to the command that is passed to C(nautobot-server), so
      that ["flag1", "flag2"] is translated to "--flag1 --flag2".
    elements: str
    required: false
    type: list

command:
    description:
    - 'The name of the Nautobot management command to run. Some command fully implemented
      are: C(createsuperuser),

      C(migrate), C(makemigrations), C(post_upgrade) and C(collectstatic).

      Other commands can be entered, but will fail if they''re unknown to Nautobot or
      use positional arguments.

      The module will perform some basic parameter validation, when applicable, to the
      commands.

      '
    required: true
    type: str

settings:
    description:
    - The Python path to the application's settings module, such as 'myapp.settings'.
    required: false
    type: path

pythonpath:
    aliases:
    - python_path
    description:
    - A directory to add to the Python path. Typically used to include the settings module
      if it is located external to the application directory.
    required: false
    type: path

virtualenv:
    aliases:
    - virtual_env
    description:
    - An optional path to a I(virtualenv) installation to use while running the nautobot-server
      application.
    required: false
    type: path

db_password:
    description:
    - Database password used in Nautobot.
    required: false
    type: str

db_username:
    description:
    - Database username used in Nautobot.
    required: false
    type: str

project_path:
    aliases:
    - app_path
    - chdir
    default: /opt/nautobot
    description:
    - The path to the root of the Nautobot application where B(nautobot-server) lives.
    required: false
    type: path

positional_args:
    default: []
    description:
    - A list of additional arguments to append to the end of the command that is passed
      to C(nautobot-server).
    - These are appended to the end of the command, so that ["arg1", "arg2"] is translated
      to "arg1 arg2".
    elements: str
    required: false
    type: list

Outputs

changed:
  description: Boolean that is true if the command changed the state.
  returned: always
  sample: true
  type: bool
cmd:
  description: Full command executed in the Server.
  returned: always
  sample: nautobot-server createsuperuser --noinput --email=admin33@example.com --username=superadmin
  type: str
out:
  description: Raw output from the command execution.
  returned: always
  sample: superadmin user already exists.
  type: str
project_path:
  description: The path to the root of the Nautobot application where B(nautobot-server)
    lives.
  returned: always
  sample: /opt/nautobot
  type: str