ghost

ghost

This role sets up a ghost blog using the docker community's ghost image.

Requirements

This role relies on docker being available on the host and the docker_container ansible module in ansible.

To cover the first one, the geerlingguy.docker role can be used.

To cover the dependencies for the docker_container module the geerlingguy.pip role can be used to install Python's docker package.

Role Variables

  • ghost__host (required, default: localhost): The value of this variable has 2 main uses: it defines the URL for the blog and is also used to define the container's name. The URL will be defined as https://{{ ghost__host }} while the container's name is generated by converting the variable's dots to underscores and prepending ghost_ to it.
  • ghost__version (optional, default: 5.85.1): ghost's docker image tag to use in the container. See ghost image tags in dockerhub.
  • ghost__base_dir (optional, default: /var/ghost-blog): folder where to setup the blog's persistent files.
  • ghost__blog_name (optional, default: Ghost Blog): Name to reference a particular instance of the role within Ansible. Doesn't have any semantic effect on the service.
  • ghost__listen_host (optional, default: 127.0.0.1): Address where the container will publish the blog's socket.
  • ghost__listen_port (optional, default: 2368): Port where the container will publish the blog's port.
  • ghost__configs (optional, default: {}): Dictionary of configurations to be passed to the container as environmental variables. See ghost's Configuration Docs for all the possible values and specifically here on how to convert the keys into environmental variables.

Suggestions

It is suggested that you don't expose the ghost's port directly to the outside world but rather to use a reverse proxy such as nginx to forward the appropriate traffic.

This allows for easier TLS setup and sharing of the HTTPS port among multiple applications.

Example Playbook

The following would be a fairly common role usage example:

- host: my-blog.my-domain.com
  roles:
    - role: salessandri.ghost
      vars:
        ghost__host: my-blog.my-domain.com
        ghost__base_dir: /var/my-blog
        ghost__blog_name: Personal Blog
        ghost__configs:
          mail__from: '"My Blog Email" <[email protected]>'
          mail__transport: 'SMTP'
          mail__options__host: smtp.my-domain.com
          mail__options__port: 465
          mail__options__secureConnection: true
          mail__options__auth__user: blog_mail_user
          mail__options__auth__pass: '{{ blog_mail_password_vault }}'

License

MIT

Author Information

This role was created in 2020 by Santiago Alessandri.

About

Setup a ghost blog using docker container

Install
ansible-galaxy install salessandri/ansible-ghost
GitHub repository
License
mit
Downloads
126