Skip to content

Ansible Role linuxfabrik.lfops.grav

This role installs Grav (a simple file-based flat-file CMS platform) using PHP composer. For keeping Grav, Plugins and Themes up to date the role configures the Grav Package Manager (GPM).

It is possible to configure whether the Grav Admin Panel should be installed (it is installed by default). By default, you can access the admin by pointing your browser to http://grav.example.com/admin. You can simply log in with the username and password set in the role variables.

Mandatory Requirements

If you use the "Grav" Playbook, this is automatically done for you.

Tags

grav

  • Install unzip.
  • Test if Grav is already installed.
  • composer create-project getgrav/grav {{ grav__install_dir }}.
  • chown -R apache:apache {{ grav__install_dir }}.
  • find {{ grav__install_dir }} -type f -exec chmod --changes 664 {} \;.
  • find {{ grav__install_dir }}/bin -type f -exec chmod --changes 775 {} \;.
  • find {{ grav__install_dir }} -type d -exec chmod --changes 775 {} \;.
  • find {{ grav__install_dir }} -type d -exec chmod --changes +s {} \;.
  • Deploy /etc/systemd/system/grav-selfupgrade.service.
  • Deploy /etc/systemd/system/grav-selfupgrade.timer.
  • Deploy /etc/systemd/system/grav-update.service.
  • Deploy /etc/systemd/system/grav-update.timer.
  • systemctl enable/disable grav-selfupgrade.timer --now.
  • systemctl enable/disable grav-update.timer --now.
  • Install the Administration Panel plugin for Grav.
  • Create Grav User Accounts.
  • Triggers: none.

grav:cron

  • Deploy /etc/systemd/system/grav-selfupgrade.service.
  • Deploy /etc/systemd/system/grav-selfupgrade.timer.
  • Deploy /etc/systemd/system/grav-update.service.
  • Deploy /etc/systemd/system/grav-update.timer.
  • systemctl enable/disable grav-selfupgrade.timer --now.
  • systemctl enable/disable grav-update.timer --now.
  • Triggers: none.

grav:state

  • systemctl enable/disable grav-selfupgrade.timer --now.
  • systemctl enable/disable grav-update.timer --now.
  • Triggers: none.

grav:user

  • Install the Administration Panel plugin for Grav.
  • Create Grav User Accounts.
  • Triggers: none.

Mandatory Role Variables

grav__url

  • The Grav URL, without http:// or https://.
  • Type: String.

grav__users

  • Mandatory if using the Grav Admin Panel. Have a look at the example below for defining a user. The permissions key can be either a for Admin access only, s for Site access only and b for both Admin and Site access.
  • Type: List of dictionaries.

Example:

# mandatory
grav__url: 'grav.example.com'
grav__users:
  - user: 'firstname_lastname'
    fullname: 'Firstname Lastname'
    password: 'linuxfabrik'
    email: 'firstname.lastname@example.com'
    permissions: 'b'

Optional Role Variables

grav__install_dir

  • Grav installation directory.
  • Type: String.
  • Default: '/var/www/html/{{ grav__url }}'

grav__on_calendar_selfupgrade

  • Time to upgrading Grav CMS (Systemd-Timer notation).
  • Type: String.
  • Default: '22:{{ 59 | random(seed=inventory_hostname) }}'

grav__on_calendar_update

  • Time to update Grav Plugins and Themes (Systemd-Timer notation).
  • Type: String.
  • Default: '23:{{ 59 | random(seed=inventory_hostname) }}'

grav__skip_admin

  • If set to true, installation of the Admin Panel plugin will be skipped.
  • Type: Bool.
  • Default: false

grav__timer_selfupgrade_enabled

  • Enables/disables Systemd-Timer for upgrading Grav CMS.
  • Type: Bool.
  • Default: true

grav__timer_update_enabled

  • Enables/disables Systemd-Timer for updating Grav Plugins and Themes.
  • Type: Bool.
  • Default: true

Known Limitations

There might be more to implement:

  • https://learn.getgrav.org/17/security/configuration

License

The Unlicense

Author Information

Linuxfabrik GmbH, Zurich