Note
This plugin is part of the community.general collection.
To install it use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.django_manage
.
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments |
---|---|---|
app_path string / required | The path to the root of the Django application where manage.py lives. | |
apps string | A list of space-delimited apps to target. Used by the 'test' command. | |
cache_table string | The name of the table used for database-backed caching. Used by the 'createcachetable' command. | |
clear boolean |
| Clear the existing files before trying to copy or link the original file. Used only with the 'collectstatic' command. The --noinput argument will be added automatically. |
command string / required |
| The name of the Django management command to run. Built in commands are cleanup, collectstatic, flush, loaddata, migrate, runfcgi, syncdb, test, and validate. Other commands can be entered, but will fail if they're unknown to Django. Other commands that may prompt for user input should be run with the --noinput flag. |
database string | The database to target. Used by the 'createcachetable', 'flush', 'loaddata', and 'syncdb' commands. | |
failfast boolean |
| Fail the command immediately if a test fails. Used by the 'test' command. |
fixtures string | A space-delimited list of fixture file names to load in the database. Required by the 'loaddata' command. | |
link boolean |
| Will create links to the files instead of copying them, you can only use this parameter with 'collectstatic' command |
merge boolean |
| Will run out-of-order or missing migrations as they are not rollback migrations, you can only use this parameter with 'migrate' command |
pythonpath string | A directory to add to the Python path. Typically used to include the settings module if it is located external to the application directory. | |
settings string | The Python path to the application's settings module, such as 'myapp.settings'. | |
skip boolean |
| Will skip over out-of-order missing migrations, you can only use this parameter with migrate
|
virtualenv string | An optional path to a virtualenv installation to use while running the manage application. aliases: virtualenv |
Note
- name: Run cleanup on the application installed in django_dir community.general.django_manage: command: cleanup app_path: "{{ django_dir }}" - name: Load the initial_data fixture into the application community.general.django_manage: command: loaddata app_path: "{{ django_dir }}" fixtures: "{{ initial_data }}" - name: Run syncdb on the application community.general.django_manage: command: syncdb app_path: "{{ django_dir }}" settings: "{{ settings_app_name }}" pythonpath: "{{ settings_dir }}" virtualenv: "{{ virtualenv_dir }}" - name: Run the SmokeTest test case from the main app. Useful for testing deploys community.general.django_manage: command: test app_path: "{{ django_dir }}" apps: main.SmokeTest - name: Create an initial superuser community.general.django_manage: command: "createsuperuser --noinput --username=admin [email protected]" app_path: "{{ django_dir }}"
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/general/django_manage_module.html