mirror of
https://github.com/krislamo/pup-tests
synced 2024-11-10 01:00:35 +00:00
WordPress Installs
Sets up a very basic WordPress website on the puppet agent.
This commit is contained in:
parent
7f818e3c31
commit
e5a0d84b20
3
Vagrantfile
vendored
3
Vagrantfile
vendored
@ -19,7 +19,8 @@ Vagrant.configure("2") do |config|
|
||||
end
|
||||
|
||||
# Sync Puppet code to Puppet Master
|
||||
master.vm.synced_folder "./code", "/etc/puppet/code"
|
||||
master.vm.synced_folder "./code", "/etc/puppet/code", type: "rsync",
|
||||
rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
|
||||
|
||||
end
|
||||
|
||||
|
17
code/environments/production/Puppetfile
Normal file
17
code/environments/production/Puppetfile
Normal file
@ -0,0 +1,17 @@
|
||||
forge "http://forge.puppetlabs.com"
|
||||
|
||||
# Custom
|
||||
mod 'wordpress', local: true
|
||||
|
||||
# Forge Mods
|
||||
mod 'puppetlabs-apache', '4.0.0' # Supported
|
||||
mod 'puppetlabs-stdlib', '5.1.0'
|
||||
mod 'puppetlabs-concat', '5.2.0'
|
||||
|
||||
mod 'puppet-php', '6.0.2' # Approved
|
||||
|
||||
mod 'puppetlabs-mysql', '7.0.0' # Supported
|
||||
mod 'puppetlabs-translate', '1.2.0'
|
||||
|
||||
mod 'puppet-archive', '3.2.1' # Approved
|
||||
|
@ -1,3 +1,4 @@
|
||||
node 'webserver' {
|
||||
notify { 'Hello Puppet!': }
|
||||
include wordpress
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,58 @@
|
||||
class wordpress {
|
||||
|
||||
# Install webserver
|
||||
class { 'apache':
|
||||
default_vhost => false,
|
||||
mpm_module => 'prefork'
|
||||
}
|
||||
|
||||
# Enable PHP support
|
||||
class { 'apache::mod::php': }
|
||||
|
||||
# Install database server
|
||||
class { '::mysql::server': }
|
||||
|
||||
# Install PHP's MySQL module
|
||||
package { 'php-mysql':
|
||||
ensure => present,
|
||||
notify => Service['apache2']
|
||||
}
|
||||
|
||||
# Create database
|
||||
mysql::db { 'wordpress':
|
||||
user => 'wordpress_user',
|
||||
password => 'Password1',
|
||||
host => 'localhost',
|
||||
grant => ['ALL', 'GRANT']
|
||||
}
|
||||
|
||||
file { '/var/www/wordpress/':
|
||||
ensure => directory
|
||||
}
|
||||
|
||||
file { '/var/www/wordpress/public_html/wp-config.php':
|
||||
ensure => file,
|
||||
content => template('wordpress/wp-config.php.epp')
|
||||
}
|
||||
|
||||
# Deploy WordPress code
|
||||
archive { '/tmp/wordpress-5.0.3.tar.gz':
|
||||
ensure => present,
|
||||
extract => true,
|
||||
extract_command => 'tar xfz %s --strip-components=1',
|
||||
extract_path => '/var/www/wordpress/public_html',
|
||||
source => 'https://wordpress.org/wordpress-5.0.3.tar.gz',
|
||||
checksum => 'f9a4b482288b5be7a71e9f3dc9b5b0c1f881102b',
|
||||
checksum_type => 'sha1',
|
||||
creates => '/var/www/wordpress/public_html/index.php',
|
||||
cleanup => true
|
||||
}
|
||||
|
||||
apache::vhost { 'www.example.com':
|
||||
port => 80,
|
||||
docroot => '/var/www/wordpress/public_html',
|
||||
notify => Service['apache2']
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
// ** MySQL settings - You can get this info from your web host ** //
|
||||
/** The name of the database for WordPress */
|
||||
define('DB_NAME', 'wordpress');
|
||||
|
||||
/** MySQL database username */
|
||||
define('DB_USER', 'wordpress_user');
|
||||
|
||||
/** MySQL database password */
|
||||
define('DB_PASSWORD', 'Password1');
|
||||
|
||||
/** MySQL hostname */
|
||||
define('DB_HOST', 'localhost');
|
||||
|
||||
/** Database Charset to use in creating database tables. */
|
||||
define('DB_CHARSET', 'utf8mb4');
|
||||
|
||||
/** The Database Collate type. Don't change this if in doubt. */
|
||||
define('DB_COLLATE', '');
|
||||
|
||||
/** Authentication Unique Keys and Salts. */
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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');
|
||||
|
@ -22,5 +22,4 @@
|
||||
register: send_csr
|
||||
failed_when: send_csr.rc > 1
|
||||
when: agent_install.changed
|
||||
become_user: vagrant
|
||||
|
||||
|
@ -10,6 +10,16 @@
|
||||
service: name=ntp state=restarted
|
||||
when: ntp_status.changed
|
||||
|
||||
- name: Install R10K
|
||||
apt: name=r10k state=present
|
||||
register: r10k_install
|
||||
|
||||
- name: Install Puppet Modules
|
||||
shell:
|
||||
cmd: r10k puppetfile install
|
||||
chdir: /etc/puppet/code/environments/production
|
||||
when: r10k_install.changed
|
||||
|
||||
- name: Wait for Webserver Key
|
||||
wait_for:
|
||||
path: /var/lib/puppet/ssl/ca/requests/webserver.pem
|
||||
|
Loading…
Reference in New Issue
Block a user