Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ghost Playbook
---
- hosts: ghost
become: true
tasks:
# setup nginx and firewall
- name: Install nginx
apt:
name: nginx
state: latest
update_cache: yes
- name: delete default site-available
file:
state: absent
path: /etc/nginx/sites-available/default
- name: disable default site-available
file:
state: absent
path: /etc/nginx/sites-enabled/default
# install and setup mysql with ghost db and user
- name: Install mysql
apt:
name: '{{ item }}'
state: latest
with_items:
- mysql-server
- python-mysqldb
- name: update mysql root password for all root accounts
mysql_user:
name: root
host: '{{ item }}'
password: password
state: present
with_items:
- "{{ ansible_hostname }}"
- 127.0.0.1
- ::1
- localhost
- name: copy .my.cnf file with root password credentials (so its immutable)
template:
src: 'templates/.my.cnf'
dest: '/root/.my.cnf'
owner: root
mode: 0600
- name: ensure anonymous users are not in the database
mysql_user:
name: ''
host: '{{ item }}'
state: absent
with_items:
- localhost
- $inventory_hostname
- name: remove the test database
mysql_db:
name: test
state: absent
# install node
- name: add nodesource keys
become: yes
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present
- name: add nodesource apt sources
apt_repository:
repo: '{{ item }}'
state: present
with_items:
- 'deb https://deb.nodesource.com/node_6.x xenial main'
- 'deb-src https://deb.nodesource.com/node_6.x xenial main'
- name: install node
apt:
name: 'node'
state: latest
update_cache: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment