|
# |
|
# dev_install.yml |
|
# Github Gist: https://gist.github.com/klenwell/9860685 |
|
# |
|
# Clones wikka from github, install locally, and configures to test fresh install. |
|
# |
|
# WARNING |
|
# This is designed to create a temporary directory that will be rebuilt each time |
|
# this script is run. Make sure you settings are safe and won't delete anything |
|
# important. (They shouldn't by default.) |
|
# |
|
# USAGE |
|
# ansible-playbook -v -i .dev/deploy/dev .dev/deploy/dev_install.yml --connection=local |
|
# |
|
# BEFORE YOU RUN THIS: |
|
# 1. You need an inventory file at the path specified in -i option. Find an example |
|
# here: https://gist.github.com/klenwell/9860685#file-dev |
|
# |
|
# 2. You need a wikka.config.php template file for wikka.src.config. Find an |
|
# example here: https://gist.github.com/klenwell/9860685#file-wikka-config-php-install-j2 |
|
# |
|
# 3. Find the PLAYBOOK VARS section below and put in the correct settings. Also set |
|
# user at top of playbook. |
|
# |
|
# 4. You need to install Python mysqldb module. On Debian/Ubuntu, you can install |
|
# with pip. (See http://stackoverflow.com/q/5178292/1093087): |
|
# |
|
# $ sudo apt-get install libmysqlclient-dev |
|
# $ sudo pip install mysql-python |
|
# |
|
|
|
# |
|
# The Playbook! |
|
# |
|
- name: Configure wikka to test fresh install |
|
sudo: no |
|
hosts: locally |
|
gather_facts: false |
|
user: LOCAL_USER |
|
|
|
# |
|
# PLAYBOOK VARS |
|
# |
|
vars: |
|
wikka: |
|
install: |
|
dir: wikka-tmp-install |
|
db_name: wikka_tmp_install |
|
src: |
|
config: local/wikka.config.php-install.j2 |
|
|
|
database: |
|
user: MYSQL_USER |
|
pass: MYSQL_PASS |
|
|
|
github: |
|
repo: https://github.com/klenwell/WikkaWiki.git |
|
branch: x1D5dQDA-refactor-install-process |
|
|
|
|
|
tasks: |
|
- name: Clear existing project dir |
|
file: |
|
path=/tmp/{{ wikka.install.dir }} |
|
state=absent |
|
|
|
- name: Clone github repository |
|
git: |
|
repo={{ github.repo }} |
|
dest=/tmp/{{ wikka.install.dir }} |
|
version={{ github.branch }} |
|
|
|
- name: Delete and recreate empty test database |
|
mysql_db: |
|
db={{ wikka.install.db_name }} |
|
state=absent |
|
login_user={{ database.user }} |
|
login_password={{ database.pass }} |
|
|
|
- mysql_db: |
|
db={{ wikka.install.db_name }} |
|
state=present |
|
login_user={{ database.user }} |
|
login_password={{ database.pass }} |
|
|
|
- name: Create initial config file from scratch |
|
template: |
|
src={{ wikka.src.config }} |
|
dest=/tmp/{{ wikka.install.dir }}/wikka.config.php |
|
|
|
- name: Link directory to /var/www |
|
file: |
|
src=/tmp/{{ wikka.install.dir }} |
|
path=/var/www/{{ wikka.install.dir }} |
|
state=link |
|
|
|
- name: Cleanup |
|
debug: 'msg="Setup complete. In your browser, go to http://localhost/{{ wikka.install.dir }}"' |
Simple Ansible playbook to clone Wikka locally from my Githhub repository and quickly install.