Skip to content

Instantly share code, notes, and snippets.

@huhushow
Created December 18, 2015 06:31
Show Gist options
  • Select an option

  • Save huhushow/678700528d0e303d40c2 to your computer and use it in GitHub Desktop.

Select an option

Save huhushow/678700528d0e303d40c2 to your computer and use it in GitHub Desktop.
basic ansible playbook installing php on centos
---
- hosts: webservers
sudo: yes
tasks:
- name: yum update
action: yum name=* state=latest
- name: yum install epel
yum: name=epel-release.noarch state=latest
- name: download remi repo rpm
get_url: url=http://rpms.famillecollet.com/enterprise/remi-release-7.rpm dest=/root/
- name: install remi repo rpm
yum: name=/root/remi-release-7.rpm state=present
- name: install php
yum: enablerepo=remi,remi-php56 name=php-mssql,php-pear,php,php-pdo,php-pecl-redis,php-xml,php-pecl-zip,php-pecl-jsonc,php-pecl-igbinary,httpd,httpd-tools,php-mbstring state=latest
- name: install rsync
yum: name=rsync state=latest
- name: change web root permission
sudo: yes
file: path=/var/www group=apache mode=0770 state=directory
- name: change web root permission
sudo: yes
file: path=/var/www/html group=apache mode=0770 state=directory
- name: change user permission
sudo: yes
user: name=myuser groups=apache
- name: change php ini
ini_file: dest=/etc/php.ini
section=Date
option=date.timezone
value=Etc/UTC
ini_file: dest=/etc/php.ini
section=PHP
option=error_reporting
value='E_ALL & ~E_NOTICE'
ini_file: dest=/etc/php.ini
section=PHP
option=short_open_tag
value=On
- name: remove blank
replace: dest=/etc/freetds.conf.bak
backup=yes
regexp='^[\s\t]+(?=[\S])'
- name: change freetds conf
ini_file: dest=/etc/freetds.conf.bak
section=global
option="tds version"
value=8.0
- name: enable httpd
service: name=httpd enabled=yes state=started
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment