diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..9a5fe7a
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,96 @@
+---
+# This file is part of Learning Sandbox Online.
+#
+# Learning Sandbox Online is free software: you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Learning Sandbox Online is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Learning Sandbox Online. If not, see .
+
+##
+# Continuous integration in GitHub Actions that lints the Ansible code and tests
+# the playbooks with Molecule.
+#
+# @copyright 2023 Geoffrey Bernardo van Wyk (https://geoffreyvanwyk.dev)
+# @see GitHub Actions {@link https://docs.github.com/en/actions}
+##
+
+name: Build
+"on":
+ pull_request:
+ push:
+ branches:
+ - master
+
+jobs:
+ yamllint:
+ name: YAML Lint
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Check out the codebase.
+ uses: actions/checkout@v2
+
+ - name: Set up Python 3.
+ uses: actions/setup-python@v2
+ with:
+ python-version: "3.x"
+
+ - name: Install test dependencies.
+ run: pip3 install yamllint
+
+ - name: Lint code.
+ run: yamllint .
+
+ ansible-lint:
+ name: Ansible Lint
+ needs: yamllint
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Check out the codebase.
+ uses: actions/checkout@v2
+
+ - name: Set up Python 3.
+ uses: actions/setup-python@v2
+ with:
+ python-version: "3.x"
+
+ - name: Install test dependencies.
+ run: pip3 install ansible-lint
+
+ - name: Lint code.
+ run: ansible-lint .
+
+ molecule:
+ name: Molecule
+ needs: ansible-lint
+ runs-on: ubuntu-22.04
+
+ steps:
+ - name: Check out the codebase.
+ uses: actions/checkout@v2
+
+ - name: Set up Python 3.
+ uses: actions/setup-python@v2
+ with:
+ python-version: "3.x"
+
+ - name: Install test dependencies.
+ run: pip3 install ansible molecule molecule-plugins[docker] docker
+
+ - name: Install playbooks dependencies
+ run: ansible-galaxy role install --role-file requirements.yml
+
+ - name: Run Molecule tests.
+ run: molecule test
+ env:
+ PY_COLORS: "1"
+ ANSIBLE_FORCE_COLOR: "1"
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 0000000..f22bcfa
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,64 @@
+---
+# This file is part of Learning Sandbox Online.
+#
+# Learning Sandbox Online is free software: you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Learning Sandbox Online is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Learning Sandbox Online. If not, see .
+
+##
+# Continuous delivery in GitHub Actions that runs the Ansible playbooks on the
+# public website's servers.
+#
+# @copyright 2023 Geoffrey Bernardo van Wyk (https://geoffreyvanwyk.dev)
+# @see GitHub Actions {@link https://docs.github.com/en/actions}
+##
+
+name: Deploy
+"on":
+ push:
+ branches:
+ - master
+
+jobs:
+ ansible-playbook:
+ name: Run playbook
+ runs-on: ubuntu-22.04
+
+ steps:
+ - name: Check out the codebase.
+ uses: actions/checkout@v2
+
+ - name: Set up Python 3.
+ uses: actions/setup-python@v2
+ with:
+ python-version: "3.x"
+
+ - name: Install Ansible.
+ run: pip3 install ansible
+
+ - name: Install playbooks dependencies
+ run: ansible-galaxy role install --role-file requirements.yml
+
+ - name: Install SSH key.
+ uses: shimataro/ssh-key-action@v2
+ with:
+ key: ${{ secrets.SSH_PRIVATE_KEY }}
+ known_hosts: ${{ secrets.KNOWN_HOSTS }}
+
+ - name: Run plays.
+ run: |
+ ansible-playbook main.yml
+ --inventory ${{ secrets.ANSIBLE_INVENTORY }},
+ --user ${{ secrets.ANSIBLE_USER }}
+ env:
+ PY_COLORS: "1"
+ ANSIBLE_FORCE_COLOR: "1"
diff --git a/.yamllint b/.yamllint
new file mode 100644
index 0000000..79b5582
--- /dev/null
+++ b/.yamllint
@@ -0,0 +1,7 @@
+---
+extends: default
+
+rules:
+ truthy:
+ allowed-values: ["true", "false", "yes", "no"]
+ check-keys: true
diff --git a/defaults/main.yml b/defaults/main.yml
index b3d921a..a293bec 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -1,18 +1,18 @@
---
-# This file is part of Online Learning Sandbox.
+# This file is part of Learning Sandbox Online.
#
-# Online Learning Sandbox is free software: you can redistribute it
+# Learning Sandbox Online is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# Online Learning Sandbox is distributed in the hope that it will be
+# Learning Sandbox Online is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
-# Online Learning Sandbox. If not, see .
+# Learning Sandbox Online. If not, see .
##
# Default values for sandbox variables.
@@ -20,7 +20,7 @@
# @copyright 2023 Geoffrey Bernardo van Wyk (https://geoffreyvanwyk.dev)
##
-sandbox_environment: production # other values: development
+sandbox_environment: production # other values: development
sandbox_name: Learning Sandbox Online
sandbox_domain: learningsandbox.online
diff --git a/homepage.playbook.yml b/homepage.playbook.yml
index 5b76d79..6825eb0 100644
--- a/homepage.playbook.yml
+++ b/homepage.playbook.yml
@@ -1,18 +1,18 @@
---
-# This file is part of Online Learning Sandbox.
+# This file is part of Learning Sandbox Online.
#
-# Online Learning Sandbox is free software: you can redistribute it
+# Learning Sandbox Online is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# Online Learning Sandbox is distributed in the hope that it will be
+# Learning Sandbox Online is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
-# Online Learning Sandbox. If not, see .
+# Learning Sandbox Online. If not, see .
##
# Playbook for creating the parent website.
@@ -49,12 +49,14 @@
- "{{ sandbox_domain }}-ssl.conf"
ansible.builtin.command: a2ensite {{ item }}
changed_when: true
+ tags:
+ - molecule-idempotence-notest
- - name: Deploy and enable Apache virtualhost configurations for sandbox aliases
+ - name: Deploy and enable Apache virtualhosts for sandbox aliases
loop: "{{ sandbox_domain_aliases }}"
loop_control:
loop_var: sandbox_domain_alias
- ansible.builtin.include_tasks: tasks/deploy_and_enable_sandbox_domain_alias_virtualhosts.yml
+ ansible.builtin.include_tasks: tasks/deploy_domain_alias_virtualhosts.yml
- name: Enable SSL module for Apache
become: true
@@ -67,6 +69,8 @@
ansible.builtin.sysvinit:
name: apache2
state: restarted
+ tags:
+ - molecule-idempotence-notest
- name: Deploy home page
become: true
diff --git a/main.playbook.yml b/main.playbook.yml
index 5a43b68..812252e 100644
--- a/main.playbook.yml
+++ b/main.playbook.yml
@@ -1,18 +1,18 @@
---
-# This file is part of Online Learning Sandbox.
+# This file is part of Learning Sandbox Online.
#
-# Online Learning Sandbox is free software: you can redistribute it
+# Learning Sandbox Online is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# Online Learning Sandbox is distributed in the hope that it will be
+# Learning Sandbox Online is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
-# Online Learning Sandbox. If not, see .
+# Learning Sandbox Online. If not, see .
##
# Primary playbook of this project.
@@ -27,7 +27,7 @@
become: yes
ansible.builtin.apt:
update_cache: true
- cache_valid_time: 3600 # seconds == 1 hour
+ cache_valid_time: 3600 # seconds == 1 hour
- name: Install Moodle instances
ansible.builtin.import_playbook: moodle.playbook.yml
diff --git a/moodle.playbook.yml b/moodle.playbook.yml
index 14dac16..c036856 100644
--- a/moodle.playbook.yml
+++ b/moodle.playbook.yml
@@ -1,18 +1,18 @@
---
-# This file is part of Online Learning Sandbox.
+# This file is part of Learning Sandbox Online.
#
-# Online Learning Sandbox is free software: you can redistribute it
+# Learning Sandbox Online is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# Online Learning Sandbox is distributed in the hope that it will be
+# Learning Sandbox Online is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
-# Online Learning Sandbox. If not, see .
+# Learning Sandbox Online. If not, see .
##
# Playbook for installing the Moodle instances.
diff --git a/requirements.yml b/requirements.yml
index 42c5367..8e6bae6 100644
--- a/requirements.yml
+++ b/requirements.yml
@@ -1,18 +1,18 @@
---
-# This file is part of Online Learning Sandbox.
+# This file is part of Learning Sandbox Online.
#
-# Online Learning Sandbox is free software: you can redistribute it
+# Learning Sandbox Online is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# Online Learning Sandbox is distributed in the hope that it will be
+# Learning Sandbox Online is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
-# Online Learning Sandbox. If not, see .
+# Learning Sandbox Online. If not, see .
##
# List of roles on which this project depends.
@@ -20,5 +20,6 @@
# @copyright 2023 Geoffrey Bernardo van Wyk (https://geoffreyvanwyk.dev)
##
+- name: geoffreyvanwyk.php
- name: geoffreyvanwyk.moodle
- name: geerlingguy.certbot
diff --git a/tasks/deploy_and_enable_sandbox_domain_alias_virtualhosts.yml b/tasks/deploy_domain_alias_virtualhosts.yml
similarity index 82%
rename from tasks/deploy_and_enable_sandbox_domain_alias_virtualhosts.yml
rename to tasks/deploy_domain_alias_virtualhosts.yml
index e13b1fb..5feebbd 100644
--- a/tasks/deploy_and_enable_sandbox_domain_alias_virtualhosts.yml
+++ b/tasks/deploy_domain_alias_virtualhosts.yml
@@ -1,18 +1,18 @@
---
-# This file is part of Online Learning Sandbox.
+# This file is part of Learning Sandbox Online.
#
-# Online Learning Sandbox is free software: you can redistribute it
+# Learning Sandbox Online is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# Online Learning Sandbox is distributed in the hope that it will be
+# Learning Sandbox Online is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
-# Online Learning Sandbox. If not, see .
+# Learning Sandbox Online. If not, see .
##
# Deploy and enable Apache virtual host configuration files.
diff --git a/tasks/install_moodle.yml b/tasks/install_moodle.yml
index cb1e641..3657b2d 100644
--- a/tasks/install_moodle.yml
+++ b/tasks/install_moodle.yml
@@ -1,18 +1,18 @@
---
-# This file is part of Online Learning Sandbox.
+# This file is part of Learning Sandbox Online.
#
-# Online Learning Sandbox is free software: you can redistribute it
+# Learning Sandbox Online is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# Online Learning Sandbox is distributed in the hope that it will be
+# Learning Sandbox Online is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
-# Online Learning Sandbox. If not, see .
+# Learning Sandbox Online. If not, see .
##
# Tasks for installing a particular version of Moodle.
diff --git a/tasks/install_tls_certificates.yml b/tasks/install_tls_certificates.yml
index fbb4c6d..826b63d 100644
--- a/tasks/install_tls_certificates.yml
+++ b/tasks/install_tls_certificates.yml
@@ -1,18 +1,18 @@
---
-# This file is part of Online Learning Sandbox.
+# This file is part of Learning Sandbox Online.
#
-# Online Learning Sandbox is free software: you can redistribute it
+# Learning Sandbox Online is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# Online Learning Sandbox is distributed in the hope that it will be
+# Learning Sandbox Online is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
-# Online Learning Sandbox. If not, see .
+# Learning Sandbox Online. If not, see .
##
# Install TLS certificates, using a method appropriate to the environment.