Skip to content

Commit

Permalink
refactor(lint): fix YAML and Ansible Lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffreyvanwyk committed Jan 23, 2024
1 parent d729887 commit e090c51
Show file tree
Hide file tree
Showing 25 changed files with 196 additions and 129 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# Continuous integration in GitHub Actions that lints the Ansible code and tests
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# Publishes a new version (as specified with a Git tag) of the role to Ansible
Expand All @@ -24,8 +25,6 @@
#
# @copyright 2023 Geoffrey Bernardo van Wyk (https://geoffreyvanwyk.dev)
# @see GitHub Actions {@link https://docs.github.com/en/actions}
# @see {@link https://github.com/marketplace/actions/publish-ansible-role-to-galaxy}
# @see {@link https://github.com/ansible/galaxy/issues/46}
##

name: Publish
Expand Down Expand Up @@ -58,5 +57,7 @@ jobs:

- name: Trigger a new import on Galaxy.
run: >-
ansible-galaxy role import -vvv --api-key ${{ secrets.GALAXY_API_KEY }}
$(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
ansible-galaxy role import -vvv
--api-key ${{ secrets.GALAXY_API_KEY }}
$(echo ${{ github.repository }} | cut -d/ -f1)
$(echo ${{ github.repository }} | cut -d/ -f2)
29 changes: 17 additions & 12 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,26 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# Sets the default values of the role's variables that can be overridden.
#
# @copyright 2023 Geoffrey Bernardo van Wyk (https://geoffreyvanwyk.dev)
# @see Understanding Variable Precedence {@link https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#understanding-variable-precedence}
# @link http://tinyurl.com/ansible-variable-precedence
##

# Deployment of Source Code
moodle_deploy_repository: https://github.com/moodle/moodle # Public repository.
moodle_deploy_version: MOODLE_402_STABLE # Branch, tag, or commit.
moodle_deploy_update: yes # Whether to pull new commits.
moodle_deploy_destination: /var/www/html/moodle # Also the web document root.
moodle_deploy_repository: https://github.com/moodle/moodle # Public repository.
moodle_deploy_version: MOODLE_402_STABLE # Branch, tag, or commit.
moodle_deploy_update: true # Whether to pull new commits.
moodle_deploy_destination: /var/www/html/moodle # Also the web document root.

# Set-Up of Database

## Whether or not to install a database service.
moodle_db_install: yes
moodle_db_install: true

## Which database service to use: pgsql or maridb.
moodle_cfg_dbtype: pgsql
Expand All @@ -45,9 +46,9 @@ moodle_cfg_dbuser: moodler
## Random string generated for database password.
moodle_cfg_dbpass: "{{
lookup('ansible.builtin.password',
'/tmp/' + moodle_cfg_dbuser + '-db_password',
length=24,
chars=['ascii_letters', 'digits']) }}"
'/tmp/' + moodle_cfg_dbuser + '-db_password',
length=24,
chars=['ascii_letters', 'digits']) }}"

# Web Hosting

Expand All @@ -69,7 +70,9 @@ moodle_web_root: subdirectory
##
## The list of directories to be protected can be found on an existing Moodle
## instance (e.g. sandbox.moodledemo.net) by visiting:
## "Site Administration > Reports > Security Checks > Check public/private paths".
## "Site Administration > Reports
## > Security Checks
## > Check public/private paths".
moodle_web_protected_directories:
- \.git
- \.github
Expand All @@ -86,7 +89,9 @@ moodle_web_protected_directories:
##
## The list of files to be protected can be found on an existing Moodle
## instance (e.g. sandbox.moodledemo.net) by visiting:
## "Site Administration > Reports > Security Checks > Check public/private paths".
## "Site Administration > Reports
## > Security Checks
## > Check public/private paths".
moodle_web_protected_files:
- \.env
- \.lock
Expand Down
9 changes: 5 additions & 4 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,24 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# Tasks that run when notified by tasks that changed the managed node.
#
# @copyright 2023 Geoffrey Bernardo van Wyk (https://geoffreyvanwyk.dev)
# @see Handlers: running operations on change {@link https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_handlers.html#handlers}
# @link http://tinyurl.com/ansible-handlers
##

- name: Restart Apache web service
become: yes
become: true
ansible.builtin.sysvinit:
name: apache2
state: restarted

- name: Restart cron service
become: yes
become: true
ansible.builtin.sysvinit:
name: cron
state: restarted
24 changes: 13 additions & 11 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# Information for Ansible Galaxy.
Expand All @@ -37,14 +38,15 @@ galaxy_info:

min_ansible_version: "2.10"

# If this a Container Enabled role, provide the minimum Ansible Container version.
# If this a Container Enabled role, provide the minimum Ansible Container
# version.
# min_ansible_container_version:

#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
# Provide a list of supported platforms, and for each platform a list of
# versions. If you don't wish to enumerate all versions for a particular
# platform, use 'all'. To view available platforms and versions (or
# releases), visit: https://galaxy.ansible.com/api/v1/platforms/
#
platforms:
- name: Ubuntu
Expand All @@ -53,12 +55,12 @@ galaxy_info:
- jammy

galaxy_tags:
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
# List tags for your role here, one per line. A tag is a keyword that
# describes and categorizes the role. Users find roles by searching for
# tags. Be sure to remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
# NOTE: A tag is limited to a single word comprised of alphanumeric
# characters. Maximum 20 tags per role.
- moodle
- lms
- ubuntu
Expand Down
13 changes: 7 additions & 6 deletions molecule/config_settings/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# Contains the call to the role when testing with Molecule.
Expand All @@ -28,12 +29,12 @@

tasks:
- name: Update APT package cache
# Sometimes the package list on the server does not contain all the available
# packages. A fresh list has to be downloaded from the Ubuntu package
# repositories.
become: yes
# Sometimes the package list on the server does not contain all the
# available packages. A fresh list has to be downloaded from the Ubuntu
# package repositories.
become: true
ansible.builtin.apt:
update_cache: yes
update_cache: true
cache_valid_time: "{{ 60 * 60 * 24 }}" # seconds => 24 hours

- name: "Include geoffreyvanwyk.moodle"
Expand Down
5 changes: 3 additions & 2 deletions molecule/config_settings/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# The central configuration entrypoint for Molecule.
#
# @copyright 2023 Geoffrey Bernardo van Wyk (https://geoffreyvanwyk.dev)
# @see The Scenario Layout {@link https://ansible.readthedocs.io/projects/molecule/getting-started/#the-scenario-layout}
# @link http://tinyurl.com/molecule-scenario-layout
##

dependency:
Expand Down
6 changes: 4 additions & 2 deletions molecule/config_settings/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# This file is part of Ansible role geoffreyvanwyk.moodle.
#
# Ansible role geoffreyvanwyk.moodle is free software: you can redistribute it
Expand All @@ -11,7 +12,8 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# Override variables for this Molecule scenario.
Expand All @@ -20,6 +22,6 @@
##

moodle_cfg_forcedsettings:
additionalhtmlfooter: '<style>p {color: red}</style>'
additionalhtmlfooter: "<style>p {color: red}</style>"
enabledashboard: 0
navcourselimit: 12
3 changes: 2 additions & 1 deletion molecule/config_settings/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# Contains specific tests against the state of the container after the role has
Expand Down
13 changes: 7 additions & 6 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# Contains the call to the role when testing with Molecule.
Expand All @@ -24,12 +25,12 @@
hosts: all
tasks:
- name: Update APT package cache
# Sometimes the package list on the server does not contain all the available
# packages. A fresh list has to be downloaded from the Ubuntu package
# repositories.
become: yes
# Sometimes the package list on the server does not contain all the
# available packages. A fresh list has to be downloaded from the Ubuntu
# package repositories.
become: true
ansible.builtin.apt:
update_cache: yes
update_cache: true
cache_valid_time: "{{ 60 * 60 * 24 }}" # seconds => 24 hours

- name: "Include geoffreyvanwyk.moodle"
Expand Down
5 changes: 3 additions & 2 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# The central configuration entrypoint for Molecule.
#
# @copyright 2023 Geoffrey Bernardo van Wyk (https://geoffreyvanwyk.dev)
# @see The Scenario Layout {@link https://ansible.readthedocs.io/projects/molecule/getting-started/#the-scenario-layout}
# @link http://tinyurl.com/molecule-scenario-layout
##

dependency:
Expand Down
3 changes: 2 additions & 1 deletion molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# Contains specific tests against the state of the container after the role has
Expand Down
13 changes: 7 additions & 6 deletions molecule/mariadb/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# Contains the call to the role when testing with Molecule.
Expand All @@ -26,12 +27,12 @@
- ./vars/main.yml
tasks:
- name: Update APT package cache
# Sometimes the package list on the server does not contain all the available
# packages. A fresh list has to be downloaded from the Ubuntu package
# repositories.
become: yes
# Sometimes the package list on the server does not contain all the
# available packages. A fresh list has to be downloaded from the Ubuntu
# package repositories.
become: true
ansible.builtin.apt:
update_cache: yes
update_cache: true
cache_valid_time: "{{ 60 * 60 * 24 }}" # seconds => 24 hours

- name: "Include geoffreyvanwyk.moodle"
Expand Down
5 changes: 3 additions & 2 deletions molecule/mariadb/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# The central configuration entrypoint for Molecule.
#
# @copyright 2023 Geoffrey Bernardo van Wyk (https://geoffreyvanwyk.dev)
# @see The Scenario Layout {@link https://ansible.readthedocs.io/projects/molecule/getting-started/#the-scenario-layout}
# @link http://tinyurl.com/molecule-scenario-layout
##

dependency:
Expand Down
3 changes: 2 additions & 1 deletion molecule/mariadb/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# Override variables for this Molecule scenario.
Expand Down
3 changes: 2 additions & 1 deletion molecule/mariadb/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# Contains specific tests against the state of the container after the role has
Expand Down
3 changes: 2 additions & 1 deletion requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Ansible role geoffreyvanwyk.moodle. If not, see <https://www.gnu.org/licenses/>.
# Ansible role geoffreyvanwyk.moodle. If not, see
# <https://www.gnu.org/licenses/>.

##
# List of roles on which this role depends.
Expand Down
Loading

0 comments on commit e090c51

Please sign in to comment.