Note
This module is part of the community.general collection (version 10.7.3).
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 community.general.
To use it in a playbook, specify: community.general.django_command.
New in community.general 9.0.0
Parameter | Comments |
|---|---|
command string / required | Django admin command. It must be a valid command accepted by |
extra_args list / elements=string | List of extra arguments passed to the django admin command. |
pythonpath path | Adds the given filesystem path to the Python import search path. The value will be passed as is to the |
settings string / required | Specifies the settings module to use. The value will be passed as is to the |
skip_checks boolean | Skips running system checks prior to running the command. Choices:
|
traceback boolean | Provides a full stack trace in the output when a Choices:
|
venv path | Use the the Python interpreter from this virtual environment. Pass the path to the root of the virtualenv, not the |
verbosity integer | Specifies the amount of notification and debug information in the output of Choices:
|
Attribute | Support | Description |
|---|---|---|
check_mode | Support: none | Can run in |
diff_mode | Support: none | Will return details on what has changed (or possibly needs changing in |
Note
django-admin command is always executed using the C locale, and the option --no-color is always passed.See also
Refer to this documentation for the builtin commands and options of django-admin. Please make sure that you select the right version of Django in the version selector on that page.
- name: Check the project
community.general.django_command:
command: check
settings: myproject.settings
- name: Check the project in specified python path, using virtual environment
community.general.django_command:
command: check
settings: fancysite.settings
pythonpath: /home/joedoe/project/fancysite
venv: /home/joedoe/project/fancysite/venv
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
run_info dictionary | Command-line execution information. Returned: success and |
version string added in community.general 10.0.0 | Version of Django. Returned: always Sample: |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/django_command_module.html