Skip to content

Commit

Permalink
Adding new server skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
marktheunissen committed Aug 22, 2012
1 parent 1e5fb1f commit 65ae76e
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 10 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ steps for setting it up on Ubuntu and immediately configuring it to use
localhost as the target server, the simplest configuration option:

sudo aptitude -y install git python-jinja2 python-yaml python-paramiko python-software-properties
add-apt-repository -y ppa:rquillo/ansible/ubuntu
add-apt-repository ppa:rquillo/ansible/ubuntu
aptitude update
aptitude install ansible
echo "localhost" > /etc/ansible/hosts
Expand All @@ -37,8 +37,9 @@ You can now test by typing:

You should see:

127.0.0.1 | success >> {
"ping": "pong"
localhost | success >> {
"module": "ping",
"ping": "pong
}

### Run the play
Expand Down
2 changes: 1 addition & 1 deletion ubuntu-10.04-lamp-dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ need using:

ansible-playbook -c local --tags="common,..." ./setup.yml

Packages tagged 'common': Apache, MySQL, PHP.
Packages tagged `common`: Apache, MySQL, PHP.

Other optional tags:

Expand Down
11 changes: 11 additions & 0 deletions ubuntu-10.04-lamp-dev/files/etc-update-motd-d-95-ansible
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

echo
echo " ********************************************************"
echo " * This server is configured using Ansible."
echo " * To change configuration, modify the playbooks vars in"
echo " * /root/server-playbooks, and re-run the play."
echo " * "
echo " * See https://github.com/fourkitchens/server-playbooks"
echo " ********************************************************"
echo
4 changes: 4 additions & 0 deletions ubuntu-10.04-lamp-dev/run-local-all
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

# Script for running the play on the localhost, everything included.
ansible-playbook -c local --tags="common" ./setup.yml
52 changes: 52 additions & 0 deletions ubuntu-10.04-lamp-dev/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
##
# Ansible playbook for setting up a LAMP development server on Ubuntu 10.04.
#

---
- hosts: all
user: root

vars_files:
- settings.yml

tasks:
##
# Apt package installation of required software.
#
- name: Install required packages.
action: apt pkg=$item state=installed
tags: common
with_items:
- php5
- apache2
- mysql-server
- mysql-client
- php5-mysql
- php5-xmlrpc
- php-soap
- php5-gd
- sendmail
- unzip
- python-mysqldb

##
# Message of the day explaining server is under Ansible control.
#
- name: Message of the day explaining server is under Ansible control.
action: copy src=files/etc-update-motd-d-95-ansible dest=/etc/update-motd.d/95-ansible mode=755
tags: common

##
# Restart services
#
- name: Restart Apache
action: service name=apache2 state=restarted
tags: common

- name: Restart MySQL
action: service name=mysql state=restarted
tags: common

- name: Restart vsftpd
action: service name=vsftpd state=restarted
tags: ftp
30 changes: 30 additions & 0 deletions ubuntu-10.04-lamp-dev/vars/default-settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Settings that are applied to the templates. This file should be copied to
# the base folder of the play and renamed settings.yml, then modified to suit
# your needs.

---
# Hostname is important as we need to delete an anonymous MySQL
# user that is created with this name, make sure you match this
# up with the output of the command 'hostname' on the server.
server_hostname: 'example'

# php.ini
php_max_execution_time: '90'
php_display_errors: 'On'
php_display_startup_errors: 'On'
php_html_errors: 'On'
php_post_max_size: '32M'
php_upload_max_filesize: '32M'
php_date_timezone: 'US/Central'

# my.cnf
mysql_max_allowed_packet: '128M'
mysql_character_set_server: 'utf8'
mysql_collation_server: 'utf8_general_ci'

# mysql
mysql_root_password: 'password'

# apache
apache_server_admin: '[email protected]'
apache_server_alias: '*.*.example.com'
2 changes: 1 addition & 1 deletion ubuntu-12.04-lamp-dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ And access each of the sites by going to URLs formatted as follows:
http:https://username.project2.example.com/
http:https://username.project3.example.com/

Packages tagged 'common': Apache, MySQL, APC cache, PHP.
Packages tagged `common`: Apache, MySQL, APC cache, PHP.

Other optional tags:

Expand Down
10 changes: 6 additions & 4 deletions ubuntu-12.04-lamp-dev/files/etc-update-motd-d-95-ansible
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/sh

echo
echo " ******************************************************"
echo " ********************************************************"
echo " * This server is configured using Ansible."
echo " * To change configuration, modify the playbooks in"
echo " * /root/server-playbooks, and re-run them."
echo " ******************************************************"
echo " * To change configuration, modify the playbooks vars in"
echo " * /root/server-playbooks, and re-run the play."
echo " * "
echo " * See https://github.com/fourkitchens/server-playbooks"
echo " ********************************************************"
echo
2 changes: 1 addition & 1 deletion ubuntu-12.04-lamp-dev/vars/default-settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
---
# Hostname is important as we need to delete an anonymous MySQL
# user that is created with this name, make sure you match this
# up.
# up with the output of the command 'hostname' on the server.
server_hostname: 'example.com'

# php.ini
Expand Down

0 comments on commit 65ae76e

Please sign in to comment.