add setup admin
diff --git a/README.rst b/README.rst
index cd2d1c8..c0368c0 100644
--- a/README.rst
+++ b/README.rst
@@ -26,6 +26,10 @@
bind:
host: localhost
port: 80
+ admin:
+ username: admin
+ password: password
+ email: email@example.com
database:
engine: postgresql
host: localhost
diff --git a/maas/cluster.sls b/maas/cluster.sls
index 3119bd6..08a6f03 100644
--- a/maas/cluster.sls
+++ b/maas/cluster.sls
@@ -25,6 +25,13 @@
- require_in:
- pkg: maas_cluster_packages
+maas_setup_admin:
+ cmd.run:
+ - name: "touch /var/lib/maas/.setup_admin"
+ - creates: /var/lib/maas/.setup_admin
+ - require:
+ - pkg: maas_region_packages
+
{%- endif %}
maas_cluster_packages:
@@ -49,4 +56,4 @@
- watch:
- file: /etc/maas/rackd.conf
-{%- endif %}
+{%- endif %}
\ No newline at end of file
diff --git a/maas/region.sls b/maas/region.sls
index dd71278..87a0fbc 100644
--- a/maas/region.sls
+++ b/maas/region.sls
@@ -38,6 +38,11 @@
- require:
- file: /etc/maas/regiond.conf
-{%- endif %}
+maas_set_admin_passord:
+ cmd.run:
+ - name: "maas createadmin --username {{ region.admin.username }} --password {{ region.admin.password }} --email {{ region.admin.email }} && touch /var/lib/maas/.setup_admin"
+ - creates: /var/lib/maas/.setup_admin
+ - require:
+ - service: maas_region_services
-
+{%- endif %}
\ No newline at end of file
diff --git a/metadata/service/region/single.yml b/metadata/service/region/single.yml
index 128ce96..f02451e 100644
--- a/metadata/service/region/single.yml
+++ b/metadata/service/region/single.yml
@@ -9,6 +9,10 @@
bind:
host: localhost
port: 80
+ admin:
+ username: admin
+ password: password
+ email: email@example.com
database:
engine: postgresql
host: localhost
diff --git a/tests/pillar/maas_cluster.sls b/tests/pillar/maas_cluster.sls
index 546ffd1..dc16599 100644
--- a/tests/pillar/maas_cluster.sls
+++ b/tests/pillar/maas_cluster.sls
@@ -8,6 +8,10 @@
bind:
host: localhost
port: 80
+ admin:
+ username: admin
+ password: password
+ email: email@example.com
database:
engine: postgresql
host: localhost
diff --git a/tests/pillar/maas_region.sls b/tests/pillar/maas_region.sls
index 7f648e6..a3714a2 100644
--- a/tests/pillar/maas_region.sls
+++ b/tests/pillar/maas_region.sls
@@ -8,6 +8,10 @@
bind:
host: localhost
port: 80
+ admin:
+ username: admin
+ password: password
+ email: email@example.com
database:
engine: postgresql
host: localhost