Skip to content

Instantly share code, notes, and snippets.

@farmdawgnation
Created August 14, 2016 15:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save farmdawgnation/8dc540fc52f0cf5fcfef0cabf29870dc to your computer and use it in GitHub Desktop.
Save farmdawgnation/8dc540fc52f0cf5fcfef0cabf29870dc to your computer and use it in GitHub Desktop.
Ansible playbook for configuring my blog
---
- hosts: blog
tasks:
- name: Ensure ghost folder exists
file: path=/fdn/ghost owner=root group=root state=directory mode="u=rwx,g=rwx,o=rwx"
become: yes
become_method: sudo
- name: Ensure nginx folder exists
file: path=/fdn/nginx owner=root group=root state=directory
become: yes
become_method: sudo
- name: Ensure nginx.conf exists
template: src=nginx.conf.j2 dest=/fdn/nginx/nginx.conf
become: yes
- name: Copy SSL certificate
copy: src=fdnblog.crt dest=/fdn/nginx/fdnblog.crt
become: yes
- name: Copy SSL private key
copy: src=fdnblog.key dest=/fdn/nginx/fdnblog.key
become: yes
- name: Copy SSL password file
copy: src=fdnblog.passwd dest=/fdn/nginx/fdnblog.passwd
become: yes
- name: Ensure ghost.conf exists
template: src=config.js.j2 dest=/fdn/ghost/config.js owner=matt group=matt
become: yes
- name: Install pip
apt: name=python-pip state=present
become: yes
become_method: sudo
- name: Install docker python connector
pip: name=docker-py
become: yes
become_method: sudo
- name: Start ghost container
docker_container:
name: fdnghost
image: ghost:0.9
pull: true
state: started
restart: yes
restart_policy: always
volumes:
- "/fdn/ghost:/var/lib/ghost"
env:
NODE_ENV: production
- name: Let ghost get started
pause: seconds=5
- name: Start nginx container
docker_container:
name: fdnnginx
image: nginx:1.11.1
state: started
restart: yes
restart_policy: always
links:
- "fdnghost:ghost"
ports:
- "443:443"
- "80:80"
volumes:
- "/fdn/nginx:/etc/nginx:ro"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment