Ansibleã§ã¨ããããã®LAMPç°å¢ãã¦ã¿ã
VagrantとAnsibleでCentOSの環境を用意してみる
ã®ç¶ã
Ansibleã§ã¨ããããã®LAMPç°å¢ãã¦ã¿ãã
ä¸è¨ãã¤ã³ã¹ãã¼ã«ãããã¬ã¤ããã¯ãä½æããã
ã»Apacheï¼DocumentRootã¯/vagrantã«å¤æ´ï¼
ã»PHP
ã»MySQL5.6
ã»phpMyAdmin
$ vi playbook.yml
--- - hosts: 127.0.0.1 connection: local sudo: yes vars: mysql_user_name: vagrant mysql_user_password: vagrant tasks: # # Apache # - name: Apacheãã¤ã³ã¹ãã¼ã« yum: name=httpd - name: Apacheãèµ·å service: name=httpd state=started enabled=yes - name: DocumentRootã/vagrantã«å¤æ´ replace: dest=/etc/httpd/conf/httpd.conf regexp='DocumentRoot "/var/www/html"' replace='DocumentRoot "/vagrant"' notify: - restart httpd - name: .htaccessãæå¹ã«ãã replace: dest=/etc/httpd/conf/httpd.conf regexp='AllowOverride None' replace='AllowOverride All' notify: - restart httpd # # PHP # - name: PHPãã¤ã³ã¹ãã¼ã« yum: name={{item}} with_items: - php - php-mbstring - php-mysql - name: PHPãã¿ã¤ã ã¾ã¼ã³ã®è¨å® replace: > dest=/etc/php.ini regexp="^;date\.timezone =" replace="date.timezone = Asia/Tokyo" # # MySQL5.6 # - name: MySQL5.6ã®ãªãã¸ããªã追å command: > yum -y install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm creates=/etc/yum.repos.d/mysql-community.repo - name: MySQLãã¤ã³ã¹ãã¼ã« yum: name={{item}} with_items: - mysql-server - MySQL-python - name: MySQLãèµ·å service: name=mysqld state=started enabled=yes - name: MySQLã®ã¦ã¼ã¶ã¼ã追å mysql_user: name={{ mysql_user_name }} password={{ mysql_user_password }} priv=*.*:ALL # # phpMyAdmin # - name: phpMyAdminã®ã¤ã³ã¹ãã¼ã« yum: name=phpMyAdmin enablerepo=epel - name: ã¢ã¯ã»ã¹æ¨©éã®å¤æ´ replace: > dest=/etc/httpd/conf.d/phpMyAdmin.conf regexp=" Deny from All" replace=" #Deny from All" notify: - restart httpd handlers: - name: restart httpd service: name=httpd state=restarted
ãã¬ã¤ããã¯ãå®è¡ããã
$ ansible-playbook playbook.yml