标签:http ar os sp for on 2014 log 代码
vagrant box add chef/centos-6.5
vagrant init chef/centos-6.5
config.vm.define :node1 do |node|
node.vm.box = “chef/centos-6.5”
node.vm.network :forwarded_port, guest: 22, host: 2001, id: “ssh”
node.vm.network :private_network, ip: “192.168.33.11”
endconfig.vm.define :node2 do |node|
node.vm.box = “chef/centos-6.5”
node.vm.network :forwarded_port, guest: 22 , host: 2002, id: “ssh”
node.vm.network :forwarded_port, guest: 80, host: 8000, id: “http”
node.vm.network :private_network, ip: “192.168.33.12”
end
% vagrant up
% vagrant ssh node1
Last login: Mon Jun 30 06:23:19 2014 from 10.0.2.2
[vagrant@vagrant-centos65 ~]$
% vagrant ssh-config node1 > ssh_config
% vagrant ssh-config node2 >> ssh_config
% scp -F ssh_config ~/.vagrant.d/insecure_private_key node1:.ssh/id_rsa
% vagrant ssh node1
[vagrant@vagrant-centos65 ~]$ sudo yum install ansible -y
这里需要你自行百度了。
新建一个hosts然后添加下面的代码 [test-server]
192.168.33.12
$ ansible test-server -i hosts -m ping
192.168.33.12 | success ? {
“changed”: false,
“ping”: “pong”
}
$ ansible test-server -i hosts -a "cat /etc/redhat-release"
192.168.33.12 | success | rc=0 ? {
CentOS release 6.5 (Final)
}
hosts: test-server
sudo: yes
tasks:name: be sure httpd is installed
yum: name=httpd state=installedname: be sure httpd is running and enabled
service: name=httpd state=running enabled=yes
$ ansible-playbook -i hosts simple.yml --list-tasks
$ ansible-playbook -i hosts simple.yml
% vagrant ssh node2
[vagrant@vagrant-centos65 ~]$ sudo service httpd status
httpd (pid 8552) is running...
全部了,比较简单,很多地方需要大家自行百度。
有兴趣可以研究一下。
最后吐槽一下,OSC这么流弊的码畜网站,为毛没有支持Github的markdown标准呢。。。
写起来好麻烦。
标签:http ar os sp for on 2014 log 代码
原文地址:http://my.oschina.net/songfei1983/blog/343863