Skip to content

Instantly share code, notes, and snippets.

@Twinuma
Created February 17, 2015 05:55
Show Gist options
  • Save Twinuma/39e18d86c56d1ea449a9 to your computer and use it in GitHub Desktop.
Save Twinuma/39e18d86c56d1ea449a9 to your computer and use it in GitHub Desktop.
ドットインストールで作成したAnsibleのplaybook.yml
---
- hosts: all
sudo: yes
tasks:
- name: add a new user
user: name=takayuki
- name: insdtall libselinux-python
yum: name=libselinux-python state=latest
- hosts: web
sudo: yes
tasks:
- name: install apache
yum: name=httpd state=latest
- name: start and enabled
service: name=httpd state=started enabled=yes
- name: change owner
file: dest=/var/www/html owner=vagrant recurse=yes
- name: copy index.html
copy: src=./index.html dest=/var/www/html/index.html owner=vagrant
- name: install php packages
yum: name={{item}} state=latest
with_items:
- php
- php-devel
- php-mbstring
- php-mysql
notify:
- restart apache
- name: copy hello.php
copy: src=./hello.php dest=/var/www/html/hello.php owner=vagrant
handlers:
- name: restart apache
service: name=httpd state=restarted
- hosts: db
sudo: yes
tasks:
- name: install mysql
yum: name={{item}} state=latest
with_items:
- mysql-server
- MySQL-python
- name: start mysql and enabled
service: name=mysqld state=started enabled=yes
- name: create database
mysql_db: name=mydb state=present
- name: create user for mydb
mysql_user: name=dbuser password=dbpassword priv=mydb.*:ALL state=present
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment