This repository was archived by the owner on May 7, 2024. It is now read-only.
-
Couldn't load subscription status.
- Fork 347
Add playbooks #98
Open
xtao
wants to merge
1
commit into
douban:master
Choose a base branch
from
xtao:ansible
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add playbooks #98
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ansible-playbook -i playbooks/nodes -s playbooks/site.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| if [ ! -f $HOME/.ssh/id_rsa.pub ]; then | ||
| ssh-keygen | ||
| fi | ||
|
|
||
| DEFAULT_SSH_PUBKEY=`cat $HOME/.ssh/id_rsa.pub` | ||
|
|
||
| if [ ! -d $HOME/.ssh ]; then | ||
| mkdir -p $HOME/.ssh | ||
| fi | ||
|
|
||
| chmod 0700 $HOME/.ssh | ||
| echo $DEFAULT_SSH_PUBKEY >> $HOME/.ssh/authorized_keys | ||
| chmod 0600 $HOME/.ssh/authorized_keys | ||
|
|
||
| sudo apt-get install ansible | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [all] | ||
| localhost |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| - name: Start beansdb | ||
| command: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| - name: Check if beansdb exists | ||
| stat: path=/usr/local/bin/beansdb | ||
| register: beansdb_bin | ||
|
|
||
| - name: Clone beansdb repo | ||
| git: repo=https://github.com/douban/beansdb dest=/tmp/beansdb version=master | ||
| when: beansdb_bin.stat.exists == false | ||
|
|
||
| - name: Install beansdb | ||
| command: ./autogen.sh && ./configure && make && make install | ||
| when: beansdb_bin.stat.exists == false | ||
| args: | ||
| chdir: /tmp/beansdb | ||
|
|
||
| - name: Create /data/beansdb | ||
| file: path=/data/beansdb state=directory mode=0755 | ||
|
|
||
| - name: Create /etc/beansdb | ||
| file: path=/etc/beansdb state=directory mode=0755 | ||
|
|
||
| - name: Copy log config | ||
| copy: src=/tmp/beansdb/beansdb_log.conf dest=/etc/beansdb/log.conf | ||
|
|
||
| - name: Start beansdb | ||
| command: beansdb -p 7900 -H /data/beansdb -T 0 -d -L /etc/beansdb/log.conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| - name: Install build-essential | ||
| apt: pkg=build-essential state=installed | ||
|
|
||
| - name: Install dh-autoreconf | ||
| apt: pkg=dh-autoreconf state=installed | ||
|
|
||
| - name: Install g++ | ||
| apt: pkg=g++ state=installed | ||
|
|
||
| - name: Install git | ||
| apt: pkg=git state=installed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| - name: Install memcached | ||
| apt: pkg=memcached state=installed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| - name: Install MySQL Client | ||
| apt: pkg=mysql-client state=installed | ||
|
|
||
| - name: Install MySQL Server | ||
| apt: pkg=mysql-server state=installed | ||
|
|
||
| - name: Install MySQL lib | ||
| apt: pkg=libmysqlclient-dev state=installed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| - name: Install redis | ||
| apt: pkg=redis-server state=installed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # should install first | ||
| - name: check virtualenv | ||
| stat: path=/vagrant/venv | ||
| register: venv_bin | ||
|
|
||
| - name: create virualenv | ||
| command: virtualenv venv | ||
| when: venv_bin.stat.exists == false | ||
| args: | ||
| chdir: /vagrant | ||
|
|
||
| - name: Install python pip | ||
| apt: pkg=python-pip state=installed | ||
|
|
||
| - name: Install python virtualenv | ||
| apt: pkg=python-virtualenv state=installed | ||
|
|
||
| - name: Install python dev | ||
| apt: pkg=python-dev state=installed | ||
|
|
||
| - name: Install libffi | ||
| apt: pkg=libffi-dev state=installed | ||
|
|
||
| - pip: name=cython virtualenv=/vagrant/venv | ||
| - pip: name=setuptools virtualenv=/vagrant/venv | ||
| - pip: requirements=/vagrant/requirements.txt virtualenv=/vagrant/venv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
|
|
||
| - name: Setup CODE dev env | ||
| hosts: | ||
| - all | ||
| roles: | ||
| - common | ||
| - mysql | ||
| - beansdb | ||
| - redis | ||
| - memcached | ||
| - web |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这一部分的内容 在 https://docs.vagrantup.com/v2/boxes/base.html 的
DEFAULT USER SETTINGS创建box的时候就已经做过了. 还需要加么?