Last active
August 29, 2015 14:10
-
-
Save tsubakimoto/58f82400f052a1b3653e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```ruby | |
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "chef/centos-6.5" | |
config.vm.define "host" do |node| | |
node.vm.hostname = "host" | |
node.vm.network :private_network, ip: "192.168.56.200" | |
node.vm.provision "shell", inline: <<-EOT | |
yum update -y | |
wget https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
rpm -Uvh epel-release-6-8.noarch.rpm | |
yum install -y ansible | |
EOT | |
end | |
config.vm.define "web" do |node| | |
node.vm.hostname = "web" | |
node.vm.network :private_network, ip: "192.168.56.201" | |
end | |
end | |
``` |
~/hosts
[web]
192.168.56.201
~/ansible.cfg
[defaults]
hostfile = ./hosts
~/playbook.yml
---
- hosts: web
sudo: yes
tasks:
- name: system update
command: yum update
- name: install apache
yum: name=httpd state=latest
- name: start apache and enabled
service: name=httpd state=started enabled=yes
- name: change owner
file: dest=/var/www/html owner=vagrant recurse=yes
- name: install mysql
yum: name=mysql-server state=latest
- name: start mysql and enabled
service: name=mysqld state=started enabled=yes
- name: install libraries
yum: name={{item}} state=latest
with_items:
- gcc-c++.x86_64
- glib2-devel.x86_64
- cairo-devel.x86_64
- libpng-devel.x86_64
- giflib-devel.x86_64
- libjpeg-devel.x86_64
- libtiff-devel.x86_64
- libexif-devel.x86_64
- httpd-devel.x86_64
- bison.x86_64
- gettext.x86_64
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
~/.ssh/config