Last active
June 18, 2016 05:48
-
-
Save tbuchi888/03f2dccdd7726770cb0522260141ca41 to your computer and use it in GitHub Desktop.
`pyenv`をインストール設定するAnsible playbook ref: http://qiita.com/tbuchi888/items/d44d15dcc6f63ae440d9
This file contains 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure(2) do |config| | |
# Every Vagrant development environment requires a box. You can search for | |
# boxes at https://atlas.hashicorp.com/search. | |
# Please replace it with a BOX name of CentOS6 for one's own 32bit when your host is 32bit machine. | |
config.vm.box = "geerlingguy/centos6" | |
# Add ansible provisioner | |
config.vm.provision "ansible" do |ansible| | |
ansible.playbook = "site.yml" | |
end | |
end |
This file contains 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
$ansible --version | |
ansible 2.1.0 (devel c600ab81ee) last updated 2016/04/20 11:11:25 (GMT +900) | |
lib/ansible/modules/core: (detached HEAD 98322a777f) last updated 2016/04/20 11:11:54 (GMT +900) | |
lib/ansible/modules/extras: (detached HEAD 1aecfc1e19) last updated 2016/04/20 11:11:55 (GMT +900) | |
config file = | |
configured module search path = Default w/o overrides |
This file contains 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
--- | |
- hosts: all | |
gather_facts: no | |
become: yes | |
vars: | |
python_ver: 2.7.8 | |
tasks: | |
- name: which pyenv | |
shell: source ~/.bash_profile; which pyenv | |
register: pyenv_install | |
failed_when: pyenv_install.rc == 0 | |
- debug: var=pyenv_install | |
- block: | |
- debug: msg="---------- block start ----------" | |
- name: yum install with_items | |
yum: | |
name: '{{ item.name }}' | |
state: latest | |
register: RESULT | |
with_items: | |
- name: gcc | |
- name: gcc-c++ | |
- name: make | |
- name: git | |
- name: openssl-devel | |
- name: bzip2-devel | |
- name: zlib-devel | |
- name: readline-devel | |
- name: sqlite-devel | |
- name: bzip2 | |
- name: sqlite | |
- name: patch | |
- name: results | |
debug: var=RESULT.results | |
- name: git clone pyenv , pyenv-virtualenv | |
git: | |
repo: '{{ item.repo }}' | |
dest: '{{ item.dest }}' | |
register: RESULT | |
with_items: | |
- repo: git://github.com/yyuu/pyenv.git | |
dest: ~/.pyenv | |
- repo: git://github.com/yyuu/pyenv-virtualenv.git | |
dest: ~/.pyenv/plugins/pyenv-virtualenv | |
- name: results | |
debug: var=RESULT.results | |
- name: "install pyenv and python ver.{{ python_ver }}" | |
shell: '{{ item.cmd }}' | |
register: RESULT | |
with_items: | |
- cmd: echo 'export PYENV_ROOT="${HOME}/.pyenv"' >> ~/.bash_profile | |
- cmd: echo 'if [ -d "${PYENV_ROOT}" ]; then' >> ~/.bash_profile | |
- cmd: echo ' export PATH=${PYENV_ROOT}/bin:$PATH' >> ~/.bash_profile | |
- cmd: echo ' eval "$(pyenv init -)"' >> ~/.bash_profile | |
- cmd: echo 'fi' >> ~/.bash_profile | |
- cmd: source ~/.bash_profile; pyenv -v | |
- cmd: source ~/.bash_profile; python -V | |
- cmd: source ~/.bash_profile; pyenv install '{{ python_ver }}' | |
- cmd: source ~/.bash_profile; pyenv global '{{ python_ver }}' | |
- cmd: source ~/.bash_profile; python -V | |
- name: results | |
debug: var=RESULT.results | |
- debug: msg="---------- block end ----------" | |
when: pyenv_install.rc == 1 |
This file contains 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
--- | |
- include: install_pyenv_without_proxy.yml |
This file contains 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure(2) do |config| | |
# Every Vagrant development environment requires a box. You can search for | |
# boxes at https://atlas.hashicorp.com/search. | |
# Please replace it with a BOX name of CentOS6 for one's own 32bit when your host is 32bit machine. | |
config.vm.box = "geerlingguy/centos6" | |
# Add ansible provisioner | |
config.vm.provision "ansible" do |ansible| | |
ansible.playbook = "site.yml" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment