Browse Source

Creating a default user account during setup. Also a playbook for creating new users.

Madis Martin Lutter 1 year ago
parent
commit
fb20560801
2 changed files with 29 additions and 0 deletions
  1. 21 0
      lava-create-user.yml
  2. 8 0
      lava.yml

+ 21 - 0
lava-create-user.yml

@@ -0,0 +1,21 @@
+- hosts: all
+  vars_prompt:
+  - name: username
+    prompt: "Username"
+    private: no
+    default: "root"
+  - name: email
+    prompt: "Email"
+    private: no
+  - name: password
+    prompt: "Password"
+    private: yes
+  tasks:
+  - name: Create user
+    shell: lava-server manage createsuperuser --username {{username}} --email {{email}} --noinput
+  - name: Set password
+    expect:
+      command: lava-server manage changepassword {{username}}
+      responses:
+        Password: "{{password}}"
+        Password (again): "{{password}}"

+ 8 - 0
lava.yml

@@ -22,6 +22,14 @@
     args:
       creates: /etc/apache2/sites-enabled/lava-server.conf
     notify: reload apache
+  - name: Create root account
+    shell: lava-server manage createsuperuser --username root --email root@example.com --noinput
+  - name: Set temporary password
+    expect:
+      command: lava-server manage changepassword root
+      responses:
+        Password: root
+        Password (again): root
   handlers:
   - name: reload apache
     service: