Class: Ironfan::IaasProvider::Machine

Inherits:
Resource
  • Object
show all
Defined in:
lib/ironfan/headers.rb,
lib/ironfan/provider.rb

Class Method Summary collapse

Class Method Details

.cloud_init_user_data(computer) ⇒ Object


216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/ironfan/provider.rb', line 216

def self.cloud_init_user_data(computer) 
  return <<EOF
#cloud-config
# The line above is critical - without it cloud-init will not interpret the machine
# user data as a cloud-init script.

# The following logs everything cloud init does to /var/log
output: {all: '| tee -a /var/log/cloud-init-output.log'}

# Set our hostname
manage_etc_hosts: True

cloud_init_modules:
 - bootcmd
 - resizefs
 - set_hostname
 - update_hostname
 - update_etc_hosts
 - ca-certs
 - rsyslog
 - ssh

fqdn: #{computer.server.fqdn}

bootcmd:
  # note that writefiles is not supported on precise...
  - |
mkdir -p /etc/chef
touch /etc/chef/client.pem
chmod 600 /etc/chef/client.pem
chown root:root /etc/chef/client.pem
cat > /etc/chef/client.pem << EOF
#{computer.private_key.split("\n").map {|l| "      "+l}.join("\n")}
EOF
domainname #{computer.server.fqdn}
IP=`curl 169.254.169.254/latest/meta-data/local-ipv4`;sed -i -e "s/127\.0\.1\.1/$IP/" /etc/cloud/templates/hosts.tmpl
 
chef:
 install_type: "packages"
 force_install: false
 server_url: #{Chef::Config[:chef_server_url]}
 node_name: #{computer.name}
 initial_attributes:
    chef_server: #{Chef::Config[:chef_server_url]}
    node_name: #{computer.name}
    organization: #{Chef::Config[:organization]}
    realm_name: #{computer.server.realm_name}
    cluster_name: #{computer.server.cluster_name}
    facet_name: #{computer.server.facet_name}
    facet_index: #{computer.server.index}
 validation_name: "no-validator"
 validation_key: |
    We don't need no stinking validators.
EOF
end

.shared?Boolean

A Machine lives and dies with its Computer


214
# File 'lib/ironfan/provider.rb', line 214

def self.shared?()        false;                   end