dev/modules/sysconfig/manifests/django_init.pp
changeset 589 a87316d901be
parent 588 8e9ea314e06e
child 593 8156e6e3c503
equal deleted inserted replaced
583:084934fe912e 589:a87316d901be
       
     1 class sysconfig::django_init (
       
     2     $superuser_name = hiera('sysconfig::params::superuser_name',$sysconfig::params::superuser_name),
       
     3     $superuser_pw   = hiera('sysconfig::params::superuser_pw',$sysconfig::params::superuser_pw)
       
     4 ) inherits sysconfig::params {
       
     5     
       
     6     notify {'django_init': name => "\$superuser_name : ${superuser_name}, \$superuser_pw : ${superuser_pw}", withpath => true }->
       
     7 
       
     8     exec { 'syncdb':
       
     9         command => '/srv/comt/bin/django syncdb --noinput --migrate',
       
    10         user    => 'vagrant' 
       
    11     }
       
    12 
       
    13     exec { 'loaddata':
       
    14         command => '/srv/comt/bin/django loaddata roles_generic',
       
    15         user    => 'vagrant',
       
    16         require => Exec['syncdb']
       
    17     }
       
    18 
       
    19     exec { 'createsuperuser':
       
    20         command => "/bin/echo \"from django.contrib.auth.models import User; User.objects.create_superuser('${superuser_name}', 'admin@example.com', '${superuser_pw}')\" | /srv/comt/bin/django shell",
       
    21         cwd     => '/srv/comt',
       
    22         user    => 'vagrant',
       
    23         onlyif  => "/bin/echo \"from django.contrib.auth.models import User; exit(User.objects.filter(username='${superuser_name}').count())\" | /srv/comt/bin/django shell",
       
    24        require => Exec['syncdb']
       
    25     }
       
    26 }