diff --git a/README.md b/README.md index 4bd88fc..62dc88e 100644 --- a/README.md +++ b/README.md @@ -199,16 +199,9 @@ Before proceeding from this section, review the section checklist to ensure you ### Configure The Panel -I need to create an account on the panel, https://panel.mjb-stage.com/register with the email address manager@mjb-stage.com. +An initial admin account is created during the ansible installation. The credentials for the admin account are in the `inventory.yml` file under `admin\_user:`. -Once I create the account, I need to promote it to an admin. From a shell on panel.mjb-stage.com server, I run the following. - -```bash -cd mjb/Web -./script/mjb flip_admin manager@mjb-stage.com -``` - -Now that I have an admin account, I can access the Servers tab at https://panel.mjb-stage.com/admin/servers +Now that I have the admin account credentials, I can access the Servers tab at https://panel.mjb-stage.com/admin/servers The tab configures web servers that the system will deploy blogs to. Each of the webservers that were configures by Ansible should go here, so I enter `web-west.mjb-stage.com` and then `web-west.mjb-stage.com`. The servers tab now lists these two servers. diff --git a/ansible/env/example/inventory.yml b/ansible/env/example/inventory.yml index d9e648e..729a602 100644 --- a/ansible/env/example/inventory.yml +++ b/ansible/env/example/inventory.yml @@ -17,6 +17,12 @@ all: vars: + # This is the admin user account that will be created for the panel. + admin_user: + name: Manager + email: manager@example.com + pass: "{{ vault_admin_user_pass }}" + # This is the git repository that contains MyJekyllBlog itself. It will be checked out # during the installation process on the various machines that need it. repo: https://git.modfoss.com/symkat/MyJekyllBlog.git diff --git a/ansible/env/example/vault.yml b/ansible/env/example/vault.yml index e1d0e95..47eb04a 100644 --- a/ansible/env/example/vault.yml +++ b/ansible/env/example/vault.yml @@ -1,3 +1,4 @@ +vault_admin_user_pass: 'password you will use to login to the admin account on the panel' vault_databases_mjb_pass: 'some password' vault_databases_minion_pass: 'some password' vault_databases_gitea_pass: 'some password' diff --git a/ansible/roles/mjb-profile-panel/tasks/main.yml b/ansible/roles/mjb-profile-panel/tasks/main.yml index 007a84f..55992ba 100644 --- a/ansible/roles/mjb-profile-panel/tasks/main.yml +++ b/ansible/roles/mjb-profile-panel/tasks/main.yml @@ -34,5 +34,3 @@ - name: Support an nginx web server for MJB::Web include_tasks: file: webserver.yml - -# Need to import the database TODO: Make the store server do this instead. diff --git a/ansible/roles/mjb-profile-store/tasks/main.yml b/ansible/roles/mjb-profile-store/tasks/main.yml index 39c631f..20a7536 100644 --- a/ansible/roles/mjb-profile-store/tasks/main.yml +++ b/ansible/roles/mjb-profile-store/tasks/main.yml @@ -20,9 +20,35 @@ name: mjb-role-webapp - name: Populate the MJB Database - shell: /home/manager/mjb/Web/script/mjb dbc < /home/manager/mjb/DB/etc/schema.sql > /home/manager/mjb/DB/etc/schema.log 2>&1 + shell: /home/manager/mjb/Web/script/mjb dbc < /home/manager/mjb/DB/etc/schema.sql > /home/manager/.build-logs/schema.log 2>&1 args: - creates: /home/manager/mjb/DB/etc/schema.log + creates: /home/manager/.build-logs/schema.log + environment: + PATH: '/home/manager/perl5/bin:/usr/local/bin:/usr/bin:/bin' + PERL5LIB: '/home/manager/perl5/lib/perl5' + PERL_MB_OPT: '--install_base "/home/manager/perl5"' + PERL_MM_OPT: 'INSTALL_BASE=/home/manager/perl5' + PERL_LOCAL_LIB_ROOT: '/home/manager/perl5' + become: true + become_user: manager + +- name: Create initial admin user account + shell: /home/manager/mjb/Web/script/mjb create-user "{{ admin_user.name }}" "{{ admin_user.email }}" "{{ admin_user.pass }}" > /home/manager/.build-logs/user-create.log 2>&1 + args: + creates: /home/manager/.build-logs/user-create.log + environment: + PATH: '/home/manager/perl5/bin:/usr/local/bin:/usr/bin:/bin' + PERL5LIB: '/home/manager/perl5/lib/perl5' + PERL_MB_OPT: '--install_base "/home/manager/perl5"' + PERL_MM_OPT: 'INSTALL_BASE=/home/manager/perl5' + PERL_LOCAL_LIB_ROOT: '/home/manager/perl5' + become: true + become_user: manager + +- name: Promote initial admin user account to admin + shell: /home/manager/mjb/Web/script/mjb flip-admin "{{ admin_user.email }}" > /home/manager/.build-logs/flip-admin.log 2>&1 + args: + creates: /home/manager/.build-logs/flip-admin.log environment: PATH: '/home/manager/perl5/bin:/usr/local/bin:/usr/bin:/bin' PERL5LIB: '/home/manager/perl5/lib/perl5' diff --git a/ansible/roles/mjb-role-webapp/tasks/webapp.yml b/ansible/roles/mjb-role-webapp/tasks/webapp.yml index c2b39da..11de8fc 100644 --- a/ansible/roles/mjb-role-webapp/tasks/webapp.yml +++ b/ansible/roles/mjb-role-webapp/tasks/webapp.yml @@ -23,11 +23,19 @@ become: true become_user: manager +- name: Create /home/manager/.build-logs + file: + state: directory + path: /home/manager/.build-logs + owner: manager + group: manager + mode: 0750 + - name: Build MJB::DB - shell: dzil build > build.log 2>&1 + shell: dzil build > /home/manager/.build-logs/mjb-db.log 2>&1 args: chdir: /home/manager/mjb/DB - creates: /home/manager/mjb/DB/build.log + creates: /home/manager/.build-logs/mjb-db.log environment: PATH: '/home/manager/perl5/bin:/usr/local/bin:/usr/bin:/bin' PERL5LIB: '/home/manager/perl5/lib/perl5' @@ -51,11 +59,24 @@ become: true become_user: manager +- name: Clean MJB::DB + shell: dzil clean + args: + chdir: /home/manager/mjb/DB + environment: + PATH: '/home/manager/perl5/bin:/usr/local/bin:/usr/bin:/bin' + PERL5LIB: '/home/manager/perl5/lib/perl5' + PERL_MB_OPT: '--install_base "/home/manager/perl5"' + PERL_MM_OPT: 'INSTALL_BASE=/home/manager/perl5' + PERL_LOCAL_LIB_ROOT: '/home/manager/perl5' + become: true + become_user: manager + - name: Install MJB::Web Dependencies - shell: cpanm --installdeps . > build.log 2>&1 + shell: cpanm --installdeps . > /home/manager/.build-logs/mjb-web.log 2>&1 args: chdir: /home/manager/mjb/Web - creates: /home/manager/mjb/Web/build.log + creates: /home/manager/.build-logs/mjb-web.log environment: PATH: '/home/manager/perl5/bin:/usr/local/bin:/usr/bin:/bin' PERL5LIB: '/home/manager/perl5/lib/perl5'