{"id":5094,"date":"2016-11-28T15:00:24","date_gmt":"2016-11-28T06:00:24","guid":{"rendered":"http:\/\/sitest.jp\/blog\/?p=5094"},"modified":"2017-04-06T20:43:15","modified_gmt":"2017-04-06T11:43:15","slug":"1%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%81%a7%e4%bd%9c%e3%81%a3%e3%81%9f%e3%80%82vagrant-ansible-%e3%81%ab%e3%82%88%e3%82%8b%e3%82%b3%e3%83%bc%e3%83%89%e3%81%ab%e3%82%88%e3%82%8b%e6%a7%8b%e6%88%90","status":"publish","type":"post","link":"https:\/\/sitest.jp\/blog\/?p=5094","title":{"rendered":"1\u30b3\u30de\u30f3\u30c9\u3067\u4f5c\u3063\u305f\u3002Vagrant + Ansible \u306b\u3088\u308b\u30b3\u30fc\u30c9\u306b\u3088\u308b\u69cb\u6210\u7ba1\u7406"},"content":{"rendered":"<p>\u6700\u8fd1\u306e\u958b\u767a\u73fe\u5834\u3067\u306f\u30b3\u30fc\u30c9\u306b\u3088\u308b\u69cb\u6210\u7ba1\u7406\u304c\u6ce8\u76ee\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\u4f55\u56de\u304b\u306b\u5206\u3051\u3066 Vagrant + Ansible + Docker \u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3001<br \/>\u6700\u7d42\u7684\u306b\u305f\u3063\u305f1\u30b3\u30de\u30f3\u30c9\u3067\u958b\u767a\u74b0\u5883\u3092\u4f5c\u308a\u4e0a\u3052\u3066\u3057\u307e\u3046\u4e8b\u3092\u30b4\u30fc\u30eb\u306b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u524d\u56de\u306e\u8a18\u4e8b\u3067\u306f Vagrant + ConoHa \u3067VPS\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<br \/>\u4eca\u56de\u306f <a href=\"https:\/\/www.ansible.com\/\" title=\"null\" rel=\"nofollow\" target=\"_blank\">Ansible<\/a> \u3092\u4f7f\u3063\u3066<a href=\"http:\/\/e-words.jp\/w\/LAMP.html\" title=\"null\" rel=\"nofollow\" target=\"_blank\">LAMP<\/a>\u74b0\u5883\u3092\u69cb\u7bc9\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">Ansible \u3068\u306f<\/h3>\n<\/div>\n<p><a href=\"https:\/\/www.ansible.com\/\" title=\"null\" rel=\"nofollow\" target=\"_blank\">Ansible<\/a> \u306f Red Hat\u793e\u304c\u516c\u958b\u3057\u3066\u3044\u308b\u69cb\u6210\u7ba1\u7406\u30c4\u30fc\u30eb\u306e\u4e00\u3064\u3067\u3059\u3002<br \/>\u3088\u308a\u6b63\u78ba\u306b\u306f\u3001\u30c7\u30d7\u30ed\u30a4\u30e1\u30f3\u30c8\u30c4\u30fc\u30eb\u3084\u30aa\u30fc\u30b1\u30b9\u30c8\u30ec\u30fc\u30b7\u30e7\u30f3\u30c4\u30fc\u30eb\u3092\u542b\u3081\u305f3\u3064\u306e\u5f79\u5272\u304c\u7d71\u5408\u3055\u308c\u305f\u3001\u5e45\u5e83\u3044\u4e8b\u304c\u884c\u3048\u308b\u30c4\u30fc\u30eb\u3067\u3059\u3002<br \/>\u30e1\u30ea\u30c3\u30c8\u306fSSH\u3068Yaml\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u306e\u3067\u7c21\u6f54\u306b\u7d20\u65e9\u304f\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u4f5c\u3063\u3066\u58ca\u3059\u4e8b\u304c\u7c21\u5358\u306b\u51fa\u6765\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>Ansible \u3092\u4f7f\u3046\u30e1\u30ea\u30c3\u30c8\u7b49\u306f\u4e0b\u8a18\u306e\u30b5\u30a4\u30c8\u3067\u7d39\u4ecb\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul style=\"margin-left: 20px;margin-bottom: 20px;font-size: 1.1em;\">\n<li style=\"list-style: disc;\"><a href=\"https:\/\/thinkit.co.jp\/article\/9445\" title=\"null\" rel=\"nofollow\" target=\"_blank\">\u69cb\u6210\u7ba1\u7406\u30c4\u30fc\u30eb\u3068\u3057\u3066Ansible\u3092\u9078\u3076\u3079\u304d\u7406\u7531 &#8211; Think IT<\/a><\/li>\n<li style=\"list-style: disc;\"><a href=\"http:\/\/qiita.com\/jp_taku2\/items\/02b5f609efe76666dda3\" title=\"null\" rel=\"nofollow\" target=\"_blank\">Chef\u3068Ansible\u306e\u500b\u4eba\u7684\u306a\u4f7f\u3044\u5206\u3051 &#8211; Qiita<\/a><\/li>\n<\/ul>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">Ansible + Vagrant \u306e\u53c2\u8003\u30b5\u30a4\u30c8<\/h3>\n<\/div>\n<p>\u4e0b\u8a18\u306e\u60c5\u5831\u3092\u5143\u306b\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<ul style=\"margin-left: 20px;margin-bottom: 20px;font-size: 1.1em;\">\n<li style=\"list-style: disc;\"><a href=\"http:\/\/yteraoka.github.io\/ansible-tutorial\/\" title=\"null\" rel=\"nofollow\" target=\"_blank\">Ansible\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb<\/a><\/li>\n<li style=\"list-style: disc;\"><a href=\"http:\/\/blog.shin1x1.com\/entry\/ansible_local-provisioner-in-vagrant\" title=\"null\" rel=\"nofollow\" target=\"_blank\">Vagrant + Ansible \u3067\u958b\u767a\u74b0\u5883\u3092\u4f5c\u308b\u306a\u3089 ansible_local \u30d7\u30ed\u30d3\u30b8\u30e7\u30ca\u304c\u3044\u3044\uff01 &#8211; Shin x Blog<\/a><\/li>\n<li style=\"list-style: disc;\"><a href=\"http:\/\/qiita.com\/ozawan\/items\/a4853eb62afef45f5de7\" title=\"null\" rel=\"nofollow\" target=\"_blank\">Windows\u4e0a\u3067ansible_local\u30d7\u30ed\u30d3\u30b8\u30e7\u30ca\u30fc\u3092\u4f7f\u3063\u3066\u307f\u305f &#8211; Qiita<\/a><\/li>\n<li style=\"list-style: disc;\"><a href=\"http:\/\/knowledge.sakura.ad.jp\/tech\/3084\/\" title=\"null\" rel=\"nofollow\" target=\"_blank\">\u5b9f\u8df5\uff01Ansible\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\uff08\u524d\u7de8\uff09 &#8211; \u3055\u304f\u3089\u306e\u30ca\u30ec\u30c3\u30b8<\/a><\/li>\n<\/ul>\n<p>LAMP\u306f\u4e0b\u8a18\u30da\u30fc\u30b8\u3092\u53c2\u8003\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul style=\"margin-left: 20px;margin-bottom: 20px;font-size: 1.1em;\">\n<li style=\"list-style: disc;\"><a href=\"http:\/\/qiita.com\/suppy193\/items\/84153ce3c70deb89c37a\" title=\"null\" rel=\"nofollow\" target=\"_blank\">Ubuntu 16.04 LTS \u65e5\u672c\u8a9e Remix \u3067LAMP\u306a\u3069 &#8211; Qiita<\/a><\/li>\n<\/ul>\n<p>\u306a\u304a\u3001\u751f\u6210\u7269\u306fGitHub\u3067\u516c\u958b\u3057\u307e\u3057\u305f\u3002<br \/>\u305d\u3061\u3089\u3082\u5408\u308f\u305b\u3066\u53c2\u7167\u3057\u3066\u3044\u305f\u3060\u304f\u3068\u3001\u3088\u308a\u7406\u89e3\u304c\u9032\u307f\u3084\u3059\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<br \/><a href=\"https:\/\/github.com\/m-ohata\/conoha-lamp\" title=\"null\" rel=\"nofollow\" target=\"_blank\">m-ohata\/conoha-lamp &#8211; GitHub<\/a><\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210<\/h3>\n<\/div>\n<p>\u307e\u305a\u306f Ansible \u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u8003\u616e\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u9020\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\u4f7f\u7528\u3059\u308b\u6642\u306fdefault\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4e38\u3054\u3068\u30b3\u30d4\u30fc\u3057\u305f\u5225\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u30d5\u30a9\u30eb\u30c0\u5185\u3067\u5404\u7a2evagrant\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u60f3\u5b9a\u3067\u3059\u3002<\/p>\n<pre><code class=\"lang-bash\">$ tree\n.\n\u251c\u2500\u2500 default\n\u2502   \u2514\u2500\u2500 Vagrantfile\n\u2514\u2500\u2500 provision\n    \u251c\u2500\u2500 hosts\n    \u251c\u2500\u2500 roles\n    \u2502   \u2514\u2500\u2500 [role]\n    \u2502       \u251c\u2500\u2500 defaults\n    \u2502       \u251c\u2500\u2500 files\n    \u2502       \u251c\u2500\u2500 handlers\n    \u2502       \u251c\u2500\u2500 meta\n    \u2502       \u251c\u2500\u2500 tasks\n    \u2502       \u2502   \u251c\u2500\u2500 task1.yml\n    \u2502       \u2502   \u251c\u2500\u2500 task2.yml\n    \u2502       \u2502   \u2514\u2500\u2500 main.yml\n    \u2502       \u251c\u2500\u2500 templates\n    \u2502       \u2514\u2500\u2500 vars\n    \u251c\u2500\u2500 top-level-playbook1.yml\n    \u251c\u2500\u2500 top-level-playbook2.yml\n    \u2514\u2500\u2500 site.yml\n<\/code><\/pre>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">Vagrantfile<\/h3>\n<\/div>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306eVagrantfile\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>Ansible\u306b\u95a2\u3059\u308b\u8a18\u8ff0\u306f42\u884c\u76ee\u304b\u3089\u306e\u4e00\u9023\u306e\u584a\u3067\u3059\u3002<\/p>\n<pre><code class=\"lang-bash\">  # provision\n  config.vm.synced_folder &quot;..\/provision\/&quot;, &quot;\/tmp\/provision&quot;\n  config.vm.provision :ansible_local do |ansible|\n    ansible.limit = &quot;all&quot;\n    ansible.playbook = &quot;\/tmp\/provision\/site.yml&quot;\n    ansible.inventory_path = &quot;\/tmp\/provision\/hosts&quot;\n  end\n<\/code><\/pre>\n<p>Vagrantfile\u306e\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304b\u3089\u4e00\u968e\u5c64\u9061\u3063\u305f\u6240\u306b\u3042\u308bprovision\u30d5\u30a9\u30eb\u30c0\u3092<br \/>ConoHa\u306e\u4eee\u60f3\u30de\u30b7\u30f3\u5185\u306e\u300c\/tmp\/provision\u300d\u3068\u540c\u671f\u3055\u305b\u3066\u3044\u307e\u3059\u3002<br \/>\u3053\u308c\u306b\u3088\u308a\u30d7\u30ed\u30d3\u30b8\u30e7\u30f3\u5b9f\u884c\u6642\u306b\u300c\/tmp\/provision\u300d\u306e\u914d\u4e0b\u304b\u3089Ansible\u306e\u5404\u7a2e\u30d5\u30a1\u30a4\u30eb\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30d3\u30b8\u30e7\u30f3\u306f\u4eee\u60f3\u30de\u30b7\u30f3\u304c\u8d77\u52d5\u3057\u305f\u5f8c\u3067\u3082\u300cvagrant provision\u300d\u30b3\u30de\u30f3\u30c9\u3067\u4f55\u5ea6\u3067\u3082\u5b9f\u884c\u51fa\u6765\u307e\u3059\u306e\u3067\u3001\u307e\u305a\u306f\u4eee\u60f3\u30de\u30b7\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"lang-bash\">$ cp -R default test-lamp\n\n$ cd test-lamp\n\n$ vim Vagrantfile\n\/\/ \u30d7\u30ed\u30d3\u30b8\u30e7\u30f3\u306e\u884c\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\n\n$ vagrant up\n<\/code><\/pre>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u30ed\u30fc\u30eb\u306e\u4f5c\u6210<\/h3>\n<\/div>\n<p>provision\/roles\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u914d\u4e0b\u306b\u30ed\u30fc\u30eb\u3068\u540c\u3058\u6570\u3060\u3051\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\u4eca\u56de\u306fLAMP\u30b5\u30fc\u30d0\u30fc\u3092\u69cb\u7bc9\u3059\u308b\u70ba\u306b\u4e0b\u8a18\u306e3\u3064\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<ul style=\"margin-left: 20px;margin-bottom: 20px;font-size: 1.1em;\">\n<li style=\"list-style: disc;\">web: Apache + PHP<\/li>\n<li style=\"list-style: disc;\">database: MySQL<\/li>\n<li style=\"list-style: disc;\">common: \u5171\u901a(Git\u7b49)<\/li>\n<\/ul>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u30d7\u30ec\u30a4\u30d6\u30c3\u30af\u306e\u4f5c\u6210<\/h3>\n<\/div>\n<p>site.yml \u3068\u540c\u968e\u5c64\u306b\u30c8\u30c3\u30d7\u30ec\u30d9\u30eb\u306ePlaybook\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\u672c\u756a\u74b0\u5883\u3067Web\u30b5\u30fc\u30d0\u30fc\u3068DB\u30b5\u30fc\u30d0\u30fc\u306b\u5206\u3051\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u60f3\u5b9a\u3067\u3001\u4e0b\u8a18\u306e2\u3064\u306e\u30d7\u30ec\u30a4\u30d6\u30c3\u30af\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<ul style=\"margin-left: 20px;margin-bottom: 20px;font-size: 1.1em;\">\n<li style=\"list-style: disc;\">web.yml<\/li>\n<li style=\"list-style: disc;\">database.yml<\/li>\n<\/ul>\n<pre><code class=\"lang-bash\">$ cat provision\/site.yml\n---\n- include: stand-alone.yml\n- include: web.yml\n- include: database.yml\n\n$ cat provision\/web.yml\n---\n- hosts: web\n  connection: local\n  become: yes\n  roles:\n    - common\n    - web\n\n$ cat provision\/database.yml\n---\n- hosts: database\n  connection: local\n  become: yes\n  roles:\n    - common\n    - database\n<\/code><\/pre>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u30bf\u30b9\u30af\u306e\u4f5c\u6210<\/h3>\n<\/div>\n<p>\u65e9\u901fApache\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u5229\u7528\u3059\u308b\u30a4\u30e1\u30fc\u30b8\u306fUbuntu\u306a\u306e\u3067\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u7ba1\u7406\u306eApt\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<br \/><a href=\"http:\/\/qiita.com\/suppy193\/items\/84153ce3c70deb89c37a\" title=\"null\" rel=\"nofollow\" target=\"_blank\">Ubuntu 16.04 LTS \u65e5\u672c\u8a9e Remix \u3067LAMP\u306a\u3069 &#8211; Qiita<\/a>\u306e\u8a18\u4e8b\u306b\u3088\u308b\u3068\u3001<br \/>\u300capt-get install apache2\u300d\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u51fa\u6765\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>Playbook\u306b\u300cshell: apt-get install apache2 -y\u300d\u7b49\u3068\u8a18\u8ff0\u3057\u3066\u3082\u826f\u3044\u306e\u3067\u3059\u304c\u3001<br \/>Ansible\u3067\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u51aa\u7b49\u6027\u3092\u4fdd\u3064\u4e8b\u304c\u5bb9\u6613\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>Ansible\u516c\u5f0f\u30b5\u30a4\u30c8\u306eDocumentation\u5185\u306e<a href=\"http:\/\/docs.ansible.com\/ansible\/list_of_packaging_modules.html\" title=\"null\" rel=\"nofollow\" target=\"_blank\">Packaging Modules<\/a>\u304b\u3089Apt\u306e\u30da\u30fc\u30b8\u3092\u3092\u63a2\u3057\u307e\u3059\u3002<br \/><a href=\"http:\/\/docs.ansible.com\/ansible\/apt_module.html\" title=\"null\" rel=\"nofollow\" target=\"_blank\">apt &#8211; Manages apt-packages<\/a>\u306b\u3042\u308a\u307e\u3057\u305f\u3002<br \/>\u30da\u30fc\u30b8\u306f\u5168\u3066\u82f1\u8a9e\u3067\u3059\u304c\u3001Examples\u3068Options\u3092\u4ea4\u4e92\u306b\u898b\u306a\u304c\u3089\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"lang-bash\">$ cat provision\/roles\/web\/tasks\/apache.yml\n---\n- name: be sure apache2 installed\n  apt:\n    name: apache2\n    force: yes\n    update_cache: yes\n  tags: apache\n\n$ cat provision\/roles\/web\/tasks\/main.yml\n---\n- include: apache.yml \/\/ \u30bf\u30b9\u30af\u3092\u8ffd\u52a0\u3057\u305f\u306e\u3067main.yml\u306b\u53cd\u6620\n\n$ cd test-lamp\n\n$ vagrant provision\n\/\/ apache2\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u7b87\u6240\u306e\u307f\u8a18\u8f09\u3057\u307e\u3059\u3002\nTASK [web : be sure apache2 installed] **************\nchanged: [localhost]\n\n$ vagrant ssh-config | grep HostName\n  HostName 150.95.135.203 \/\/ VPS\u306eIP\u30a2\u30c9\u30ec\u30b9\u3092\u78ba\u8a8d\n\n$ curl 150.95.135.203\n\/\/ \u6587\u672b\u307e\u3067\u7701\u7565...\n    &lt;\/div&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n<p>\u898b\u4e8bWeb\u30b5\u30fc\u30d0\u30fc\u304c\u7acb\u3061\u4e0a\u304c\u308a\u307e\u3057\u305f\u306d\u3002<br \/>\u30d6\u30e9\u30a6\u30b6\u3092\u958b\u3044\u3066IP\u30a2\u30c9\u30ec\u30b9\u3092\u6253\u3061\u8fbc\u3080\u3068Apache\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u30da\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u540c\u69d8\u306bPHP\u3001MySQL\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<br \/>PHP\u306fphp, php-mysql, livapache2-mod-php\u306e3\u30d1\u30c3\u30b1\u30fc\u30b8\u3001<br \/>MySQL\u306fmysql-server\u306e1\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u5fc5\u8981\u306a\u3088\u3046\u3067\u3059\u3002<\/p>\n<pre><code class=\"lang-bash\">$ cat provision\/roles\/web\/tasks\/php.yml\n---\n- name: be sure php(in LAMP) installed\n  apt:\n    name: &quot;{{item}}&quot;\n    force: yes\n    update_cache: yes\n  with_items:\n    - php\n    - php-mysql\n    - libapache2-mod-php\n  tags: php\n\n$ cat provision\/roles\/database\/tasks\/mysql.yml\n---\n- name: be sure mysql installed\n  apt:\n    name: mysql-server\n    force: yes\n    update_cache: yes\n  tags: mysql\n\n\/\/ main.yml\u306b\u3082\u5fd8\u308c\u305a\u8ffd\u8a18\u3057\u307e\u3059\u3002\n$ cat provision\/roles\/web\/tasks\/main.yml\n---\n- include: apache.yml\n- include: php.yml # a new record!\n\n$ cat provision\/roles\/database\/tasks\/mysql.yml\n---\n- include: mysql.yml # a new record!\n\n$ cd test-lamp\n\n$ vagrant provision\nTASK [web : be sure php(in LAMP) installed] ************************************\nchanged: [localhost] =&gt; (item=[u&#39;php&#39;, u&#39;php-mysql&#39;, u&#39;libapache2-mod-php&#39;])\n\nTASK [database : be sure mysql installed] **************************************\nchanged: [localhost]\n<\/code><\/pre>\n<p>\u4eee\u60f3\u30de\u30b7\u30f3\u5185\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3066<br \/>PHP\u3068MySQL\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u78ba\u8a8d\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre><code class=\"lang-bash\">$ vagrant ssh\n\n# echo &#39;&lt;?= 1 + 2 ?&gt;&#39; &gt; \/var\/www\/html\/test.php\n\n# curl localhost\/test.php\n3\n\n# mysql -uroot\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 3\nServer version: 5.7.15-0ubuntu0.16.04.1 (Ubuntu)\n<\/code><\/pre>\n<p>\u3069\u3061\u3089\u3082\u52d5\u4f5c\u3057\u307e\u3057\u305f\u3002<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u901a\u3057\u3067\u5b9f\u884c<\/h3>\n<\/div>\n<p>\u4e00\u901a\u308a\u7d0d\u5f97\u51fa\u6765\u308b\u30bf\u30b9\u30af\u304c\u4f5c\u6210\u3067\u304d\u305f\u3089\u3001\u4e00\u5ea6\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u524a\u9664\u3057\u3066\u304b\u3089\u3082\u3046\u4e00\u5ea6\u7acb\u3061\u4e0a\u3052\u306a\u304a\u3057\u3066\u78ba\u8a8d\u3057\u307e\u3059\u3002<br \/>halt\u304b\u3089destroy\u306f\u53cd\u6620\u3055\u308c\u308b\u307e\u3067\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059\u306e\u3067\u3001ConoHa\u306e\u7ba1\u7406\u753b\u9762\u3067\u4f5c\u696d\u7d42\u4e86\u3092\u78ba\u8a8d\u3057\u306a\u304c\u3089\u5b9f\u884c\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"lang-bash\">$ vagrant halt\n\n$ vagrant destroy\n\n$ vagrant up\nBringing machine &#39;default&#39; up with &#39;conoha&#39; provider...\n==&gt; default: Finding flavor for server...\n==&gt; default: Finding image for server...\n==&gt; default: Launching a server with the following settings...\n==&gt; default:  -- Tenant          : gnctxxxx\n==&gt; default:  -- Name            : default\n==&gt; default:  -- Flavor          : g-1gb\n==&gt; default:  -- FlavorRef       : 7eea7469-0d85-4f82-8050-6ae742394681\n==&gt; default:  -- Image           : vmi-ubuntu-16.04-amd64\n==&gt; default:  -- ImageRef        : 69878388-9e45-483e-854d-72b06b9e5dd9\n==&gt; default:  -- KeyPair         : xxxxx\n==&gt; default: Waiting for the server to be built...\n==&gt; default: Waiting for machine to boot. This may take a few minutes...\n    default: SSH address: 133.xxx.xxx.31\n    default: SSH username: root\n    default: SSH auth method: private key\n    default: Warning: Connection refused. Retrying...\n    default: Warning: Remote connection disconnect. Retrying...\n==&gt; default: Machine booted and ready!\n==&gt; default: Rsyncing folder: \/Users\/xxxx\/conoha-lamp\/provision\/ =&gt; \/tmp\/provision\n==&gt; default: Rsyncing folder: \/Users\/xxxx\/conoha-lamp\/test-run\/ =&gt; \/vagrant\n==&gt; default: Running provisioner: ansible_local...\n    default: Installing Ansible...\nAn unknown error happened in Vagrant ConoHa plugin\n<\/code><\/pre>\n<p>vagrant up\u30b3\u30de\u30f3\u30c9\u306e\u521d\u56de\u306f\u30d7\u30ed\u30d3\u30b8\u30e7\u30f3\u3082\u5b9f\u884c\u3055\u308c\u307e\u3059\u304c\u3001<br \/>\u521d\u56de\u306eAnsible\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u3066\u505c\u6b62\u3057\u3066\u3057\u307e\u3046\u3088\u3046\u3067\u3059\u3002<br \/>Ansible\u81ea\u4f53\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u306f\u6210\u529f\u3057\u3066\u3044\u308b\u3088\u3046\u306a\u306e\u3067\u3001\u6c17\u306b\u305b\u305a\u3082\u3046\u4e00\u5ea6vagrant provision\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"lang-bash\">$ vagrant provision\n==&gt; default: Rsyncing folder: \/Users\/xxxx\/conoha-lamp\/provision\/ =&gt; \/tmp\/provision\n==&gt; default: Rsyncing folder: \/Users\/xxxx\/conoha-lamp\/test-run\/ =&gt; \/vagrant\n==&gt; default: Running provisioner: ansible_local...\n    default: Running ansible-playbook...\nmesg: ttyname failed: Inappropriate ioctl for device\n\nTASK [setup] *******************************************************************\nok: [localhost]\n\n... \u4e2d\u7565 ...\n\nPLAY RECAP *********************************************************************\nlocalhost                  : ok=19   changed=7    unreachable=0    failed=0\n<\/code><\/pre>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5f8c\u306e\u52d5\u4f5c\u78ba\u8a8d<\/h3>\n<\/div>\n<p>Web\u30b5\u30fc\u30d0\u30fc(Apache + PHP)\u304c\u610f\u56f3\u901a\u308a\u306b\u52d5\u4f5c\u3059\u308b\u4e8b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<br \/>\u4e00\u5ea6\u5bfe\u8c61\u306e\u30de\u30b7\u30f3\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u30b7\u30f3\u30d7\u30eb\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u8a2d\u7f6e\u3057\u3066\u304b\u3089\u3001<br \/>\u305d\u306eURL\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u8a2d\u7f6e\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u304cPHP\u3067\u8a55\u4fa1\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<br \/>(\u30db\u30b9\u30c8\u30de\u30b7\u30f3\u3068\u4eee\u60f3\u30de\u30b7\u30f3\u3092\u898b\u5206\u3051\u308b\u70ba\u3001\u30db\u30b9\u30c8\u30de\u30b7\u30f3\u3067\u306f$\u3001\u4eee\u60f3\u30de\u30b7\u30f3\u3067\u306f#\u3092\u30b3\u30de\u30f3\u30c9\u306e\u5148\u982d\u306b\u4ed8\u5e2f\u3057\u307e\u3057\u305f)<\/p>\n<pre><code class=\"lang-bash\">$ vagrant ssh\n\n# cd \/var\/www\/html\n\n# echo &#39;&lt;?= 1 + 2 ?&gt;&#39; &gt; index.php\n\n# exit\n\n$ vagrant ssh-config\nHost default\n  HostName 133.xxx.xxx.31\n  User root\n  Port 22\n  UserKnownHostsFile \/dev\/null\n  StrictHostKeyChecking no\n  PasswordAuthentication no\n  IdentityFile \/Users\/xxxx\/.ssh\/id_rsa\n  IdentitiesOnly yes\n  LogLevel FATAL\n\n$ curl 133.xxx.xxx.31\n3\n<\/code><\/pre>\n<p>\u5f15\u304d\u7d9a\u304dMySQL\u30b5\u30fc\u30d0\u30fc\u306e\u52d5\u4f5c\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<br \/>\u30b5\u30fc\u30d0\u30fc\u5185\u304b\u3089mysql\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u52d5\u4f5c\u3059\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<pre><code class=\"lang-bash\">$ vagrant ssh\n\n# mysql\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 3\nServer version: 5.7.15-0ubuntu0.16.04.1 (Ubuntu)\n\nCopyright (c) 2000, 2016, Oracle and\/or its affiliates. All rights reserved.\n\nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nType &#39;help;&#39; or &#39;\\h&#39; for help. Type &#39;\\c&#39; to clear the current input statement.\n\nmysql&gt;\n<\/code><\/pre>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u304a\u307e\u3051\uff1a\u30d5\u30a1\u30a4\u30eb\u5171\u6709<\/h3>\n<\/div>\n<p>Vagrant \u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u7528\u610f\u3055\u308c\u3066\u3044\u308b Rsync \u306f\u901f\u5ea6\u3084\u540c\u671f\u304c\u4e0d\u5341\u5206\u3067\u3001 \u4fee\u6b63\u3057\u305f\u5185\u5bb9\u3092\u3059\u3050\u306b\u78ba\u8a8d\u3059\u308b\u4e8b\u304c\u51fa\u6765\u307e\u305b\u3093\u3002<br \/>VPS\u306b\u76f4\u63a5\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3001Vim\u3084Emacs\u7b49\u306e\u30a8\u30c7\u30a3\u30bf\u30fc\u3067\u958b\u767a\u3057\u3066\u3044\u308b\u65b9\u306b\u3068\u3063\u3066\u306f\u554f\u984c\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001<br \/>\u30ed\u30fc\u30ab\u30eb\u30de\u30b7\u30f3\u3067IDE\u3084\u30a8\u30c7\u30a3\u30bf\u30fc\u3092\u4f7f\u3063\u3066\u958b\u767a\u3057\u3066\u3044\u308b\u65b9\u306b\u306f\u969c\u5bb3\u3068\u306a\u308a\u3048\u307e\u3059\u3002<\/p>\n<p>\u8a66\u884c\u932f\u8aa4\u3059\u308b\u3068vagrant-gatling-rsync\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u4f7f\u7528\u51fa\u6765\u305f\u306e\u3067\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<ul style=\"margin-left: 20px;margin-bottom: 20px;font-size: 1.1em;\">\n<li style=\"list-style: disc;\"><a href=\"https:\/\/github.com\/smerrill\/vagrant-gatling-rsync\" title=\"null\" rel=\"nofollow\" target=\"_blank\">vagrant-gatling-rsync &#8211; GitHub<\/a><\/li>\n<li style=\"list-style: disc;\"><a href=\"http:\/\/qiita.com\/ozw_sei\/items\/1be0d565fd966d8506c3\" title=\"null\" rel=\"nofollow\" target=\"_blank\">Vagrant\u4e0a\u306eRsync\u3092\u9ad8\u901f\u306b\u884c\u3048\u308b\u30d7\u30e9\u30b0\u30a4\u30f3\u300cVagrant-gatling-rsync\u300d\u3092\u4f7f\u3063\u3066\u307f\u305f &#8211; Qiita<\/a><\/li>\n<\/ul>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u5b9f\u969b\u306b\u5c0e\u5165\u3057\u3066\u307f\u3066\u306e\u611f\u60f3<\/h3>\n<\/div>\n<p>\u7d50\u5c40 yum \u3084 apt-get \u7b49\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u7ba1\u7406\u3092\u64cd\u4f5c\u3057\u3066\u3044\u308b\u4e8b\u306f\u5909\u308f\u308a\u307e\u305b\u3093\u3002<br \/>OS\u3084\u30c7\u30a3\u30b9\u30c8\u30ea\u30d3\u30e5\u30fc\u30b7\u30e7\u30f3\u3092\u8de8\u3044\u3060\u308a\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u4e0a\u304c\u3063\u305f\u308a\u3059\u308b\u5ea6\u306b\u4f5c\u308a\u76f4\u3057\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\u3053\u306e\u8fba\u306e\u4e8b\u60c5\u304c\u3042\u308a\u3001\u6b8b\u5ff5\u306a\u304c\u3089\u5168\u3066\u306e\u624b\u9593\u304c\u306a\u304f\u306a\u308b\u9280\u306e\u5f3e\u4e38\u3068\u306f\u7a0b\u9060\u3044\u5370\u8c61\u3092\u53d7\u3051\u307e\u3057\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u4e00\u5ea6Ansible\u306e\u3084\u308a\u65b9\u3092\u899a\u3048\u3066\u3057\u307e\u3048\u3070Playbook\u306e\u7ba1\u7406\u306b\u96c6\u4e2d\u51fa\u6765\u308b\u306e\u3067\u3001<br \/>\u51aa\u7b49\u6027\u3092\u4fdd\u3061\u3064\u3064\u65b0\u3057\u3044\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5c0e\u5165\u3057\u305f\u308a\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5897\u3084\u3057\u305f\u308a\u6e1b\u3089\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3068\u3066\u3082\u697d\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u307e\u3068\u3081<\/h3>\n<\/div>\n<p>\u3044\u304b\u304c\u3067\u3057\u305f\u3067\u3057\u3087\u3046\u304b\u3002<br \/>\u30bf\u30a4\u30c8\u30eb\u901a\u308a1\u30b3\u30de\u30f3\u30c9\u3068\u306f\u884c\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001<br \/>\u304b\u306a\u308a\u305d\u308c\u306b\u8fd1\u3044\u30ec\u30d9\u30eb\u306e\u4e8b\u304c\u5b9f\u73fe\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u306e\u3084\u308a\u65b9\u3092\u4f7f\u3048\u3070\u3001\u65b0\u3057\u304f\u30b8\u30e7\u30a4\u30f3\u3057\u305f\u30e1\u30f3\u30d0\u30fc\u306b\u306f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u4ee3\u308f\u308a\u306b\u5171\u6709\u3067\u304d\u307e\u3059\u3057\u3001<br \/>Git\u306e\u30d6\u30e9\u30f3\u30c1\u3092\u5207\u308b\u304f\u3089\u3044\u306e\u6c17\u8efd\u3055\u3067\u30b5\u30fc\u30d0\u30fc\u3092\u7acb\u3061\u4e0a\u3052\u3089\u308c\u307e\u3059\u3002<br \/>master\u30d6\u30e9\u30f3\u30c1\u306b\u8a72\u5f53\u3059\u308b\u4eee\u60f3\u30de\u30b7\u30f3\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u51fa\u6765\u308bPlaybook\u3068\u3057\u3066\u7528\u610f\u3057\u3066\u304a\u3051\u3070\u3001\u4e0d\u5177\u5408\u304c\u51fa\u305f\u6642\u306e\u691c\u8a3c\u3082\u683c\u6bb5\u306b\u697d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u6b21\u56de\u3067\u306f\u66f4\u306b\u3001Docker\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u4eca\u6642\u306e\u74b0\u5883\u3092\u69cb\u7bc9\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\u4ee5\u4e0a\u3001\u300c1\u30b3\u30de\u30f3\u30c9\u3067\u4f5c\u3063\u305f\u3002Vagrant + Ansible \u306b\u3088\u308b\u30b3\u30fc\u30c9\u306b\u3088\u308b\u69cb\u6210\u7ba1\u7406\u300d\u3067\u3057\u305f\u3002<br \/>\u6700\u5f8c\u307e\u3067\u8aad\u3093\u3067\u3044\u305f\u3060\u304d\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u306e\u958b\u767a\u73fe\u5834\u3067\u306f\u30b3\u30fc\u30c9\u306b\u3088\u308b\u69cb\u6210\u7ba1\u7406\u304c\u6ce8\u76ee\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u4f55\u56de\u304b\u306b\u5206\u3051\u3066 Vagrant + Ansible + Docker \u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3001\u6700\u7d42\u7684\u306b\u305f\u3063\u305f1\u30b3\u30de\u30f3\u30c9\u3067\u958b\u767a\u74b0\u5883\u3092\u4f5c\u308a\u4e0a\u3052\u3066\u3057\u307e\u3046\u4e8b\u3092\u30b4\u30fc\u30eb\u306b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002 \u524d\u56de\u306e\u8a18\u4e8b\u3067\u306f Vagrant + ConoHa \u3067VPS\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002\u4eca\u56de\u306f Ansible \u3092\u4f7f\u3063\u3066LAMP\u74b0\u5883\u3092\u69cb\u7bc9\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":5096,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[27],"tags":[],"acf":false,"_links":{"self":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/5094"}],"collection":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/comments?post=5094"}],"version-history":[{"count":5,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/5094\/revisions"}],"predecessor-version":[{"id":9522,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/5094\/revisions\/9522"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/media\/5096"}],"wp:attachment":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/media?parent=5094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/categories?post=5094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/tags?post=5094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}