Uploaded image for project: 'IGB'
  1. IGB
  2. IGBF-2364

Investigate: How to create Django super-user account using ansible

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      We need to create a Django admin user for each new App Store.

      When provisioning an App Store manually, we do this by running:

      • manage.py createsuperuser [adminuser]

      When we do this, manage.py asks you to enter a password manually.

      Currently, there does not appear to be an option to pass in the password as a command line option.

      However, when using manage.py from ansible (using the django_manage role), we cannot easily enter the password manually.

      Others have discussed this problem, and a couple of solutions were proposed here:

      For this task, design and develop a solution that will allow us to write and run a django_admin or other task that creates the superuser. Include a comment linking to the above StackOverflow post if you write a script or any other new code for this.

      See also documentation for the django_admin role:

      Describe the solution you think is best in the comments below. We'll implement it under a separate ticket.

        Attachments

          Issue Links

            Activity

            Hide
            cdias1 Chester Dias (Inactive) added a comment -

            Django module when creating super user assigns a random password. There is no direct way for creating super user
            django_manage allows for custom commands.

            Solution 1 :
            1. Check if a superuser is already present
            2. Use command attribute of the django_manage to invoke a shell execution for creating the superuser.

            Solution 2(to be used only if the solution 1 fails):
            using the shell module execute the super user creation

            Show
            cdias1 Chester Dias (Inactive) added a comment - Django module when creating super user assigns a random password. There is no direct way for creating super user django_manage allows for custom commands. Solution 1 : 1. Check if a superuser is already present 2. Use command attribute of the django_manage to invoke a shell execution for creating the superuser. Solution 2(to be used only if the solution 1 fails): using the shell module execute the super user creation
            Hide
            cdias1 Chester Dias (Inactive) added a comment -

            there are some more fancy implementation on the below link
            https://gist.github.com/elleryq/9c70e08b1b2cecc636d6

            Show
            cdias1 Chester Dias (Inactive) added a comment - there are some more fancy implementation on the below link https://gist.github.com/elleryq/9c70e08b1b2cecc636d6

              People

              • Assignee:
                ann.loraine Ann Loraine
                Reporter:
                ann.loraine Ann Loraine
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: