|
--- |
|
- hosts: kbpattern |
|
tasks: |
|
- name: Add repo php5 to get lastest php |
|
# To get previous version, replace with php5-oldstable or for new use php5 |
|
apt_repository: repo='ppa:ondrej/php5-oldstable' update_cache=yes |
|
|
|
- name: Install apache2,php5,php5-common,git,mysql,curl |
|
apt: pkg={{ item }} state=present update_cache=yes |
|
with_items: |
|
- apache2 |
|
- php5 |
|
- php5-common |
|
- php5-tidy |
|
- php5-mcrypt |
|
- php5-mysql |
|
- php5-curl |
|
- php5-cli |
|
- git |
|
- mysql-server |
|
- curl |
|
- python-mysqldb # required for mysql commands below |
|
|
|
- name: http service state |
|
service: name=apache2 state=started enabled=yes |
|
|
|
- name: Start Mysql Service |
|
service: name=mysql state=started enabled=true |
|
|
|
# install composer |
|
- name: install composer |
|
shell: curl -sS https://getcomposer.org/installer | php creates=/usr/local/bin/composer |
|
tags: composer |
|
|
|
- name: rename composer.phar to composer |
|
shell: mv composer.phar /usr/local/bin/composer creates=/usr/local/bin/composer |
|
tags: composer |
|
|
|
- name: make composer executable |
|
shell: chmod a+x /usr/local/bin/composer |
|
tags: composer |
|
|
|
# Create a new db with 'kbpattern' as name |
|
- name: make kbpattern database |
|
mysql_db: name=kb-pattern state=present |
|
# copy file over and restore it, create kbpattern user for access |
|
- name: copy sql file |
|
copy: src=../data/current-backup.sql dest=/tmp |
|
- name: update kbpattern database |
|
mysql_db: name=kb-pattern state=import target=/tmp/current-backup.sql |
|
# - name: Create Application DB User |
|
# mysql_user: name=kbpattern password=kbpattern priv=*.*:ALL host='%' state=present |
|
|
|
# copy config file over to www path |
|
- name: Copying configuration file over from source |
|
shell: cp /var/www/model/config.php.example /var/www/model/config.php |
|
|
|
# Downloads and installs all the libs and dependencies outlined in the /var/www/composer.lock |
|
- name: Install libs and dependencies |
|
command: composer install |
|
args: |
|
chdir: /var/www/ |