higanworks / knife-zero Goto Github PK
View Code? Open in Web Editor NEWRun chef-client/cinc-client at remote node with chef-zero(local-mode) via HTTP over SSH port fowarding.
Home Page: https://knife-zero.github.io
License: Other
Run chef-client/cinc-client at remote node with chef-zero(local-mode) via HTTP over SSH port fowarding.
Home Page: https://knife-zero.github.io
License: Other
Hi,
I'm suggesting that we could use Berkshelf to download all dependency cookbooks so we can make wrapper cookbook for knife zero easier, without worrying about putting correct site cookbook version.
Thanks
Certain automatic node attributes change between every node save (memory, interface stats, etc.). For those who are committing the json node objects into version control, it would be nice to allow this noise to be disabled.
We can do that here, where the client.rb template is generated during bootstrap, by adding a key for "whitelisted attributes":
https://github.com/chef/chef/blob/d8172e646d9fbf43e57bca5e20d0ac352ba9a66a/lib/chef/knife/core/bootstrap_context.rb#L64-L69
We can append automatic_attribute_whitelist []
to the bootstrapped node's client.rb
to completely silence the noisy automatic attributes, but that's likely too opinionated. Most stay constant anyhow.
We could instead allow arbitrarily adding key-value pairs to the generated client.rb. Or alternatively, we could have a more user-friendly config that adds something like this, which should silence most noise:
# client.rb snippet
automatic_attribute_whitelist %w(
!network/interfaces
!memory/
]
Blacklisting seems to be an undocumented feature...
https://github.com/chef/chef/blob/59da09f64b72dbd712c890f999322493a4bc9ec4/lib/chef/node_map.rb#L157
EDIT: Turns out blacklisting isn't a thing, so this isn't useful for now
https://circleci.com/gh/higanworks/knife-zero/20 fails due to -a name
doesn't work correctly.
depends on: chef/chef#3195
I get output like this:
knife zero converge 'name:DO_db' -p 2222 -x vagrant -P vagrant -E local -r 'role[imindsx_aegir3_db]' --sudo --local-mode
localhost Starting Chef Client, version 11.8.2
localhost [2015-09-27T22:35:28+00:00] ERROR: Connection refused connecting to http://127.0.0.1:0/nodes/DO_db, retry 1/5
^C%
お世話になります。
knife zero chef_clientを実行するとsshに失敗しています。
root@[email protected]と@が2つ続いて表示されるのがおかしいような気がしております。
以下実行結果
[**@chefzero01 chef-repo]$ bundle exec knife zero chef_client 'name:'
WARN: No cookbooks directory found at or above current directory. Assuming /home/ookita/chef-repo.
WARNING: Failed to connect to chefzero02.ec2.tokyo -- Net::SSH::AuthenticationFailed: Authentication failed for user root@[email protected]
ERROR: knife encountered an unexpected error
This may be a bug in the 'zero chef client' knife command or plugin
Please collect the output of this command with the -VV
option before filing a bug report.
Exception: NoMethodError: undefined method `forward' for nil:NilClass
node list出力結果
[***@chefzero01 chef-repo]$ knife node list
WARN: No cookbooks directory found at or above current directory. Assuming /home/ookita/chef-repo.
chefzero02.ec2.tokyo
node情報
[***@chefzero01 chef-repo]$ knife node show chefzero02.ec2.tokyo
WARN: No cookbooks directory found at or above current directory. Assuming /home/ookita/chef-repo.
Node Name: chefzero02.ec2.tokyo
Environment: _default
FQDN: chefzero02.ec2.tokyo
IP: 153.120.25.197
Run List: recipe[lamp]
Roles:
Recipes:
Platform: centos 6.6
Tags:
デバッグ出力
[**@chefzero01 chef-repo]$ bundle exec knife zero chef_client 'name:' -VV
WARN: No cookbooks directory found at or above current directory. Assuming /home/ookita/chef-repo.
INFO: Using configuration from /home/ookita/chef-repo/.chef/knife.rb
INFO: Started chef-zero at http://localhost:8889 with repository at /home/ookita/chef-repo
One version per cookbook
DEBUG: Chef::HTTP calling Chef::HTTP::JSONInput#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::JSONToModelOutput#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::CookieManager#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Decompressor#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Authenticator#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::RemoteRequestID#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::ValidateContentLength#handle_request
DEBUG: Initiating GET to http://localhost:8889/search/node?q=name:_&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000
DEBUG: ---- HTTP Request Header Data: ----
DEBUG: Accept: application/json
DEBUG: Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
DEBUG: X-REMOTE-REQUEST-ID: 20d69639-4c6e-4eb3-916e-e6dfafc1f8c6
DEBUG: ---- End HTTP Request Header Data ----
DEBUG: #<ChefZero::RestRequest:0x0000000108b190 @env={"GATEWAY_INTERFACE"=>"CGI/1.1", "PATH_INFO"=>"/search/node", "QUERY_STRING"=>"q=name:_&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000", "REMOTE_ADDR"=>"::1", "REMOTE_HOST"=>"localhost", "REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"http://localhost:8889/search/node?q=name:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000", "SCRIPT_NAME"=>"", "SERVER_NAME"=>"localhost", "SERVER_PORT"=>"8889", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/2.0.0/2014-11-13) OpenSSL/1.0.1e", "HTTP_ACCEPT"=>"application/json", "HTTP_ACCEPT_ENCODING"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "HTTP_X_REMOTE_REQUEST_ID"=>"20d69639-4c6e-4eb3-916e-e6dfafc1f8c6", "HTTP_X_CHEF_VERSION"=>"12.0.3", "HTTP_HOST"=>"localhost:8889", "HTTP_USER_AGENT"=>"Chef Knife/12.0.3 (ruby-2.0.0-p598; ohai-8.0.1; x86_64-linux; +http://opscode.com)", "HTTP_CONNECTION"=>"close", "rack.version"=>[1, 3], "rack.input"=>#StringIO:0x0000000101cdd0, "rack.errors"=>#IO:, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "rack.url_scheme"=>"http", "rack.hijack?"=>true, "rack.hijack"=>#<Proc:0x00000001021dd0@/usr/local/rvm/gems/ruby-2.0.0-p598/gems/rack-1.6.0/lib/rack/handler/webrick.rb:77 (lambda)>, "rack.hijack_io"=>nil, "HTTP_VERSION"=>"HTTP/1.1", "REQUEST_PATH"=>"/search/node"}, @rest_base_prefix=["organizations", "chef"]>
DEBUG:
DEBUG:
--- RESPONSE (200) ---
{
"rows": [
{
"name": "chefzero02.ec2.tokyo",
"normal": {
"tags": [
]
},
"automatic": {
"keys": {
"ssh": {
"host_dsa_public": "AAAAB3NzaC1kc3MAAACBAJlSiOAFh/5Qit6EW6GvOUoKCORUq1SiHHNjcVKGforPlmbzfqdqr7hN/5T6DuwWFgTjZJktDfmUzK4SEAdmMcpvi9s/0E7wRfKFGwSybM34YlODTfcHmyYJU1lfaSmuuAQ/CZwCPYwTpzCqRmjqOw4cW0wpf8SJR+tRiqbTbA/jAAAAFQDnPPLs4cbcZTQQUsdfv1SJegRLvwAAAIBgJE+/2c+s9QoxKeV7UA8yUDtkjSy5NkUe6lKW9GT+uYsspgBFVYSD/b1JDHZQxkXlRfllQ96lwShs87pvU7z50im4RsQRxxRytAuHsjAyE7aYbgj8XDJa55X5+Z+1oh7pIa7acd8uenZc91OXUvjw/nP+1BwCdZnevMCLn0eVawAAAIBHeHqqlr+wBt/jKpVmSB6Xq42/wlLgAWq02AAw551XqplyQwC0KgYHXcR6QP2kAZraIqu6PmMfw8IJuN/kGIL1n00uk7i2Gg4se6tGAyFLXFsATwAYO5MFsdeV5mRHsW/O5k/GUm6lWtxl8CLrcOtSTVJ915ER0hfrM76UFtSk6w==",
"host_rsa_public": "AAAAB3NzaC1yc2EAAAABIwAAAQEA2Ye3DJ5t8b3ChtCt7TkSAwfucsku4JBlP9ap/ARtVPFymPMngWNc39rbY6X9KMSGTjYku5rRQQS/XGMcTQMvLJKCYuvpoZKDYbM6iUTRZQ9JE02RYObIWianfpatwoBDdocEBkAwKdQr7OImZ/gMDSKOlEMtjQmB99vhFkFqk2ijLFyad1r9vXB3tsKTXrr+Ht1UsnaO4p9TcsLa/3qgXOzJEWfy9pjRvfXfgDlZpCWK37Wh7UffEHIUXWzYoyfdtROiq09kZGpHuligE3nKzVX0e2WbRBAhVj6RPEn5o+OceqlDyBExih1odSZiUVz/N6enawQ9NXMcM/UoKP/fVQ=="
}
},
"kernel": {
"name": "Linux",
"release": "2.6.32-504.1.3.el6.x86_64",
"version": "#1 SMP Tue Nov 11 17:57:25 UTC 2014",
"machine": "x86_64",
"os": "GNU/Linux",
"modules": {
"ipt_REJECT": {
"size": "2351",
"refcount": "0"
},
"iptable_filter": {
"size": "2793",
"refcount": "1"
},
"ip_tables": {
"size": "17831",
"refcount": "1"
},
"ipv6": {
"size": "334932",
"refcount": "20"
},
"virtio_balloon": {
"size": "4798",
"refcount": "0"
},
"virtio_net": {
"size": "22438",
"refcount": "0"
},
"i2c_piix4": {
"size": "11776",
"refcount": "0"
},
"i2c_core": {
"size": "29964",
"refcount": "1"
},
"sg": {
"size": "29318",
"refcount": "0"
},
"ext4": {
"size": "378476",
"refcount": "1"
},
"jbd2": {
"size": "93427",
"refcount": "1"
},
"mbcache": {
"size": "8193",
"refcount": "1"
},
"virtio_blk": {
"size": "7132",
"refcount": "3"
},
"sr_mod": {
"size": "15049",
"refcount": "0"
},
"cdrom": {
"size": "39085",
"refcount": "1"
},
"virtio_pci": {
"size": "7348",
"refcount": "0"
},
"virtio_ring": {
"size": "9115",
"refcount": "4"
},
"virtio": {
"size": "4977",
"refcount": "4"
},
"pata_acpi": {
"size": "3701",
"refcount": "0"
},
"ata_generic": {
"size": "3837",
"refcount": "0"
},
"ata_piix": {
"size": "24409",
"refcount": "0"
},
"dm_mirror": {
"size": "14384",
"refcount": "0"
},
"dm_region_hash": {
"size": "12085",
"refcount": "1"
},
"dm_log": {
"size": "9930",
"refcount": "2"
},
"dm_mod": {
"size": "95622",
"refcount": "2"
}
}
},
"network": {
"interfaces": {
"lo": {
"mtu": "65536",
"flags": [
"LOOPBACK",
"UP",
"LOWER_UP"
],
"encapsulation": "Loopback",
"addresses": {
"127.0.0.1": {
"family": "inet",
"prefixlen": "8",
"netmask": "255.0.0.0",
"scope": "Node"
},
"::1": {
"family": "inet6",
"prefixlen": "128",
"scope": "Node"
}
},
"state": "unknown",
"routes": [
{
"destination": "unreachable",
"family": "inet6",
"metric": "1024"
},
{
"destination": "unreachable",
"family": "inet6",
"metric": "1024"
},
{
"destination": "unreachable",
"family": "inet6",
"metric": "1024"
},
{
"destination": "unreachable",
"family": "inet6",
"metric": "1024"
},
{
"destination": "unreachable",
"family": "inet6",
"metric": "1024"
},
{
"destination": "unreachable",
"family": "inet6",
"metric": "1024"
},
{
"destination": "unreachable",
"family": "inet6",
"metric": "1024"
},
{
"destination": "unreachable",
"family": "inet6",
"metric": "1024"
},
{
"destination": "unreachable",
"family": "inet6",
"metric": "1024"
}
]
},
"eth0": {
"type": "eth",
"number": "0",
"mtu": "1500",
"flags": [
"BROADCAST",
"MULTICAST",
"UP",
"LOWER_UP"
],
"encapsulation": "Ethernet",
"addresses": {
"9C:A3:BA:25:5F:9B": {
"family": "lladdr"
},
"153.120.25.197": {
"family": "inet",
"prefixlen": "24",
"netmask": "255.255.255.0",
"broadcast": "153.120.25.255",
"scope": "Global"
},
"fe80::9ea3:baff:fe25:5f9b": {
"family": "inet6",
"prefixlen": "64",
"scope": "Link"
}
},
"state": "up",
"arp": {
"153.120.25.1": "00:00:0c:9f:f0:01"
},
"routes": [
{
"destination": "153.120.25.0/24",
"family": "inet",
"scope": "link",
"proto": "kernel",
"src": "153.120.25.197"
},
{
"destination": "169.254.0.0/16",
"family": "inet",
"scope": "link",
"metric": "1002"
},
{
"destination": "default",
"family": "inet",
"via": "153.120.25.1"
},
{
"destination": "fe80::/64",
"family": "inet6",
"metric": "256",
"proto": "kernel"
}
]
}
},
"default_interface": "eth0",
"default_gateway": "153.120.25.1"
},
"counters": {
"network": {
"interfaces": {
"lo": {
"rx": {
"bytes": "62603",
"packets": "86",
"errors": "0",
"drop": "0",
"overrun": "0"
},
"tx": {
"bytes": "62603",
"packets": "86",
"errors": "0",
"drop": "0",
"carrier": "0",
"collisions": "0"
}
},
"eth0": {
"tx": {
"queuelen": "1000",
"bytes": "867605",
"packets": "12417",
"errors": "0",
"drop": "0",
"carrier": "0",
"collisions": "0"
},
"rx": {
"bytes": "47839871",
"packets": "94621",
"errors": "0",
"drop": "0",
"overrun": "0"
}
}
}
}
},
"ipaddress": "153.120.25.197",
"macaddress": "9C:A3:BA:25:5F:9B",
"languages": {
"lua": {
"version": "5.1.4"
},
"python": {
"version": "2.6.6",
"builddate": "Jan 22 2014, 09:42:36"
},
"perl": {
"version": "5.10.1",
"archname": "x86_64-linux-thread-multi"
},
"ruby": {
"platform": "x86_64-linux",
"version": "2.1.4",
"release_date": "2014-10-27",
"target": "x86_64-unknown-linux-gnu",
"target_cpu": "x86_64",
"target_vendor": "unknown",
"target_os": "linux",
"host": "x86_64-unknown-linux-gnu",
"host_cpu": "x86_64",
"host_os": "linux-gnu",
"host_vendor": "unknown",
"bin_dir": "/opt/chef/embedded/bin",
"ruby_bin": "/opt/chef/embedded/bin/ruby",
"gems_dir": "/opt/chef/embedded/lib/ruby/gems/2.1.0",
"gem_bin": "/opt/chef/embedded/bin/gem"
},
"c": {
"gcc": {
"version": "4.4.7",
"description": "gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) "
},
"glibc": {
"version": "2.12",
"description": "GNU C Library stable release version 2.12, by Roland McGrath et al."
}
}
},
"virtualization": {
"systems": {
}
},
"os": "linux",
"os_version": "2.6.32-504.1.3.el6.x86_64",
"lsb": {
},
"platform": "centos",
"platform_version": "6.6",
"platform_family": "rhel",
"chef_packages": {
"chef": {
"version": "12.0.3",
"chef_root": "/opt/chef/embedded/apps/chef/lib"
},
"ohai": {
"version": "8.0.1",
"ohai_root": "/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/ohai-8.0.1/lib/ohai"
}
},
"cloud_v2": null,
"cpu": {
"0": {
"vendor_id": "GenuineIntel",
"family": "6",
"model": "44",
"model_name": "Intel(R) Xeon(R) CPU X5675 @ 3.07GHz",
"stepping": "2",
"mhz": "3066.740",
"cache_size": "4096 KB",
"physical_id": "0",
"core_id": "0",
"cores": "1",
"flags": [
"fpu",
"vme",
"de",
"pse",
"tsc",
"msr",
"pae",
"mce",
"cx8",
"apic",
"mtrr",
"pge",
"mca",
"cmov",
"pat",
"pse36",
"clflush",
"mmx",
"fxsr",
"sse",
"sse2",
"ss",
"syscall",
"nx",
"lm",
"constant_tsc",
"up",
"unfair_spinlock",
"pni",
"pclmulqdq",
"ssse3",
"cx16",
"sse4_1",
"sse4_2",
"popcnt",
"aes",
"hypervisor",
"lahf_lm"
]
},
"total": 1,
"real": 1
},
"filesystem": {
"/dev/vda2": {
"kb_size": "16376928",
"kb_used": "1619564",
"kb_available": "13918804",
"percent_used": "11%",
"mount": "/",
"total_inodes": "1048576",
"inodes_used": "70700",
"inodes_available": "977876",
"inodes_percent_used": "7%",
"fs_type": "ext4",
"mount_options": [
"rw"
],
"uuid": "2a4a8b1b-fa41-4e94-b168-a2ab3b07cff9"
},
"tmpfs": {
"kb_size": "510164",
"kb_used": "0",
"kb_available": "510164",
"percent_used": "0%",
"mount": "/dev/shm",
"total_inodes": "127541",
"inodes_used": "1",
"inodes_available": "127540",
"inodes_percent_used": "1%",
"fs_type": "tmpfs",
"mount_options": [
"rw"
]
},
"proc": {
"mount": "/proc",
"fs_type": "proc",
"mount_options": [
"rw"
]
},
"sysfs": {
"mount": "/sys",
"fs_type": "sysfs",
"mount_options": [
"rw"
]
},
"devpts": {
"mount": "/dev/pts",
"fs_type": "devpts",
"mount_options": [
"rw",
"gid=5",
"mode=620"
]
},
"none": {
"mount": "/proc/sys/fs/binfmt_misc",
"fs_type": "binfmt_misc",
"mount_options": [
"rw"
]
},
"/dev/vda1": {
"fs_type": "swap",
"uuid": "c16a18d6-4988-493e-b6db-6bb0172ad83b"
},
"rootfs": {
"mount": "/",
"fs_type": "rootfs",
"mount_options": [
"rw"
]
},
"devtmpfs": {
"mount": "/dev",
"fs_type": "devtmpfs",
"mount_options": [
"rw",
"relatime",
"size=498996k",
"nr_inodes=124749",
"mode=755"
]
},
"/proc/bus/usb": {
"mount": "/proc/bus/usb",
"fs_type": "usbfs",
"mount_options": [
"rw",
"relatime"
]
}
},
"memory": {
"swap": {
"cached": "0kB",
"total": "4200208kB",
"free": "4200208kB"
},
"total": "1020332kB",
"free": "243876kB",
"buffers": "67420kB",
"cached": "517076kB",
"active": "202800kB",
"inactive": "465096kB",
"dirty": "64kB",
"writeback": "0kB",
"anon_pages": "83380kB",
"mapped": "14924kB",
"slab": "89108kB",
"slab_reclaimable": "70068kB",
"slab_unreclaim": "19040kB",
"page_tables": "2632kB",
"nfs_unstable": "0kB",
"bounce": "0kB",
"commit_limit": "4710372kB",
"committed_as": "177592kB",
"vmalloc_total": "34359738367kB",
"vmalloc_used": "8104kB",
"vmalloc_chunk": "34359726288kB"
},
"ip6address": "fe80::9ea3:baff:fe25:5f9b",
"etc": {
"passwd": {
"root": {
"dir": "/root",
"gid": 0,
"uid": 0,
"shell": "/bin/bash",
"gecos": "root"
},
"bin": {
"dir": "/bin",
"gid": 1,
"uid": 1,
"shell": "/sbin/nologin",
"gecos": "bin"
},
"daemon": {
"dir": "/sbin",
"gid": 2,
"uid": 2,
"shell": "/sbin/nologin",
"gecos": "daemon"
},
"adm": {
"dir": "/var/adm",
"gid": 4,
"uid": 3,
"shell": "/sbin/nologin",
"gecos": "adm"
},
"lp": {
"dir": "/var/spool/lpd",
"gid": 7,
"uid": 4,
"shell": "/sbin/nologin",
"gecos": "lp"
},
"sync": {
"dir": "/sbin",
"gid": 0,
"uid": 5,
"shell": "/bin/sync",
"gecos": "sync"
},
"shutdown": {
"dir": "/sbin",
"gid": 0,
"uid": 6,
"shell": "/sbin/shutdown",
"gecos": "shutdown"
},
"halt": {
"dir": "/sbin",
"gid": 0,
"uid": 7,
"shell": "/sbin/halt",
"gecos": "halt"
},
"mail": {
"dir": "/var/spool/mail",
"gid": 12,
"uid": 8,
"shell": "/sbin/nologin",
"gecos": "mail"
},
"uucp": {
"dir": "/var/spool/uucp",
"gid": 14,
"uid": 10,
"shell": "/sbin/nologin",
"gecos": "uucp"
},
"operator": {
"dir": "/root",
"gid": 0,
"uid": 11,
"shell": "/sbin/nologin",
"gecos": "operator"
},
"games": {
"dir": "/usr/games",
"gid": 100,
"uid": 12,
"shell": "/sbin/nologin",
"gecos": "games"
},
"gopher": {
"dir": "/var/gopher",
"gid": 30,
"uid": 13,
"shell": "/sbin/nologin",
"gecos": "gopher"
},
"ftp": {
"dir": "/var/ftp",
"gid": 50,
"uid": 14,
"shell": "/sbin/nologin",
"gecos": "FTP User"
},
"nobody": {
"dir": "/",
"gid": 99,
"uid": 99,
"shell": "/sbin/nologin",
"gecos": "Nobody"
},
"dbus": {
"dir": "/",
"gid": 81,
"uid": 81,
"shell": "/sbin/nologin",
"gecos": "System message bus"
},
"vcsa": {
"dir": "/dev",
"gid": 69,
"uid": 69,
"shell": "/sbin/nologin",
"gecos": "virtual console memory owner"
},
"ntp": {
"dir": "/etc/ntp",
"gid": 38,
"uid": 38,
"shell": "/sbin/nologin",
"gecos": ""
},
"saslauth": {
"dir": "/var/empty/saslauth",
"gid": 76,
"uid": 499,
"shell": "/sbin/nologin",
"gecos": "Saslauthd user"
},
"postfix": {
"dir": "/var/spool/postfix",
"gid": 89,
"uid": 89,
"shell": "/sbin/nologin",
"gecos": ""
},
"abrt": {
"dir": "/etc/abrt",
"gid": 173,
"uid": 173,
"shell": "/sbin/nologin",
"gecos": ""
},
"haldaemon": {
"dir": "/",
"gid": 68,
"uid": 68,
"shell": "/sbin/nologin",
"gecos": "HAL daemon"
},
"sshd": {
"dir": "/var/empty/sshd",
"gid": 74,
"uid": 74,
"shell": "/sbin/nologin",
"gecos": "Privilege-separated SSH"
},
"tcpdump": {
"dir": "/",
"gid": 72,
"uid": 72,
"shell": "/sbin/nologin",
"gecos": ""
},
"ookita": {
"dir": "/home/ookita",
"gid": 500,
"uid": 500,
"shell": "/bin/bash",
"gecos": ""
}
},
"group": {
"root": {
"gid": 0,
"members": [
]
},
"bin": {
"gid": 1,
"members": [
"bin",
"daemon"
]
},
"daemon": {
"gid": 2,
"members": [
"bin",
"daemon"
]
},
"sys": {
"gid": 3,
"members": [
"bin",
"adm"
]
},
"adm": {
"gid": 4,
"members": [
"adm",
"daemon"
]
},
"tty": {
"gid": 5,
"members": [
]
},
"disk": {
"gid": 6,
"members": [
]
},
"lp": {
"gid": 7,
"members": [
"daemon"
]
},
"mem": {
"gid": 8,
"members": [
]
},
"kmem": {
"gid": 9,
"members": [
]
},
"wheel": {
"gid": 10,
"members": [
]
},
"mail": {
"gid": 12,
"members": [
"mail",
"postfix"
]
},
"uucp": {
"gid": 14,
"members": [
]
},
"man": {
"gid": 15,
"members": [
]
},
"games": {
"gid": 20,
"members": [
]
},
"gopher": {
"gid": 30,
"members": [
]
},
"video": {
"gid": 39,
"members": [
]
},
"dip": {
"gid": 40,
"members": [
]
},
"ftp": {
"gid": 50,
"members": [
]
},
"lock": {
"gid": 54,
"members": [
]
},
"audio": {
"gid": 63,
"members": [
]
},
"nobody": {
"gid": 99,
"members": [
]
},
"users": {
"gid": 100,
"members": [
]
},
"dbus": {
"gid": 81,
"members": [
]
},
"utmp": {
"gid": 22,
"members": [
]
},
"utempter": {
"gid": 35,
"members": [
]
},
"floppy": {
"gid": 19,
"members": [
]
},
"vcsa": {
"gid": 69,
"members": [
]
},
"stapusr": {
"gid": 156,
"members": [
]
},
"stapsys": {
"gid": 157,
"members": [
]
},
"stapdev": {
"gid": 158,
"members": [
]
},
"cdrom": {
"gid": 11,
"members": [
]
},
"tape": {
"gid": 33,
"members": [
]
},
"dialout": {
"gid": 18,
"members": [
]
},
"ntp": {
"gid": 38,
"members": [
]
},
"saslauth": {
"gid": 76,
"members": [
]
},
"postdrop": {
"gid": 90,
"members": [
]
},
"postfix": {
"gid": 89,
"members": [
]
},
"abrt": {
"gid": 173,
"members": [
]
},
"haldaemon": {
"gid": 68,
"members": [
"haldaemon"
]
},
"sshd": {
"gid": 74,
"members": [
]
},
"tcpdump": {
"gid": 72,
"members": [
]
},
"slocate": {
"gid": 21,
"members": [
]
},
"ookita": {
"gid": 500,
"members": [
]
}
}
},
"current_user": "root",
"uptime_seconds": 38325,
"uptime": "10 hours 38 minutes 45 seconds",
"idletime_seconds": 38257,
"idletime": "10 hours 37 minutes 37 seconds",
"hostname": "chefzero02",
"machinename": "chefzero02.ec2.tokyo",
"fqdn": "chefzero02.ec2.tokyo",
"domain": "ec2.tokyo",
"command": {
"ps": "ps -ef"
},
"dmi": {
"dmidecode_version": "2.12",
"smbios_version": "2.4",
"structures": {
"count": "10",
"size": "306"
},
"bios": {
"all_records": [
{
"record_id": "0x0000",
"size": "0",
"application_identifier": "BIOS Information",
"Vendor": "Seabios",
"Version": "0.5.1",
"Release Date": "01/01/2007",
"Address": "0xE8000",
"Runtime Size": "96 kB",
"ROM Size": "64 kB",
"Characteristics": {
"BIOS characteristics not supported": null,
"Targeted content distribution is supported": null
},
"BIOS Revision": "1.0"
}
],
"vendor": "Seabios",
"version": "0.5.1",
"release_date": "01/01/2007",
"address": "0xE8000",
"runtime_size": "96 kB",
"rom_size": "64 kB",
"bios_revision": "1.0"
},
"system": {
"all_records": [
{
"record_id": "0x0100",
"size": "1",
"application_identifier": "System Information",
"Manufacturer": "Red Hat",
"Product Name": "KVM",
"Version": "RHEL 6.2.0 PC",
"Serial Number": "Not Specified",
"UUID": "98B77220-A6A4-475E-8DA7-82A217FF6909",
"Wake-up Type": "Power Switch",
"SKU Number": "Not Specified",
"Family": "Red Hat Enterprise Linux"
}
],
"manufacturer": "Red Hat",
"product_name": "KVM",
"version": "RHEL 6.2.0 PC",
"serial_number": "Not Specified",
"uuid": "98B77220-A6A4-475E-8DA7-82A217FF6909",
"wake_up_type": "Power Switch",
"sku_number": "Not Specified",
"family": "Red Hat Enterprise Linux"
},
"chassis": {
"all_records": [
{
"record_id": "0x0300",
"size": "3",
"application_identifier": "Chassis Information",
"Manufacturer": "Red Hat",
"Type": "Other",
"Lock": "Not Present",
"Version": "Not Specified",
"Serial Number": "Not Specified",
"Asset Tag": "Not Specified",
"Boot-up State": "Safe",
"Power Supply State": "Safe",
"Thermal State": "Safe",
"Security Status": "Unknown",
"OEM Information": "0x00000000",
"Height": "Unspecified",
"Number Of Power Cords": "Unspecified"
}
],
"manufacturer": "Red Hat",
"type": "Other",
"lock": "Not Present",
"version": "Not Specified",
"serial_number": "Not Specified",
"asset_tag": "Not Specified",
"boot_up_state": "Safe",
"power_supply_state": "Safe",
"thermal_state": "Safe",
"security_status": "Unknown",
"oem_information": "0x00000000",
"height": "Unspecified",
"number_of_power_cords": "Unspecified"
},
"processor": {
"all_records": [
{
"record_id": "0x0401",
"size": "4",
"application_identifier": "End Of Table",
"Socket Designation": "CPU 1",
"Type": "RAM",
"Family": "Other",
"Manufacturer": "Bochs",
"ID": "C2 06 02 00 FF F3 8B 0F",
"Version": "Not Specified",
"Voltage": "Unknown",
"External Clock": "Unknown",
"Max Speed": "2000 MHz",
"Current Speed": "2000 MHz",
"Status": "No errors detected",
"Upgrade": "Other",
"L1 Cache Handle": "Not Provided",
"L2 Cache Handle": "Not Provided",
"L3 Cache Handle": "Not Provided",
"Location": "Other",
"Use": "System Memory",
"Error Correction Type": "Multi-bit ECC",
"Maximum Capacity": "1 GB",
"Error Information Handle": "0x0000",
"Number Of Devices": "1",
"Array Handle": "0x1000",
"Total Width": "64 bits",
"Data Width": "64 bits",
"Size": "1024 MB",
"Form Factor": "DIMM",
"Set": "None",
"Locator": "DIMM 0",
"Bank Locator": "Not Specified",
"Type Detail": "None",
"Starting Address": "0x00000000000",
"Ending Address": "0x0003FFFFFFF",
"Range Size": "1 GB",
"Physical Array Handle": "0x1000",
"Partition Width": "1",
"Physical Device Handle": "0x1100",
"Memory Array Mapped Address Handle": "0x1300",
"Partition Row Position": "1"
}
],
"socket_designation": "CPU 1",
"type": "RAM",
"family": "Other",
"manufacturer": "Bochs",
"id": "C2 06 02 00 FF F3 8B 0F",
"version": "Not Specified",
"voltage": "Unknown",
"external_clock": "Unknown",
"max_speed": "2000 MHz",
"current_speed": "2000 MHz",
"status": "No errors detected",
"upgrade": "Other",
"l1_cache_handle": "Not Provided",
"l2_cache_handle": "Not Provided",
"l3_cache_handle": "Not Provided",
"location": "Other",
"use": "System Memory",
"error_correction_type": "Multi-bit ECC",
"maximum_capacity": "1 GB",
"error_information_handle": "0x0000",
"number_of_devices": "1",
"array_handle": "0x1000",
"total_width": "64 bits",
"data_width": "64 bits",
"size": "1024 MB",
"form_factor": "DIMM",
"set": "None",
"locator": "DIMM 0",
"bank_locator": "Not Specified",
"type_detail": "None",
"starting_address": "0x00000000000",
"ending_address": "0x0003FFFFFFF",
"range_size": "1 GB",
"physical_array_handle": "0x1000",
"partition_width": "1",
"physical_device_handle": "0x1100",
"memory_array_mapped_address_handle": "0x1300",
"partition_row_position": "1"
}
},
"init_package": "init",
"root_group": "root",
"block_device": {
"ram0": {
"size": "32768",
"removable": "0"
},
"ram1": {
"size": "32768",
"removable": "0"
},
"ram2": {
"size": "32768",
"removable": "0"
},
"ram3": {
"size": "32768",
"removable": "0"
},
"ram4": {
"size": "32768",
"removable": "0"
},
"ram5": {
"size": "32768",
"removable": "0"
},
"ram6": {
"size": "32768",
"removable": "0"
},
"ram7": {
"size": "32768",
"removable": "0"
},
"ram8": {
"size": "32768",
"removable": "0"
},
"ram9": {
"size": "32768",
"removable": "0"
},
"ram10": {
"size": "32768",
"removable": "0"
},
"ram11": {
"size": "32768",
"removable": "0"
},
"ram12": {
"size": "32768",
"removable": "0"
},
"ram13": {
"size": "32768",
"removable": "0"
},
"ram14": {
"size": "32768",
"removable": "0"
},
"ram15": {
"size": "32768",
"removable": "0"
},
"loop0": {
"size": "0",
"removable": "0"
},
"loop1": {
"size": "0",
"removable": "0"
},
"loop2": {
"size": "0",
"removable": "0"
},
"loop3": {
"size": "0",
"removable": "0"
},
"loop4": {
"size": "0",
"removable": "0"
},
"loop5": {
"size": "0",
"removable": "0"
},
"loop6": {
"size": "0",
"removable": "0"
},
"loop7": {
"size": "0",
"removable": "0"
},
"sr0": {
"size": "2097151",
"removable": "1",
"model": "QEMU DVD-ROM",
"rev": "0.12",
"state": "running",
"timeout": "30",
"vendor": "QEMU"
},
"sr1": {
"size": "2097151",
"removable": "1",
"model": "QEMU DVD-ROM",
"rev": "0.12",
"state": "running",
"timeout": "30",
"vendor": "QEMU"
},
"vda": {
"size": "41943040",
"removable": "0",
"vendor": "6900"
}
},
"ohai_time": 1420377640.68401,
"recipes": [
],
"roles": [
]
},
"run_list": [
"recipe[lamp]"
],
"json_class": "Chef::Node",
"chef_type": "node",
"chef_environment": "_default",
"override": {
},
"default": {
}
}
],
"start": 0,
"total": 1
}
--- END RESPONSE ---
DEBUG: ---- HTTP Status and Header Data: ----
DEBUG: HTTP 1.1 200 OK
DEBUG: content-type: application/json
DEBUG: server: chef-zero
DEBUG: access-control-allow-origin: *
DEBUG: date: Sun, 04 Jan 2015 13:30:28 GMT
DEBUG: content-length: 36585
DEBUG: connection: close
DEBUG: ---- End HTTP Status/Header Data ----
DEBUG: Chef::HTTP calling Chef::HTTP::ValidateContentLength#handle_response
DEBUG: Content-Length validated correctly.
DEBUG: Chef::HTTP calling Chef::HTTP::RemoteRequestID#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::Authenticator#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::Decompressor#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::CookieManager#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::JSONToModelOutput#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::JSONInput#handle_response
DEBUG: Using node attribute 'fqdn' as the ssh target
DEBUG: Adding chefzero02.ec2.tokyo
DEBUG: establishing connection to chefzero02.ec2.tokyo:22
DEBUG: connection established
INFO: negotiating protocol version
DEBUG: remote is SSH-2.0-OpenSSH_5.3' DEBUG: local is
SSH-2.0-Ruby/Net::SSH_2.9.1 x86_64-linux'
DEBUG: read 840 bytes
DEBUG: received packet nr 0 type 20 len 836
INFO: got KEXINIT from server
INFO: sending KEXINIT
DEBUG: queueing packet nr 0 type 20 len 2020
DEBUG: sent 2024 bytes
INFO: negotiating algorithms
DEBUG: negotiated:
root' DEBUG: queueing packet nr 4 type 5 len 28 DEBUG: sent 52 bytes DEBUG: read 52 bytes DEBUG: received packet nr 4 type 6 len 28 DEBUG: trying none DEBUG: queueing packet nr 5 type 50 len 44 DEBUG: sent 68 bytes DEBUG: read 68 bytes DEBUG: received packet nr 5 type 51 len 44 DEBUG: allowed methods: publickey,password DEBUG: none failed DEBUG: trying publickey DEBUG: connecting to ssh-agent ERROR: could not connect to ssh-agent DEBUG: trying password ERROR: all authorization methods failed (tried none, publickey, password) WARNING: Failed to connect to chefzero02.ec2.tokyo -- Net::SSH::AuthenticationFailed: Authentication failed for user [email protected]@chefzero02.ec2.tokyo DEBUG: /usr/local/rvm/gems/ruby-2.0.0-p598/gems/net-ssh-multi-1.2.0/lib/net/ssh/multi/server.rb:193:in
rescue in new_session'new_session' DEBUG: /usr/local/rvm/gems/ruby-2.0.0-p598/gems/chef-12.0.3/lib/chef/monkey_patches/net-ssh-multi.rb:79:in
next_session'session' DEBUG: /usr/local/rvm/gems/ruby-2.0.0-p598/gems/knife-zero-1.1.2/lib/knife-zero/bootstrap_ssh.rb:19:in
block in ssh_command'each' DEBUG: /usr/local/rvm/gems/ruby-2.0.0-p598/gems/knife-zero-1.1.2/lib/knife-zero/bootstrap_ssh.rb:18:in
ssh_command'run' DEBUG: /usr/local/rvm/gems/ruby-2.0.0-p598/gems/chef-12.0.3/lib/chef/knife.rb:417:in
block in run_with_pretty_exceptions'with_server_connectivity' DEBUG: /usr/local/rvm/gems/ruby-2.0.0-p598/gems/chef-12.0.3/lib/chef/knife.rb:416:in
run_with_pretty_exceptions'run' DEBUG: /usr/local/rvm/gems/ruby-2.0.0-p598/gems/chef-12.0.3/lib/chef/application/knife.rb:139:in
run'<top (required)>' DEBUG: /usr/local/rvm/gems/ruby-2.0.0-p598/bin/knife:23:in
load'<main>' DEBUG: /usr/local/rvm/gems/ruby-2.0.0-p598/bin/ruby_executable_hooks:15:in
eval'<main>' /usr/local/rvm/gems/ruby-2.0.0-p598/gems/knife-zero-1.1.2/lib/knife-zero/bootstrap_ssh.rb:20:in
block in ssh_command': undefined method forward' for nil:NilClass (NoMethodError) from /usr/local/rvm/gems/ruby-2.0.0-p598/gems/knife-zero-1.1.2/lib/knife-zero/bootstrap_ssh.rb:18:in
each'ssh_command' from /usr/local/rvm/gems/ruby-2.0.0-p598/gems/chef-12.0.3/lib/chef/knife/ssh.rb:514:in
run'block in run_with_pretty_exceptions' from /usr/local/rvm/gems/ruby-2.0.0-p598/gems/chef-12.0.3/lib/chef/local_mode.rb:38:in
with_server_connectivity'run_with_pretty_exceptions' from /usr/local/rvm/gems/ruby-2.0.0-p598/gems/chef-12.0.3/lib/chef/knife.rb:213:in
run'run' from /usr/local/rvm/gems/ruby-2.0.0-p598/gems/chef-12.0.3/bin/knife:25:in
<top (required)>'load' from /usr/local/rvm/gems/ruby-2.0.0-p598/bin/knife:23:in
'eval' from /usr/local/rvm/gems/ruby-2.0.0-p598/bin/ruby_executable_hooks:15:in
'以上、ご確認のほどよろしくお願い致します。
I can think of two options that would not tread on what knife bootstrap
already do:
node/#{fqdn}.json
for the run-list and programmatically add it as default to option :first_boot_attributes
net-scp
to send over the node object, and run against that file rather than the default empty one that chef comes with:
When I start knife zero (e.g. to bootstrap an empty vagrant box or a digital ocean machine), the chef run complains that nothing can be found. When I start the bootstrap and let it hang when it asks for a password for ssh and check the chef-zero instance, the server is empty. Something must be wrong in my config it seems. However, I followed all the documentation I could found strictly.
My knife.rb file contents
cookbook_path [File.expand_path('../../cookbooks' , __FILE__), File.expand_path('../../site-cookbooks' , __FILE__)]
node_path File.expand_path('../../nodes' , __FILE__)
role_path File.expand_path('../../roles' , __FILE__)
environment_path File.expand_path('../../environments' , __FILE__)
data_bag_path File.expand_path('../../data_bags' , __FILE__)
encrypted_data_bag_secret "encrypted_data_bag_secret"
local_mode true
knife[:bootstrap_version] = "12.4.1"
knife[:berkshelf_path] = "cookbooks"
And my roles are in json format.
T/O
If possible, relocation to core.
ニホンゴ チョットデキル
Reported by @nhatnguyen26.
Starting first Chef Client run...
172.17.204.110 Starting Chef Client, version 12.3.0
172.17.204.110 Creating a new client identity for 172.17.204.110 using the validator key.
172.17.204.110
172.17.204.110 ================================================================================
172.17.204.110 Chef encountered an error attempting to create the client "172.17.204.110"
172.17.204.110 ================================================================================
172.17.204.110
172.17.204.110 Invalid Redirect:
172.17.204.110 -----------------
172.17.204.110 Change your server location in client.rb to the server's FQDN to avoid unwanted redirections.
172.17.204.110
172.17.204.110 [2015-05-13T23:39:55+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
172.17.204.110 Chef Client failed. 0 resources updated in 1.935715501 seconds
172.17.204.110 [2015-05-13T23:39:55+00:00] ERROR: POST request was redirected from http://127.0.0.1:8889/clients to http://172.17.204.110. Only GET and HEAD support redirects.
172.17.204.110 [2015-05-13T23:39:55+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
i suddenly have this problem
how can I fix this?
ENV
Title says it all, how easy would it be to migrate from knife-solo using berkshelf to knife-zero?
Thanks
I currently have a step in my projects where berks vendor cookbooks
must be run in order to generate the cookbooks_path for the chef repo. I could imagine this leading to confusion if the Berksfile is updated, but the cookbook path is not re-vendored. Might be nice if this happened automatically (as knife-solo does). We could steal the code from knife-solo :)
Firstly, amazing great project! So glad it exists, and migrating from chef-solo/knife-solo now.
So yeah, wondering whether another command would be more intuitive, as I didn't realize what the knife zero chef_client QUERY
command meant until my second attempt to sort out this plugin :)
I might suggest knife zero converge QUERY
, which takes a note from test-kitchen
terminology, which many folks know. It's also less alienating for those coming from chef-solo, who might not even really care that chef-client is being run remotely, and are just thinking "I've heard chef-zero is the replacement for chef-solo" (I'll admit this was my mental model, having migrated my test-kitchen and vagrant setups to chef-zero in ignorance, as those tools conveniently hide the complexity of the change)
Related: chef/chef#2999
Hi,
I think knife-zero and chef-provisioning could be a great combination:
Chef-Provisioning is cookbook-as-a-gem that provides various resources to spin up nodes in the cloud and converge them using Chef's native cookbook DSL. https://github.com/chef/chef-provisioning
It also can spin up a local chef-zero instance and forward the port to the nodes, which run chef-client -z.
Ideally, one would use chef-provisioning to create a fleet of nodes and use knife-zero to manage them individually in the future.
Afaik, the only issue that prevents this currently, is the different port that knife-zero and chef-provisioning use to forward the local chef-zero service to the nodes (configured in /etc/chef/client.rb while bootstrapping).
Here is a chef-provisioning example (needs chef-provisioning and chef-provisioning-google):
https://gist.github.com/rmoriz/f293ca1402591c5469ae
The downsite of chef-provisioning is, that you can only run the complete recipe, e.g. converge all nodes. This is where knife-zero would be awesome.
テストケースをうまく作れたら。
Hi. It looks like knife zero uses Chef version 11.12.2, but I can't figure out where this version is coming from. I have Chef 12.4.1 installed locally in my Gemfile.lock. Is it possible to have knife zero use the version of Chef that is installed locally?
Thanks!
T/O
すみません、本家のMLに流した後、ここのIssueの議論に気づきました。
私の環境で試したところ、kinfe zeroの環境だと、Chef 12.x だと、knife zero bootstrap
が下記のように動作しないようです。Gemfileでバージョンを11.x系にすると動作しました。エラーメッセージだけみると、何かの設定ファイルをミスっているように見えるのでとてもはまりました orz エラーメッセージは
下記の通りです。
Exception: NameError: undefined local variable or method `chef_version' for #<Chef::Knife::Core::BootstrapContext:0x007fe716eab550>
その後は快適です。いいpluginをありがとうございました。
一応本家に投げたやつを貼っておきます。
Hi Chefs,
I'm trying knife zero plugin.
But it doesn't work on chef 12.x but it works on chef 11.x.
Can I use knife zero plugin on chef 12.x?
or Anything wrong with my procedure?
Knife zero's author seems to remove the dependency on purpose.
$ chef generate repo test
$ cd test
$ mkdir .chef
$ vi Gemfile
$ bundle install
$ echo "local_mode true" >> .chef/knife.rb
$ bundle exec knife zero bootstrap test_ubuntu -x vagrant --sudo
Connecting to test_ubuntu
ERROR: knife encountered an unexpected error
This may be a bug in the 'zero bootstrap' knife command or plugin
Please collect the output of this command with the `-VV` option before filing a bug report.
Exception: NameError: undefined local variable or method `chef_version' for #<Chef::Knife::Core::BootstrapContext:0x007fe716eab550>
http://tcotav.github.io/chefdk_getting_started.html
Gemfile
gem "chef"
gem "knife-zero"
gem "berkshelf"
Gemfile.lock
:
chef (12.0.3)
chef-zero (~> 3.2)
:
I changed Gemfile. Like this.
Gemfile
gem "chef", "11.16.4"
gem "knife-zero"
gem "berkshelf"
Then it works.
$ rm Gemfile.lock
$ bundle install
$ bundle exec knife zero bootstrap test_ubuntu -x vagrant --sudo
ffi-yajl/json_gem is deprecated, these monkeypatches will be dropped shortly
Connecting to test_ubuntu
test_ubuntu Starting first Chef Client run...
test_ubuntu Starting Chef Client, version 11.8.2
test_ubuntu resolving cookbooks for run list: []
test_ubuntu Synchronizing Cookbooks:
test_ubuntu Compiling Cookbooks...
test_ubuntu [2014-12-24T05:08:50+00:00] WARN: Node vagrant-ubuntu-trusty-64 has an empty run list.
test_ubuntu Converging 0 resources
test_ubuntu Chef Client finished, 0 resources updated
Gemfile.lock
:
chef (11.16.4)
chef-zero (~> 2.1, >= 2.1.4)
:
Regards,
Tsuyoshi
Knife-solo does this and it's pretty convenient:
It's a little less elegant here, as chef_client takes a QUERY argument right now. It might make a little more sense if #33 were a thing, and a non-query was assumed to be a key for fqdn.
This would allow the process to go from:
knife zero bootstrap myproject-vagrant --ssh-user=vagrant --run-list='role[myproject]'
# creates my user on the machine, as it would on a remote server
zero chef_client name:cmha-local --ssh-user=patcon --sudo
to this:
knife zero bootstrap vagrant@myproject-vagrant --run-list='role[myproject]'
knife zero chef_client patcon@cmha-local --sudo
Which seems a bit cleaner for project setup instructions
Just want to check as the documentation doesn't mention it
I'm wondering about that nodes/ folder - can I consider it read only, just reflecting ohai data?
This feels different to how Chef Server works where I could edit a node's runlist in the Nodes tab.
Thanks, M.
Chef12 integrates with chef-vault.
e.g. for box ubuntu/trusty64; for chef/centos-6.6 it doesn't happen
The command I use is knife zero bootstrap localhost -N vagrant -E production -u vagrant -r 'role[imindsx_aegir_base]' -P vagrant -p 2222
This should work fine. I don't understand why it then gives me as output:
Connecting to localhost
root@localhost's password:
While I clearly put vagrant as the user in the command argument.
Beofre I go down this road, can you imagine knife-zero
playing well with a plugin like knife-ec2
?
T/O
多分Chef-Zero 3.xのバグなので調べる。
chef-client should be run under sudo
Chef now recommend to run Chef with ChefDK, maybe we should give the one liner chef gem install knife-zero
to install it?
Hi. I'm trying to use knife zero with Vagrant. There are various issues related this, but one of the big issue which prevent me to make it work seems to be option parsing.
If you run knife zero --help
, the help output includes --chef-zero-host
. But it is not effective.
When I ran ./bin/knife zero bootstrap HOSTNAME --chef-zero-host 192.168.33.1
and watching
config
in BootstrapSsh#ssh_command
, it does not include :chef_zero_host
(like below), thus the option does not have any effect.
(byebug) config
{:ssh_user=>nil, :ssh_password=>nil, :ssh_port=>nil, :ssh_gateway=>nil, :forward_agent=>nil, :identity_file=>nil, :manual=>true, :host_key_verify=>true, :on_error=>:raise, :attribute_from_cli=>nil, :attribute=>"fqdn"}
I guess it is because you have subclassed ZeroBootstrap
from Chef::Knife::Bootstrap
.
Perhaps this is an issue with json objects in general (as compared to ruby), but I've always been in the habit of using nil
to unset default attrs. When setting null
in a json role, it seems it's just ignored and the default is used.
Missing winrm support.
My normal bootstrap is thus:
knife bootstrap windows winrm -r -VV -P
This does not work with knife zero.
I am trying the following:
knife zero bootstrap node.foo.net --ssh-user myuser --ssh-password 'mypass' --no-converge -z
But I'm still subsequently prompted for a password. SSH keys are not allowed in this particular environment.
Doing this results in failure:
~/blendive/kitchens/project-kitchen (feature/knife-zero ✘)✹✭ ᐅ vagrant ssh-config >> ~/.ssh/config
~/blendive/kitchens/project-kitchen (feature/knife-zero ✘)✹✭ ᐅ knife zero chef_client name:knife-zero-test
WARNING: Failed to connect to knife-zero-test -- Net::SSH::AuthenticationFailed: Authentication failed for user [email protected]@knife-zero-test
ERROR: NoMethodErrorundefined method `forward' for nil:NilClass
ERROR: /home/patcon/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/knife-zero-1.5.0/lib/knife-zero/bootstrap_ssh.rb:22:in `block in ssh_command'
/home/patcon/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/knife-zero-1.5.0/lib/knife-zero/bootstrap_ssh.rb:20:in `each'
/home/patcon/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/knife-zero-1.5.0/lib/knife-zero/bootstrap_ssh.rb:20:in `ssh_command'
/home/patcon/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/chef-12.3.0/lib/chef/knife/ssh.rb:526:in `run'
It would seem to make sense if knife recognized the user in the ssh config setting, and used it as the --ssh-user
if not explicitly overridden with flag usage.
Let me know your thoughts and I can investigate what's needed :)
It seems that even when there's a node/example.com.json
, knife zero chef_client example.com
doesn't work, and instead, we must use knife zero chef_client name:example.com
Would be great if knife-zero
assumed a default key, either name
or fqdn
(I prefer "name", as it should intuitiveless always match the json filename in nodes/
. Yes, in the current knife-zero this is also the fqdn, but this need not necessarily be the case in the future)
1.1.3で複数上げてもいいようにはした。
Arrayでもらってできると、よりいいのかもしれんけど。
Failing: https://circleci.com/gh/higanworks/knife-zero/tree/integration_testedge
It seems effect of changes between aa01ffb..0d93133 .
Issue #52 is fixed, so now the role i use in my run_list is resolved, but now I get "Error Syncing Cookbooks:" every time without anything extra in the error message itself. After that follows this output:
Running handlers:
localhost [2015-08-19T11:28:55+00:00] ERROR: Running exception handlers
localhost Running handlers complete
localhost [2015-08-19T11:28:55+00:00] ERROR: Exception handlers complete
localhost [2015-08-19T11:28:55+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
localhost Chef Client failed. 0 resources updated in 32.987984955 seconds
localhost [2015-08-19T11:28:55+00:00] ERROR: 404 "Not Found "
localhost [2015-08-19T11:28:55+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
It fails at different times during the sync, so no fixed time or cookbook either. What could be the issue?
on gh-pages branch. https://github.com/higanworks/knife-zero/tree/gh-pages
--- EDIT
And create an org just in case. https://github.com/orgs/knife-zero
Installed via chef gem install knife-zero
(version 1.5.0)
When I try to bootstrap a remote machine it doesn't pickup the remote machine's name:
$ knife zero bootstrap chefserver1.example.com
Node exists, overwrite it? (Y/N)
ERROR: Method Not Allowed
Response: Bad request method for '': DELETE
動作環境
Ruby 2.1.5
rubygems:
berkshelf (3.2.2)
berkshelf-api-client (1.2.0)
chef (12.0.3)
chef-zero (3.2.1)
gem install chef-zero
でインストールすると、knife時に以下のように、コンフリクトしている、とエラーが出ます。またgem install --ignore-dependencies chef-zero
でも同様。knifeのほぼすべての操作で同様のエラーがでて使用不可能な状態になります。
/Users/username/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:2112:in `raise_if_conflicts': Unable to activate knife-zero-1.0.1, because chef-12.0.3 conflicts with chef (~> 11.8) (Gem::ConflictError)
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1280:in `activate'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems.rb:198:in `rescue in try_activate'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems.rb:195:in `try_activate'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:126:in `rescue in require'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/knife-zero-1.0.1/lib/chef/knife/chef_client.rb:2:in `<top (required)>'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/knife/core/subcommand_loader.rb:35:in `load'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/knife/core/subcommand_loader.rb:35:in `block in load_commands'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/knife/core/subcommand_loader.rb:35:in `each'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/knife/core/subcommand_loader.rb:35:in `load_commands'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/knife.rb:126:in `load_commands'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/knife.rb:146:in `list_commands'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/application/knife.rb:195:in `print_help_and_exit'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/application/knife.rb:159:in `validate_and_parse_options'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/application/knife.rb:137:in `run'
from /Users/username/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/chef-12.0.3/bin/knife:25:in `<top (required)>'
from /Users/username/.rbenv/versions/2.1.5/bin/knife:23:in `load'
from /Users/username/.rbenv/versions/2.1.5/bin/knife:23:in `<main>'
また、gem install knife-zero
時にchef11の他古いバージョンのchefがインストールされているようです。まだChef 12には未対応ということでしょうか?
Would seem to make sense, as they might have theoretically caught some of the ssh_user stuff, right?
https://github.com/chef/chef/blob/master/spec/functional/knife/ssh_spec.rb
--use-sudo
option is ineffective. Modification to knife-zero/core/bootstrap_context.rb
fix the issue.
- client_path = @chef_config[:chef_client_path] || 'chef-client'
+ client_path = @config[:use_sudo] ? 'sudo ' : ''
+ client_path = @config[:chef_client_path] ? "#{client_path}#{@config[:chef_client_path]}" : "#{client_path}chef-client"
(I'm currently busy and my working directory is cluttered with other fixes, so will not send pull request, at least for now)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.