To use with_items, replace app1 in your command with the variable {{item}}:

- django_manage: >
    command="makemigrations --noinput {{item}}"
    app_path={{app_path}}
    settings={{django_settings}}
  with_items:
    - app1
    - app2
    - app3


The createsuperuser command doesn't support setting a password from the
command line.  I've found a simple third-party app (
https://github.com/ActiveState/django-stackato) to add a management command
for changing a user's password, so after installing it you could run
something like:

- django_manage: >
    command="createsuperuser --noinput --username=myuser --email=
myem...@xyz.com"
    app_path={{app_path}}
    settings={{django_settings}}
- django_manage: >
    command="changepassword2 myuser mypassword"
    app_path={{app_path}}
    settings={{django_settings}}

The django_manage documentation does indicate that "Other commands can be
entered, but will fail if they're unknown to Django.", but it doesn't give
an example of running one that's not in the list of built-in commands.
I've submitted a fix (
https://github.com/ansible/ansible-modules-core/pull/574).



On Thu, Dec 25, 2014 at 10:59 AM, Eric sharma <erickhushw...@gmail.com>
wrote:

> Thanks Chris
>
> Your solution for makemigrations command working perfect but I didn't find
> similar thing in docs. have I missed something?
> I've two more small queries.
> 1) how do I pass multiple app name in makemigrations command which is in a
> variable (I mean using ansible's *with_items*)
>
> - name: Django makemigrations
>   django_manage: command="makemigrations --noinput app1" app_path={{
> app_path}} settings={{django_settings}}
>
>   with_items:
>        -  app1
>        -  app2
>        -  app3
>
> 2) how do I pass username and password in createsuperuser command?
> I run this task but it didn't work?
>
> - django_manage: command="createsuperuser --noinput myuser myem...@xyz.com
> mypassword" app_path={{app_path}} settings={{django_settings}}
>
>
> Thanks again for* --input* thing :)
>
>
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/089ceee9-7e65-4a22-834e-b2861284792b%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/089ceee9-7e65-4a22-834e-b2861284792b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAH%2BKTJ7%3DGd4iMe6UTus%2BmJNuO0EQk_GLXubPR5tbkgZiHohQdQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to