Skip to content

Instantly share code, notes, and snippets.

View masahide's full-sized avatar

YAMASAKI Masahide masahide

View GitHub Profile
# pyenvするのに必要なパッケージ
sudo yum install -y vim-enhanced gcc gcc-c++ make git patch openssl-devel zlib-devel readline-devel sqlite-devel bzip2-devel
# pyenv インストール
cd ~
git clone git://github.com/yyuu/pyenv.git .pyenv
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
. ~/.bash_profile
- name: install zabbix-server
yum: name={{item}} enablerepo=epel state=installed
with_items:
- zabbix20-server-mysql
- zabbix20-web
- MySQL-python
tags: zabbix-server
- name: add zabbix dbuser
mysql_user: login_host=localhost login_user={{ dbroot }} login_password={{ dbpass }} name=zabbix password={{ zabbix_db_pass }} priv=zabbix.*:ALL
@masahide
masahide / main.yml
Created August 17, 2013 09:09
ansibleでansibleをいれるplaybookを作る ref: http://qiita.com/yamasaki-masahide/items/45ef3fd3dd5d535407a3
- name: install python (CentOS 6)
yum: name={{item}} enablerepo=epel state=installed
with_items:
- PyYAML
- python-paramiko
- python-jinja2
when: ansible_os_family == 'RedHat' and ansible_distribution_version.split('.')[0]|int == 6
tags: python
- name: install python26 (CentOS 5)
@masahide
masahide / file0.txt
Created August 17, 2013 09:28
Ansible CentOS5で出るImportError: No module named simplejson の対処 ref: http://qiita.com/yamasaki-masahide/items/4485a438125e6b1748ce
FAILED >> {
"failed": true,
"msg": "Traceback (most recent call last):\r\n\n File \"/home/adminn/.ansible/tmp/ansible-1352204366.62-260359853897483/ping\", line 63, in ?\r\n\n import simplejson as json\r\n\nImportError: No module named simplejson\r\n",
"parsed": false
}
- hosts: localhost
connection: local
gather_facts: no
vars:
role: common
tasks:
- name: create directories for ansible files.
file: path={{ item }} state=directory
with_items:
- group_vars
$ diff -u <(ssh host1 cat /etc/hosts) <(ssh host2 cat /etc/hsots)
@masahide
masahide / __init__.py
Created February 14, 2014 20:20
Ansibleのsudo ask-sudo-pass はどう実装されているか ref: http://qiita.com/yamasaki-masahide/items/454d81be6ca632f39758
def make_sudo_cmd(sudo_user, executable, cmd):
"""
helper function for connection plugins to create sudo commands
"""
# Rather than detect if sudo wants a password this time, -k makes
# sudo always ask for a password if one is required.
# Passing a quoted compound command to sudo (or sudo -s)
# directly doesn't work, so we shellquote it with pipes.quote()
# and pass the quoted string to the user's shell. We loop reading
# output until we see the randomly-generated sudo prompt set with
if err := session.Run("/usr/bin/scp -qrt ./"); err != nil {
@masahide
masahide / piping.go
Created February 18, 2014 05:00 — forked from kylelemons/piping.go
package main
import (
"bytes"
"exec"
"log"
"os"
)
// Pipeline strings together the given exec.Cmd commands in a similar fashion
Subject: =?utf-8?B?6ZW344GE44K144OW44K444Kn44Kv44OI6ZW344GE44K144OW44K4?=
=?utf-8?B?44Kn44Kv44OI6ZW344GE44K144OW44K444Kn44Kv44OI6ZW344GE?=
=?utf-8?B?44K144OW44K444Kn44Kv44OI6ZW344GE44K144OW44K444Kn44Kv?=
=?utf-8?B?44OI6ZW344GE44K144OW44K444Kn44Kv44OI6ZW344GE44K144OW?=
=?utf-8?B?44K444Kn44Kv44OI?=
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
Message-Id: <20140222115231.8DECE260593@st>
Date: Sat, 22 Feb 2014 20:52:31 +0900 (JST)