Hatena::Grouptech

id:rx7(@namikawa)の技術メモ このページをアンテナに追加 RSSフィード

過去記事一覧 | Main Blog (元RX-7乗りの適当な日々) | SBM (id:rx7のBookmark)

2012/04/24

Chef の Common Automatic Attributes

| Chef の Common Automatic Attributes - id:rx7(@namikawa)の技術メモ を含むブックマーク はてなブックマーク - Chef の Common Automatic Attributes - id:rx7(@namikawa)の技術メモ Chef の Common Automatic Attributes - id:rx7(@namikawa)の技術メモ のブックマークコメント

ohaiによって自動で付与されるAttributesの一覧。

Ohai detects attributes on the node based on its own plugin system. The most commonly accessed attributes are:

  • node['platform'] - The node's platform. This determines what Providers are used by Resources.
  • node['platform_version'] - The node's platform version. This may be used in determining Providers as well.
  • node['ipaddress'] - The node's ipaddress is IPV4 address of the interface that has the default route. If the node does not have a default route, this attribute will be nil. Using the IP of the interface with the default route is deemed the most sane default.
  • node['macaddress'] - The node's macaddress, from the interface detected for ipaddress above.
  • node['fqdn'] - The fully qualified domain name, for example from hostname -f on Unix/Linux systems. This is also used as the node name unless otherwise set.
  • node['hostname'] - The hostname is the first field from splitting the FQDN on "." (dot).
  • node['domain'] - The domain is the rest of the FQDN after splitting on "." (dot).
  • node['recipes'] - The node's Run List is expanded for roles and recipes, and recipes are stored in this attribute.
  • node['roles'] - The node's Run List is expanded for roles and recipes, and roles are stored in this attribute.
  • node['ohai_time'] - Not commonly used in recipes, but this value is the time epoch of the node when ohai was run, and gets saved to the Chef Server. It is also used in the Knife "status" sub command.
ERROR: The request could not be satisfied

Automatic Attribute Precedence

参考: ERROR: The request could not be satisfied

ohai$ grep -R "provides" -h lib/ohai/plugins|sed 's/^\s*//g'|sed "s/\\\"/\'/g"|sort|uniq|grep ^provides
provides 'block_device'
provides 'chef'
provides 'cloud'
provides 'command'
provides 'command/ps'
provides 'cpu'
provides 'dmi'
provides 'ec2'
provides 'etc', 'current_user'
provides 'eucalyptus'
provides 'filesystem'
provides 'fqdn', 'domain'
provides 'fqdn', 'hostname'
provides 'hostname', 'fqdn'
provides 'kernel'
provides 'kernel/os'
provides 'keys'
provides 'keys/ssh'
provides 'languages'
provides 'languages/c'
provides 'languages/erlang'
provides 'languages/groovy'
provides 'languages/java'
provides 'languages/lua'
provides 'languages/mono'
provides 'languages/perl'
provides 'languages/php'
provides 'languages/python'
provides 'languages/ruby'
provides 'lsb'
provides 'memory'
provides 'network'
provides 'network', 'counters/network'
provides 'network_ip_scope', 'privateaddress'
provides 'network/listeners'
provides 'ohai'
provides 'ohai_time'
provides 'os', 'os_version'
provides 'platform', 'platform_version'
provides 'platform', 'platform_version', 'platform_build'
provides 'rackspace'
provides 'system_profile'
provides 'uptime', 'idletime', 'uptime_seconds', 'idletime_seconds'
provides 'uptime', 'uptime_seconds'
provides 'virtualization'
トラックバック - http://tech.g.hatena.ne.jp/rx7/20120424

2012/04/03

Linuxでbondingのactiveなinterfaceを変更するコマンド

| Linuxでbondingのactiveなinterfaceを変更するコマンド - id:rx7(@namikawa)の技術メモ を含むブックマーク はてなブックマーク - Linuxでbondingのactiveなinterfaceを変更するコマンド - id:rx7(@namikawa)の技術メモ Linuxでbondingのactiveなinterfaceを変更するコマンド - id:rx7(@namikawa)の技術メモ のブックマークコメント


Linuxで fault-tolerance (active-backup) なボンディング(チーミング)を組んでいて、アクティブなインタフェースを変更したい場合。

eth1がアクティブな時に、eth0に変更とか。(繋がってるスイッチを揃えておきたいとか色々あるよね。)


まず、

# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 200
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: xx:xx:xx:xx:xx:xx

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: xx:xx:xx:xx:xx:xy

な状態で、"Currently Active Slave: eth0"を確認。その後、


# ifenslave -c bond0 eth1

を実行すると、、、


# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 200
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: xx:xx:xx:xx:xx:xx

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: xx:xx:xx:xx:xx:xy

この通り、"Currently Active Slave: eth1"と切り替わっていることを確認できる。


Apr  3 18:15:07 hostname kernel: bonding: bond0: making interface eth1 the new active one.

"/var/log/messages"にログが残っていることも確認。

トラックバック - http://tech.g.hatena.ne.jp/rx7/20120403