25
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Nginx, PHP-FPM, PHP, MySQLをAnsibleでインストール

Posted at

ここでの手順書をansibleで書いてみる
http://qiita.com/oikyn/items/92567d13e73988908aae

setup.yml

- hosts: web-server
  remote_user: vagrant
  sudo: yes
  gather_facts: no

  tasks:
    - name: install nginx rpm
      yum: name=http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm state=present

    - name: install nginx
      yum: name=nginx state=present

    - name: restart nginx
      service: name=nginx state=restarted

    - name: chkconfig nginx
      command: chkconfig nginx on

    - name: install php-fpm
      yum: name=php-fpm state=latest

    - name: apply php-fpm.conf
      template: src=./php-fpm.conf.tpl dest=/etc/php-fpm.d/www.conf backup=yes

    - name: restart php-fpm
      service: name=php-fpm state=restarted

    - name: chkconfig php-fpm
      command: chkconfig php-fpm on

    - name: install php rpm
      yum: name=http://rpms.famillecollet.com/enterprise/remi-release-6.rpm state=present

    - name: install php
      yum: pkg={{item}} enablerepo=remi,remi-php56 state=present
      with_items:
        - php
        - php-devel
        - php-common
        - php-gd
        - php-mbstring
        - php-mysql
        - php-pdo
        - php-pear
        - php-xml

    - name: install mysql rpm
      yum: pkg={{item}} state=present
      with_items:
        - http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-compat-5.6.23-1.el6.x86_64.rpm
        - http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-5.6.23-1.el6.x86_64.rpm
        - http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-server-5.6.23-1.el6.x86_64.rpm
        - http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-client-5.6.23-1.el6.x86_64.rpm
        - http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-devel-5.6.23-1.el6.x86_64.rpm

    - name: install mysql
      yum: pkg={{item}} state=present
      with_items:
        - MySQL-client.x86_64
        - MySQL-devel.x86_64
        - MySQL-server.x86_64
        - MySQL-shared-compat.x86_64
        - MySQL-shared.x86_64

    - name: chkconfig mysql
      command: chkconfig mysql on

    - name: restart mysql
      service: name=mysql state=restarted

↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

$ ansible-playbook -i servers setup.yml -k -K
 [WARNING]: The version of gmp you have installed has a known issue regarding
timing vulnerabilities when used with pycrypto. If possible, you should update
it (i.e. yum update gmp).

SSH password:
sudo password [defaults to SSH password]:

PLAY [web-server] *************************************************************

GATHERING FACTS ***************************************************************
ok: [192.168.33.20]

TASK: [install nginx rpm] *****************************************************
ok: [192.168.33.20]

TASK: [install nginx] *********************************************************
ok: [192.168.33.20]

TASK: [restart nginx] *********************************************************
changed: [192.168.33.20]

TASK: [chkconfig nginx] *******************************************************
changed: [192.168.33.20]

TASK: [install php-fpm] *******************************************************
ok: [192.168.33.20]

TASK: [apply php-fpm.conf] ****************************************************
ok: [192.168.33.20]

TASK: [restart php-fpm] *******************************************************
changed: [192.168.33.20]

TASK: [chkconfig php-fpm] *****************************************************
changed: [192.168.33.20]

TASK: [install php rpm] *******************************************************
ok: [192.168.33.20]

TASK: [install php] ***********************************************************
ok: [192.168.33.20] => (item=php,php-devel,php-common,php-gd,php-mbstring,php-mysql,php-pdo,php-pear,php-xml)

TASK: [install mysql rpm] *****************************************************
ok: [192.168.33.20] => (item=http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-compat-5.6.23-1.el6.x86_64.rpm,http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-5.6.23-1.el6.x86_64.rpm,http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-server-5.6.23-1.el6.x86_64.rpm,http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-client-5.6.23-1.el6.x86_64.rpm,http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-devel-5.6.23-1.el6.x86_64.rpm)

TASK: [install mysql] *********************************************************
ok: [192.168.33.20] => (item=MySQL-client.x86_64,MySQL-devel.x86_64,MySQL-server.x86_64,MySQL-shared-compat.x86_64,MySQL-shared.x86_64)

TASK: [chkconfig mysql] *******************************************************
changed: [192.168.33.20]

TASK: [restart mysql] *********************************************************
changed: [192.168.33.20]

PLAY RECAP ********************************************************************
192.168.33.20              : ok=15   changed=6    unreachable=0    failed=0

25
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?