Automate ghost install

I am trying to automate both the installation and configuration of ghost on a system I have. I was able to follow https://www.fastcomet.com/tutorials/ghost/install-ghost-autosetup-script for auto install. However I am unable to perform the automation of configuration. Has anybody ever solved this? The configuration asks for hostname, DB credentials and whether to start the systemd service itself. Please share if anybody has done this successfully through a bash script.

That setup script looks to be quite old, it predates Ghost-CLI and does everything the hard way.

Ghost has it’s own CLI tool for installing Ghost, which is explicitly designed for automation and works seamlessly with bash, or any other automation tool you might want to use like ansible, salt or puppet.

You can read the step by step guide for setting up prerequisites, installing using ghost cli and configuring Ghost here:

Then, if you want to go to the next level and start automating things the CLI guide will help you understand the CLI tool:

Most importantly, pay attention to the --no-prompt option, which disables any interactivity. It requires that you pass all flags up front, but using this it is possible to install, setup and configure ghost in either a single command, or 3 separate ones depending on your preference.

1 Like

P.S. I’ve moved this out of ideas as it’s already entirely possible & designed for.

Any hints on how to do ghost update via ansible ad-hoc commands? Also, a ghost update playbook? I’ve searched the web but I can only find ghost install playbooks. Thanks!

PS I can do ghost ls because it’s a global command by using:
ansible servername -a “ghost ls”

PPS I eventually figured it our through trial and error, though unsure if proper syntax :slight_smile:
ansible severname -m shell -a “cd /var/www/domain.com/ && ghost update”