/ansible-ghost-blog

Ansible role for installing Ghost.

Primary LanguageShellGNU General Public License v3.0GPL-3.0

Ghost Build Status

Installs Ghost, a blogging platform. By default it'll install the latest Ghost version available from Ghost's homepage but you can specify a git repository if you have Ghost under version control.

This role also takes care of Ghost's issue #2639 on hosts using libc 2.13 or older, making sure that npm's sqlite3 is compiled beforehand. This has been tested and verified to work on Debian Wheezy.

Requirements

This role takes care of installing only a Ghost blog. You need to have a server prepared for that with:

Nodejs. v.0.10.x must be installed in the node. (You can use for example this role to install node)

If you want to forward the port, use Nginx. (You can use this Nginx role)

Quick (Full) Use

git clone https://github.com/Oefenweb/ansible-nodejs.git  {{ inventory_dir }}/roles/
git clone https://github.com/geerlingguy/ansible-role-nginx.git  {{ inventory_dir }}/roles/
git clone https://github.com/Tinker-Ware/ansible-ghost-blog.git  {{ inventory_dir }}/roles/

{{ inventory_dir }}/playbook.yml

- hosts: ghost_server
  roles:
     - { role: nodejs, become: yes }
     - role: ghost
     - { role: nginx, become: yes }

Role Variables

Required variables:

  • ghost_repo: URL of your Ghost blog files. Here's an example If this variable is not define, A clean ghost blog will be installed.
  • ghost_install_dir: Directory where Ghost will be installed. It is also the home of the user that runs Ghost. Defaults to /var/www/ghost
  • ghost_user_name: Username for the user that runs Ghost. Defaults to ghost.
  • ghost_user_group: Group for the user that runs Ghost. Defaults to ghost.
  • ghost_config_mail: Ghost's mail configuration. It expects a YAML dictonary. Defaults to {}.
  • ghosts_config_database: Ghost's database configuration. It expects a YAML dictionary. Defaults configure a sqlite3 database, which is Ghost's default.
  • ghosts_config_server: Ghost's server configuration. It expects a YAML dictionary. Defaults to localhost on port 2368.

Internal variables, avoid changing:

  • ghost_fetch_url: URL used for fetching Ghost. Defaults to https://ghost.org/zip/ghost-latest.zip.
  • ghost_fetch_dir: Directory to store the Ghost zip. Defaults to /tmp.

Configs Database

If you add your ghost.db to {{ inventory_file }}/host_files/{{ hostname}}/ghost.db the file will be imported to your ghost blog. (That will import posts, configs, etc)

USE THIS WITH CAUTION Will replace your current database. Currently it has only been tested with sqlite3

Example Playbook

{{ inventory_dir }}/playbook.yml

- hosts: ghost_server
  roles:
     - { role: nodejs, become: yes }
     - role: ghost
     - { role: nginx, become: yes }

{{ inventory_dir }}/host_vars/ghost_server

# Variables for Nodejs Role
nodejs_version: 'nodejs-v010'

# Variables for Ghost role
ghost_nodejs_enabled: no
ghost_nginx_enabled: no
ghost_install_dir: '/opt/tinker/shared_files/ghost'
ghost_user_name: 'ghost'
ghost_user_group: 'ghost'
ghost_repo: 'https://github.com/Tinker-Ware/ghost-blog.git'

# Variables for nginx Role
nginx_remove_default_vhost: true
nginx_vhosts:
    - server_name: "blog.tinkerware.io"
    listen: "80"
    extra_parameters: |
      location / {
        proxy_set_header    Host $http_host;
        proxy_set_header    X-Real-IP $remote_addr;
        proxy_pass          http://127.0.0.1:2368;
      }

Author Information

This role is provided by the Tinkerware project under a GNU GPLv3 Licence.

Forked a while ago from mtpereira (But he didn't have his BSD parragraf =/)