Skip to content

Instantly share code, notes, and snippets.

@keisei1092
Last active November 20, 2022 11:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keisei1092/1abaedbe81365e97026d to your computer and use it in GitHub Desktop.
Save keisei1092/1abaedbe81365e97026d to your computer and use it in GitHub Desktop.
Ansibleの(とりあえずCakePHPとMySQLのsecure_installation以外) https://gist.github.com/keisei1092/621f2b122eb957040b05 これも必要
# playbook.yml
---
- hosts: all
sudo: true
user: vagrant
tasks:
- name: Vimをインストールする
yum: name=vim state=present
- name: zshをインストールする
yum: name=zsh state=present
- name: zsh のプラグイン oh-my-zsh をインストールする
git: repo=https://github.com/robbyrussell/oh-my-zsh.git dest=/home/vagrant/.oh-my-zsh
- name: .zshrc を作る (あとですげかえてね!)
template: src=zshrc.in dest=/home/vagrant/zshrc_please_rename_this_to_.zshrc owner=vagrant
- name: zsh をデフォルトシェルにする
user: name=vagrant shell=/bin/zsh
- name: Apacheをインストールする
yum: name=httpd state=present
- name: Apacheを環境始動時に自動で起動するようにする
action: service name=httpd state=started enabled=yes
- name: phpをインストールする
yum: name={{item}} enablerepo=epel state=present
with_items:
- php
- phpMyAdmin
- php-mbstring
- php-mysql
- php-mcrypt
- name: Composerをインストールする
shell: >
curl -sS https://getcomposer.org/installer | php && mv composer.phar composer
chdir=/usr/local/bin
creates=/usr/local/bin/composer
- name: MySQLのパッケージをダウンロードする
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: 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: MySQLを環境始動時に自動で起動するようにする
action: service name=mysql state=started enabled=yes
- name: Apacheを再起動する
action: service name=httpd state=restarted
@matsurai25
Copy link

TASK: [.zshrc を作る(conf/zshrc にある)] ****************************
fatal: [192.168.33.10] => {'msg': 'AnsibleError: unable to read {{作業フォルダ}}/zshrc.in', 'failed': True}

FATAL: all hosts have already failed -- aborting

でエラるのだけど、playbookのtemplate見る限りローカルにファイル必要なのではと思ったのだけど、
zshrc.inはどうすればよい?

@matsurai25
Copy link

TASK: [.zshrc を作る(conf/zshrc にある)] ****************************
failed: [192.168.33.10] => {"failed": true}
msg: Destination directory /home/vagrant/conf does not exist

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************

とりあえず手動で$ mkdir /home/vagrant/confして進めました〜

@keisei1092
Copy link
Author

すまない

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment