This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Added WordPress support

  • Loading branch information...
BR0kEN- committed Nov 17, 2015
1 parent b8e90c8 commit 775863771ed15aed10774877615f6fa6e8ca63b5
@@ -8,6 +8,7 @@
!roles/
!scripts/
!vagrant/
!repository/

!ansible.sh
!config.yml
@@ -0,0 +1,35 @@
---
- hosts: localhost
gather_facts: yes
connection: local
sudo: yes

vars_files:
- ../config.yml
- vars/main.yml

tasks:
- include_vars: "vars/environments/{{ env }}.yml"
- include: tasks/database/remove.yml

- name: Create config
template:
src: templates/wp-config.j2
dest: ../docroot/wp-config.php

- include: tasks/database/create.yml

- include: tasks/wp-cli/core-install.yml
when: not sql_workflow

# Download and import databases.
- include: tasks/database/import.yml
when: sql_workflow

# Unique way for both workflows.
- include: tasks/super-admin.yml

# Enable/disable configured plugins.
- include: tasks/wp-cli/plugins.yml

- include: tasks/wp-cli/commands.yml
@@ -0,0 +1,4 @@
---
- name: Set password for super-admin
shell: "cd ../docroot && wp user update 1 --user_login={{ wordpress.user.name }} --user_pass={{ wordpress.user.pass }} --allow-root"
environment: env_vars
@@ -0,0 +1,5 @@
---
- name: Execute WP CLI commands
shell: "cd ../docroot && wp {{ item.key }} {{ item.value }} --allow-root"
environment: env_vars
with_dict: commands
@@ -0,0 +1,2 @@
---
- shell: "cd ../docroot && wp core install --title=WP --admin_email=email@example.com --url={{ site_url }} --admin_user={{ wordpress.user.name }} --admin_password={{ wordpress.user.pass }} --allow-root"
@@ -0,0 +1,6 @@
---
- name: Managing plugins
shell: "cd ../docroot && wp plugin {{ item.key }} {{ item.value | join(' ') }} --activate --allow-root"
environment: env_vars
when: item.value | length
with_dict: plugins
@@ -0,0 +1,89 @@
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://codex.wordpress.org/Editing_wp-config.php
*
* @package WordPress
*/

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', '{{ databases.default }}');

/** MySQL database username */
define('DB_USER', '{{ mysql.user }}');

/** MySQL database password */
define('DB_PASSWORD', '{{ mysql.pass }}');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', '{{ databases.default | password_hash('sha512') }}');
define('SECURE_AUTH_KEY', '{{ databases.default | password_hash('sha512') }}');
define('LOGGED_IN_KEY', '{{ databases.default | password_hash('sha512') }}');
define('NONCE_KEY', '{{ databases.default | password_hash('sha512') }}');
define('AUTH_SALT', '{{ databases.default | password_hash('sha512') }}');
define('SECURE_AUTH_SALT', '{{ databases.default | password_hash('sha512') }}');
define('LOGGED_IN_SALT', '{{ databases.default | password_hash('sha512') }}');
define('NONCE_SALT', '{{ databases.default | password_hash('sha512') }}');

/**#@-*/

/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';

/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the Codex.
*
* @link https://codex.wordpress.org/Debugging_in_WordPress
*/
define('WP_DEBUG', false);

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
@@ -0,0 +1,13 @@
---
plugins:
install:
- propeople-google-news-sitemap
uninstall: []

commands:
theme: "status"

wordpress:
user:
name: admin
pass: propeople
@@ -0,0 +1,11 @@
---
plugins:
install: []
uninstall: []

commands: {}

wordpress:
user:
name: admin
pass: propeople
@@ -14,7 +14,7 @@ mysql:
pass: root

databases:
default: "{{ build_id | default(env) }}_drupal"
default: "{{ build_id | default(env) }}_{{ cmf }}"

# URL to the source database. Can be overridden by CI server.
# @todo
@@ -124,7 +124,10 @@
tags: ["composer", "php-stack"]

- role: cibox-composer-drush
tags: ["composer", "php-stack", "drush"]
tags: ["drush", "composer", "php-stack"]

- role: cibox-wp-cli
tags: ["wp-cli", "php-stack"]

- role: ansible-role-mysql
tags: ["mysql", "php-stack", "ansible-role-mysql"]
@@ -31,7 +31,7 @@

- name: CMF is not available
fail:
msg: "You are not allowed to install {{ cmf | major }} {{ version }} because it isn't pre-configured."
msg: "You are not allowed to install {{ cmf | capitalize }} {{ version }} because it isn't pre-configured."
when: not cmf_configs.stat.exists

- name: Downloading CMF
@@ -62,6 +62,9 @@
- src: "../scripts/"
dest: "provisioning"

- src: "../repository/"
dest: "scripts"

- name: Clear created repository
file:
path: "../{{ project }}/{{ item }}"
@@ -84,5 +87,5 @@
- name: Set name of the project to config.yml
lineinfile:
dest: "../{{ project }}/config.yml"
line: "project: {{ project }}\nsite_url: http://{{ project }}.dev"
line: "project: {{ project }}\nsite_url: http://{{ project }}.dev\ncmf: {{ cmf }}"
insertafter: "^---$"
@@ -0,0 +1,2 @@
---
wp_cli_url: https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
@@ -0,0 +1,6 @@
---
- name: Downloading WP CLI
get_url:
url: "{{ wp_cli_url }}"
dest: /usr/local/bin/wp
mode: +x

0 comments on commit 7758637

Please sign in to comment.