},
'config' => {
'core.https_address' => '192.168.1.50:8443',
+ 'core.trust_password' => true,
+ #'storage.zfs_pool_name' => 'lxd',
},
# Ubuntu >= 16.10
'network' => {
users:
- name: alice
groups: sudo,wheel
+ shell: /bin/bash
ssh-authorized-keys:
- ssh-rsa AAAAB3Nz ...
EOS
=begin
# Examples
'core.https_address' => '192.168.1.50:8443',
+ 'core.trust_password' => true,
+ 'storage.zfs_pool_name' => 'lxd',
=end
}
# Ubuntu >= 16.10 (yakkety)
license 'Apache 2.0'
description 'Installs/Configures LinuxContainers.org products'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version '0.1.4'
+version '0.1.5'
source_url 'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git'
issues_url 'https://osdn.jp/projects/metasearch/ticket'
lxd_conf = node['lxcs']['lxd']
+# Note: LXD itself does not require this directory.
+# It is used to contain configuration files that are generated by Chef.
directory '/etc/lxd' do
owner 'root'
group 'root'
execute "lxc_network_create_#{net_name}" do
command "lxc network create #{net_name} #{opts.join(' ')}"
action :run
- not_if "lxc network list | grep #{net_name}"
+ not_if "lxc network list | grep -E '\\s#{net_name}\\s'"
end
net_yaml_file = "/etc/lxd/network_#{net_name}_by_chef.yml"
execute net_edit_exec_name do
command "cat #{net_yaml_file} | lxc network edit #{net_name} --force-local"
action :nothing
- only_if "lxc network list | grep #{net_name}"
+ only_if "lxc network list | grep -E '\\s#{net_name}\\s'"
end
execute rename_legacy_net_yaml_exec_name do
execute "lxc_profile_create_#{prof_name}" do
command "lxc profile create #{prof_name} --force-local"
action :run
- not_if "lxc profile list | grep #{prof_name}"
+ not_if "lxc profile list | grep -E '(^|\\s)#{prof_name}(\\s|$)'"
end
prof_yaml_file = "/etc/lxd/profile_#{prof_name}_by_chef.yml"
execute prof_edit_exec_name do
command "cat #{prof_yaml_file} | lxc profile edit #{prof_name} --force-local"
action :nothing
- only_if "lxc profile list | grep #{prof_name}"
+ only_if "lxc profile list | grep -E '(^|\\s)#{prof_name}(\\s|$)'"
end
file prof_yaml_file do