equal
deleted
inserted
replaced
|
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 ){ |
|
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 unless => '/bin/echo "from django.contrib.auth.models import User; exit(0) if User.objects.filter(username=\'$superuser_name\').count() else exit(1)" | /srv/comt/bin/django shell', |
|
24 require => Exec['syncdb'] |
|
25 } |
|
26 } |