Ansible playbook for deployment of ghost blog platform on EC2 or any other VM. It deploys docke containers on any VM host. Template for running EC2 instance is kidly provided by Andrian Cantril. Checkout his aws-cfn-snippets repository on GitHub.
- Connect to AWS web console
- Open EC2 service, go to -> Network/Security -> Key Pairs. Select .pem format for Mac/Linux computer. Use name ghost-admin and download to local machine
- Set permissions:
mv Downloads/ghost-admin.pem .ssh/
chmod 0600 .ssh/ghost-admin.pem
- Open CloudFormation service, go to Stacks -> Create stack
- Specify template -> Upload a template file - > Choose file
ec2instance.yml
- Provide ssh key
ghost-admin.pem
set name for the stackghost-ec2-instance
and follow the creation procedure - Enable CloudFormation creating an IAM resources
- When node will be created, check stack ghost-ec2-instance Outputs for the public IP addres and DNS name
- Test ssh connection:
ssh -i .ssh/ghost-admin.pem ubuntu@3.93.76.128
- Change directory:
cd ansible
- Add server IP and change variables to hosts inventory file
ansible/hosts
- Test host connectivity:
ansible all -i hosts -m ping
It should be no error at this point, otherwise go back and check avaliability of the instance!
- Install requirements for ansible playbook
ansible-galaxy install -g -r requirements.yml --force
ansible-playbook -i hosts playbook.yml
- Add Docker with Nginix and Lets Encryps for TLS encryption
- Use autogenerated random passwords for internal components
- Better backup strategy