2011年7月19日火曜日

ec2作成by chef リトライ

今度はi386のcentosのイメージで再度リトライしてみる。

knife ec2 server create -N "demo.example.net2" -I ami-2006ad21 -f t1.micro --region ap-northeast-1 --ssh-key nobubu3 --identity-file /tmp/nobubu3.pem --groups quick-start-1 --ssh-user root --server-url "https://api.opscode.com/organizations/nobu" -d centos5-gems

。。。。

ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com Successfully installed uuidtools-2.1.2
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com Successfully installed chef-0.10.2
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com 14 gems installed
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com [Mon, 18 Jul 2011 12:37:34 -0400] INFO: *** Chef 0.10.2 ***
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com [Mon, 18 Jul 2011 12:37:54 -0400] INFO: Client key /etc/chef/client.pem is not present - registering
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com [Mon, 18 Jul 2011 12:37:55 -0400] INFO: HTTP Request Returned 409 Conflict: Client already exists.
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com [Mon, 18 Jul 2011 12:37:58 -0400] INFO: HTTP Request Returned 404 Not Found: Cannot load node demo.example.net2
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com [Mon, 18 Jul 2011 12:38:03 -0400] INFO: Setting the run_list to [] from JSON
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com [Mon, 18 Jul 2011 12:38:03 -0400] INFO: Run List is []
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com [Mon, 18 Jul 2011 12:38:03 -0400] INFO: Run List expands to []
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com [Mon, 18 Jul 2011 12:38:03 -0400] INFO: Starting Chef Run for demo.example.net2
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com [Mon, 18 Jul 2011 12:38:05 -0400] INFO: Loading cookbooks []
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com [Mon, 18 Jul 2011 12:38:05 -0400] WARN: Node demo.example.net2 has an empty run list.
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com [Mon, 18 Jul 2011 12:38:06 -0400] INFO: Chef Run complete in 3.446312 seconds
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com [Mon, 18 Jul 2011 12:38:06 -0400] INFO: Running report handlers
ec2-46-51-236-93.ap-northeast-1.compute.amazonaws.com [Mon, 18 Jul 2011 12:38:06 -0400] INFO: Report handlers complete

Instance ID: i-9a410c9b
Flavor: t1.micro
Image: ami-2006ad21
Availability Zone: ap-northeast-1b
Security Groups:
Public DNS Name: xxxxxxxxxxx
Public IP Address: xxxxxxxxxxxxxxx
Private DNS Name:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SSH Key: xxxx
Private IP Address: xxxxx
Root Device Type: ebs
Root Volume ID: vol-7c1d9216
Root Device Name: /dev/sda1
Root Device Delete on Terminate: true
Environment: _default
Run List:
[ec2-user@ip-10-150-174-103 chef-repo]$

chefクライアントが登録されています!

ec2ワークステーションから確認。
[ec2-user@ip-10-150-174-103 chef-repo]$ knife node list
  demo.example.net2
  ip-10-146-7-97.ap-northeast-1.compute.internal


*** ec2 server createによってインストールされたものの確認 ***

以下のようにchefとknifeはインストールされています。

[root@ip-10-150-183-203 ~]# chef-client -v
Chef: 0.10.2
[root@ip-10-150-183-203 ~]#
[root@ip-10-150-183-203 ~]#
[root@ip-10-150-183-203 ~]# knife
ERROR: You need to pass a sub-command (e.g., knife SUB-COMMAND)

knife環境はセットアップが必要なよう。
[root@ip-10-150-183-203 ~]# knife node list
WARNING: No knife configuration file found
ERROR: ArgumentError: Cannot sign the request without a client name, check that :node_name is assigned

gitがec2 server createでインストールされたのかは不明だが、入っています。
[root@ip-10-150-183-203 ~]# git --version
git version 1.5.5.6







gitリポジトリを落としてみます。
[root@ip-10-150-183-203 ~]# cd ~
[root@ip-10-150-183-203 ~]# git clone http://github.com/opscode/chef-repo.git
Initialized empty Git repository in /root/chef-repo/.git/
Cannot get remote repository information.
Perhaps git-update-server-info needs to be run there?
[root@ip-10-150-183-203 ~]#  git-update-server-info
fatal: Not a git repository
[root@ip-10-150-183-203 ~]# git update-server-info
fatal: Not a git repository
[root@ip-10-150-183-203 ~]#
[root@ip-10-150-183-203 ~]# ls
[root@ip-10-150-183-203 ~]# pwd
/root
[root@ip-10-150-183-203 ~]# mkdir chef-repo
[root@ip-10-150-183-203 ~]# git clone http://github.com/opscode/chef-repo.git
destination directory 'chef-repo' already exists.
[root@ip-10-150-183-203 ~]# rmdir chef-repo
[root@ip-10-150-183-203 ~]#
[root@ip-10-150-183-203 ~]#


gitバージョンアップしてみる

[root@ip-10-150-183-203 ~]# yum upgrade git
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.netrino.co.uk
 * base: www.mirrorservice.org
 * epel: www.mirrorservice.org
 * extras: www.mirrorservice.org
 * updates: mirrors.supportex.net
addons                                                   |  951 B     00:00
aegisco                                                  |  951 B     00:00
http://www.mirrorservice.org/sites/mirror.centos.org/5.6/os/i386/repodata/repomd.xml: [Errno 4] IOError: <urlopen error (-3, 'Temporary failure in name resolution')>
Trying other mirror.
base                                                     | 1.1 kB     00:00
http://www.mirrorservice.org/sites/download.fedora.redhat.com/pub/epel/5/i386/repodata/repomd.xml: [Errno 4] IOError: <urlopen error (-3, 'Temporary failure in name resolution')>
Trying other mirror.
epel                                                     | 3.7 kB     00:00
epel/primary_db                                          | 3.1 MB     00:24
http://www.mirrorservice.org/sites/mirror.centos.org/5.6/extras/i386/repodata/repomd.xml: [Errno 4] IOError: <urlopen error (-3, 'Temporary failure in name resolution')>
Trying other mirror.
extras                                                   | 2.1 kB     00:00
scalr                                                    |  951 B     00:00
updates                                                  | 1.9 kB     00:00
Setting up Upgrade Process
Resolving Dependencies
--> Running transaction check
--> Processing Dependency: git = 1.5.5.6-4.el5 for package: perl-Git
---> Package git.i386 0:1.7.4.1-1.el5 set to be updated
--> Running transaction check
---> Package perl-Git.i386 0:1.7.4.1-1.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package            Arch           Version                 Repository      Size
================================================================================
Updating:
 git                i386           1.7.4.1-1.el5           epel           4.5 M
Updating for dependencies:
 perl-Git           i386           1.7.4.1-1.el5           epel            28 k

Transaction Summary
================================================================================
Install       0 Package(s)
Upgrade       2 Package(s)

Total download size: 4.5 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): perl-Git-1.7.4.1-1.el5.i386.rpm                   |  28 kB     00:00
(2/2): git-1.7.4.1-1.el5.i386.rpm                        | 4.5 MB     00:09
--------------------------------------------------------------------------------
Total                                           404 kB/s | 4.5 MB     00:11
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : perl-Git                                                 1/4
  Updating       : git                                                      2/4
  Cleanup        : perl-Git                                                 3/4
  Cleanup        : git                                                      4/4

Updated:
  git.i386 0:1.7.4.1-1.el5

Dependency Updated:
  perl-Git.i386 0:1.7.4.1-1.el5

Complete!
[root@ip-10-150-183-203 ~]# git --version
git version 1.7.4.1
[root@ip-10-150-183-203 ~]#

 できた!
[root@ip-10-150-183-203 ~]# git clone http://github.com/opscode/chef-repo.git
Cloning into chef-repo...
remote: Counting objects: 199, done.
remote: Compressing objects: 100% (119/119), done.
remote: Total 199 (delta 72), reused 160 (delta 47)
Receiving objects: 100% (199/199), 30.16 KiB, done.
Resolving deltas: 100% (72/72), done.
[root@ip-10-150-183-203 ~]# ls
chef-repo
[root@ip-10-150-183-203 ~]#

 mkdir chef-repo/.chef

.chef配下にxxx.pem, xxx-validator.pem, knife.rbを置く。(hosted chefから取得できるファイル)
[root@ip-10-150-183-203 chef-repo]# cd .chef
[root@ip-10-150-183-203 .chef]# ls
knife.rb  xxx-validator.pem  xxx.pem
[root@ip-10-150-183-203 .chef]# cd ..
[root@ip-10-150-183-203 chef-repo]# knife node list
  demo.examle.net
  ip-10-146-.ap-northeast-1.compute.internal
[root@ip-10-150-183-203 chef-repo]#

0 件のコメント:

コメントを投稿