Glide Note

glidenote's blog

yankring.vimでUndefined variableエラー(E121)

vim-scripts/YankRing.vim · GitHub

YankRing.vimを最新版(Ver13.0)にしたら、Yank/Pasteするたびに

1
2
3
4
Error detected while processing function <SNR>28_YRPaste:
line    1:
E121: Undefined variable: g:yankring_manual_clipboard_check
E15: Invalid expression: g:yankring_manual_clipboard_check == 1

というエラーを吐くようになったので、Docment を見てみたところ

yankring_manual_clipboard_check
< Default: 0
If running in console mode, Vim’s FocusGained event will not
fire as we flip back and forth between windows. This normally
instructs the YankRing to check for updates to the system
clipboard. When this option is set, the YankRing will check
the clipboard under many different circumstances:
Adding a new entry to the YankRing
Replacing a previous paste
Showing the YankRing window
If the YankRing is setup to check the clipboard and the
GUI is not running, this option will be enabled by default.
To disable this feature you can put the following in your |vimrc| >
let g:yankring_manual_clipboard_check = 0

とのこと。なぜかDefault: 0が効いていないようなので、.vimrcに下記を追記

1
let g:yankring_manual_clipboard_check = 0

エラーも出なくなりました。

markdown2impressを導入してみた

恐ろしく便利なツールがあったので、導入。

1
2
3
4
5
mkdir ~/tmp
cd ~/tmp
git clone git://github.com/yoshiki/markdown2impress.git
mkdir ~/bin
cp markdown2impress/bin/markdown2impress.pl ~/bin

必要なモジュールをcpanmで導入

1
2
3
cpanm Data/Section/Simple.pm
cpanm Text/Markdown.pm
cpanm Text/Xslate.pm

付属のREADME.mdを早速変換

1
markdown2impress.pl README.md

同じディレクトリに下記のようなwebrickを利用したスクリプトを用意して、

1
ruby server.rb

でスクリプトを実行して、localhost:10080とかで簡単に動作確認も出来ます。 勉強会の資料作りはGoogle Docsやめて、これで良さそうな感じが。

どんなのができあがるかは@yappoさんの YappoLogs: Kyoto.PM #1 で発表してきました を見て頂くのが早いかと。

markdown2impress活用させて頂きます。

Cobbler System addのメモ

前回の続き

cobbler system addコマンドをいつも忘れるのでメモ。

profileの作成(用途ごとの設定)

WEBサーバ、DBサーバとかの用途ごとの設定はprofileで設定

1
2
cobbler profile add --name=mysql-server --distro=CentOS5.8-x86_64 --kickstart=/var/lib/cobbler/kickstarts/mysql-server.ks
cobbler sync

systemの作成(サーバ固有の設定)

下記のようなサーバ固有の設定はsystemで設定。共通の設定はprofileで設定したほうがいいかも。

  • ホストネーム
  • インターフェースのMACアドレス
  • ネットワーク設定(IPアドレス、サブネットマスク、ゲートウェイ、DNSサーバ)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
cobbler system add  \
--name=hogemoge001.com \     # system名を指定(addの場合はこの名前でsystemが作成される)
--hostname=hogemoge001.com \ # Hostnameを設定
--profile=mysql-server \     # 利用するprofileを指定
--interface=eth0 \           # 設定するインターフェースを指定
--mac=xx:xx:xx:xx:xx:xx \    # eth0のMACアドレス
--static=1 \                 # 固定IP or DHCP (DHCPの場合は0)
--ip=xxx.xxx.xxx.xxx \       # eth0のIPアドレス
--subnet=255.255.255.0 \     # eth0のサブネットマスク
--gateway=xxx.xxx.xxx.xxx \  # eth0のゲートウェイ
--name-servers=8.8.8.8 \     # 参照するDNSサーバ
--kopts='ksdevice=eth1'      # カーネルオプションがある場合はここで指定

cobbler system edit \
--name=hogemoge001.com \     # system名を指定(editの場合は、この名前のsystemを変更)
--interface=eth1 \           # 設定するインターフェースを指定
--mac=xx:xx:xx:xx:xx:xx \    # eth1側のMACアドレス
--static=1 \                 # 固定IP or DHCP (DHCPの場合は0)
--ip=xxx.xxx.xxx.xxx \       # eth1のIPアドレス
--subnet=255.255.255.0       # eth1のサブネットマスク

cobbler sync

設定の確認

1
cobbler system report --name=hogemoge001.com

Cobblerサーバの構築メモ

Cobblerを使って、業務で日常的にOSのインストールを しているんですが、Cobblerサーバ自体はチーム内の他の人が構築してくれてて、 自分で一から立てたことが無く、今回構築してみたのでメモ。

構築環境

  • CentOS release 5.8 (Final)
  • cobbler-2.0.11-2.el5
  • CobblerサーバのIP 172.17.8.11
  • PXEブートするIPレンジ 172.17.8.0/24

epelの導入

Cobblerはepelにあるので、epelをリポジトリに追加

1
2
3
4
mkdir ~/src
cd ~/src
wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm

Cobblerの導入とサービスの起動

Cobblerと一緒に必要なパッケージが入るんですが、 dhcpは一緒に入らなかったのでdhcpも導入。

1
yum -y install cobbler dhcp

サービスを起動して、自動で起動するようにも設定

1
2
3
4
5
6
7
8
9
service cobblerd start
service httpd start
service xinetd start
service dhcpd start

chkconfig cobblerd on
chkconfig httpd on
chkconfig xinetd on
chkconfig dhcpd on

Cobblerの各種設定を用意

Cobblerを起動したらcobbler checkで設定ファイルをチェック。問題がある部分が表示されるので一個ずつ修正していきます。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cobbler check

The following are potential configuration items that you may want to fix:

1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work.  This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely.  Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
4 : change 'disable' to 'no' in /etc/xinetd.d/tftp
5 : change 'disable' to 'no' in /etc/xinetd.d/rsync
6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
7 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

Restart cobblerd and then run 'cobbler sync' to apply changes.

/etc/cobbler/settings

/etc/xinetd.d/tftp

/etc/xinetd.d/rsync

/etc/cobbler/dhcp.template

cobblerにdhcpdも管理させるのでdhcp.templateも修正

/etc/hosts.allow

hosts.allowにPXEブートするIPレンジを記載

1
2
3
bootps:         172.17.8.0/255.255.255.0
tftp:           172.17.8.0/255.255.255.0
in.tftpd:       172.17.8.0/255.255.255.0

bootloaderの用意

1
cobbler get-loaders

インストール用のディストリビューションを用意

cobbler importでCentOS5.8とScicentifc Linux6.2をimport。だいたい1つに30分〜40分かかります

1
2
3
cobbler import --path=rsync://ftp.jaist.ac.jp/pub/Linux/CentOS/5.8/os/x86_64/ --name=CentOS5.8-x86_64
cobbler import --path=rsync://ftp.jaist.ac.jp/pub/Linux/scientific/6.2/x86_64/os/ --name=SL6.2-x86_64
cobbler sync

再度設定をチェック

cobbler checkで再度設定をチェック。下記の注意書きが出ますが、関係ないので無視

1
2
3
4
5
6
7
The following are potential configuration items that you may want to fix:

1 : debmirror package is not installed, it will be required to manage debian deployments and repositories
2 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
3 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

Restart cobblerd and then run 'cobbler sync' to apply changes.

各種設定が出来たので、Cobbler再起動して設定を反映

1
service cobblerd restart

動作確認

動作チェックのため、iptablesを一時的に止める

1
service iptables stop

適当なksファイル/var/lib/cobbler/kickstarts/mysql-server.ksなどを用意して、profileに登録

1
2
cobbler profile add --name=mysql-server --distro=CentOS5.8-x86_64 --kickstart=/var/lib/cobbler/kickstarts/mysql-server.ks
cobbler sync

まっさらなサーバを起動してCobblerの画面が出るか確認

用意したmysql-serverを選択してインストール作業の確認

うまくいきました。

/etc/cobbler/settingsを眺めてたらgitやらpuppetやらの設定項目があって、 もっと便利に使えそうな予感が。

Iron Man Sticker

Etsyで買ったMacBookAir用のステッカーが、 恐ろしく貼りにくくて、空気入りまくり。
品質も若干アレな感じ。別のやつ買い直そうかな。