Module: Chef::Knife::Cloud::OpenstackServerCreateOptions

Included in:
OpenstackServerCreate
Defined in:
lib/chef/knife/cloud/openstack_server_create_options.rb

Class Method Summary collapse

Class Method Details

.included(includer) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/chef/knife/cloud/openstack_server_create_options.rb', line 24

def self.included(includer)
  includer.class_eval do
    include ServerCreateOptions

    # Openstack Server create params.
    option :private_network,
      long: "--openstack-private-network",
      description: "Use the private IP for bootstrapping rather than the public IP",
      boolean: true,
      default: false

    option :openstack_floating_ip,
      short: "-a [IP]",
      long: "--openstack-floating-ip [IP]",
      default: "-1",
      description: "Request to associate a floating IP address to the new OpenStack node. Assumes IPs have been allocated to the project. Specific IP is optional."

    option :openstack_volumes,
      long: "--openstack-volumes VOLUME1,VOLUME2,VOLUME3",
      description: "Comma separated list of the UUID(s) of the volume(s) to attach to the server",
      proc: proc { |volumes| volumes.split(",") }

    option :openstack_scheduler_hints,
      long: "--scheduler-hints HINTS",
      description: "A scheduler group hint to OpenStack"

    option :openstack_security_groups,
      short: "-G X,Y,Z",
      long: "--openstack-groups X,Y,Z",
      description: "The security groups for this server",
      default: ["default"],
      proc: proc { |groups| groups.split(",") }

    option :openstack_ssh_key_id,
      short: "-S KEY",
      long: "--openstack-ssh-key-id KEY",
      description: "The OpenStack SSH keypair id"

    option :user_data,
      long: "--user-data USER_DATA",
      description: "The file path containing user data information for this server",
      proc: proc { |user_data| open(user_data, &:read) }

    option :bootstrap_network,
      long: "--bootstrap-network NAME",
      default: "public",
      description: "Specify network for bootstrapping. Default is 'public'."

    option :network,
      long: "--no-network",
      boolean: true,
      default: true,
      description: "Use first available network for bootstrapping if 'public' and 'private' are unavailable."

    option :network_ids,
      long: "--network-ids NETWORK_ID_1,NETWORK_ID_2,NETWORK_ID_3",
      description: "Comma separated list of the UUID(s) of the network(s) for the server to attach",
      proc: proc { |networks| networks.split(",") }

    option :availability_zone,
      short: "-Z ZONE_NAME",
      long: "--availability-zone ZONE_NAME",
      description: "The availability zone for this server"

    option :metadata,
      short: "-M X=1",
      long: "--metadata X=1",
      description: "Metadata information for this server (may pass multiple times)",
      proc: proc { |data, accumulator|
        accumulator ||= {}
        accumulator.merge!(data.split("=")[0] => data.split("=")[1])
      }

    option :secret_file,
      long: "--secret-file SECRET_FILE",
      description: "A file containing the secret key to use to encrypt data bag item values"

    option :secret,
      long: "--secret ",
      description: "The secret key to use to encrypt data bag item values"
  end
end