community.general.django_flush module – Wrapper for django-admin flush
Note
This module is part of the community.general collection (version 14.0.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 community.general.
To use it in a playbook, specify: community.general.django_flush.
New in community.general 14.0.0
Synopsis
This module is a wrapper for the execution of
django-admin flush.It removes all data from the database, including data added during migrations.
Parameters
Parameter |
Comments |
|---|---|
Specify the database to be used. Default: |
|
Adds the given filesystem path to the Python import search path. The value is passed as is to the |
|
Specifies the settings module to use. The value is passed as is to the |
|
Skips running system checks prior to running the command. Choices:
|
|
Provides a full stack trace in the output when a Choices:
|
|
Use the Python interpreter from this virtual environment. Pass the path to the root of the virtualenv, not the |
|
Specifies the amount of notification and debug information in the output of Choices:
|
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: full |
Can run in |
|
Support: none |
Returns details on what has changed (or possibly needs changing in |
Notes
Note
The option
--noinputis always passed, sodjango-admindoes not prompt for confirmation.The module always reports a change, because it cannot tell whether the database had any data to remove. Even right after a flush, some applications (for example
django.contrib.authanddjango.contrib.contenttypes) populate their tables again.The
django-admincommand is always executed using theClocale, and the option--no-coloris always passed.
See Also
See also
- django-admin and manage.py in official Django documentation
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.
Examples
- name: Remove all data from the default database
community.general.django_flush:
settings: myproject.settings
- name: Remove all data from another database
community.general.django_flush:
database: myotherdb
settings: fancysite.settings
pythonpath: /home/joedoe/project/fancysite
venv: /home/joedoe/project/fancysite/venv
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Command-line execution information. Returned: success and |
|
Version of Django. Returned: always Sample: |