OpenStack Vm create wrapper
$ gem install pec
# set up
$ pec init
create - /Pec.yaml
create - /user_data/web_server.yaml.sample
$ pec up <hostname_regex> <hostname_regex>...
$ pec destroy <hostname_regex> <hostname_regex>...
$ pec halt <hostname_regex> <hostname_regex>...
$ pec status <hostname_regex> <hostname_regex>...
$ pec list
$ pec hosts
$ pec config <hostname_regex> <hostname_regex>...
support format yaml,erb
# merge of yaml
_default_: &def
os_type: centos
tenant: your_tenant
tenant_id: your_tenan_id(using a member roll)
image: centos-7.1_chef-12.3_puppet-3.7
flavor: m1.small
availability_zone: nova
# vm config
pyama-test001:
<<: *def
networks:
eth0:
bootproto: static
allowed_address_pairs:
- 10.1.1.5/24
ip_address: 10.1.1.1/24
gateway: 10.1.1.254
dns1: 8.8.8.8
dns2: 8.8.8.8
eth1:
bootproto: dhcp
security_group:
- default
- ssh
templates:
- base.yaml
- webserver.yaml
user_data:
hostname: pyama-test001
fqdn: pyama-test001.ikemen.com
repo_releasever: 7.1.1503
pyama-test002:
<<: *def
・・・
# include config
includes:
- path/to/a.yaml
- path/to/b.yaml.erb
column | require | value |
---|---|---|
instance_name | ○ | pyama-test001* |
tenant | ○ | your_tenant |
image | ○ | centos-7.1_chef-12.3_puppet-3.7 |
flavor | ○ | m1.small |
os_type | - | centos(centos or ubuntu |
networks | - | [] |
security_group | - | [default,ssh] |
templates | - | [base.yaml,webserver.yaml] |
user_data | - | - |
availability_zone | - | nova |
- it begins with
_
instance name is yaml merge template
column | require | value |
---|---|---|
bootproto | ○ | static or dhcp |
ip_address | ※ | 10.1.1.1/24 |
path | default:/etc/sysconfig/network-scripts/ifcfg-[device_name] | |
allowed_address_pairs | [10.1.1.2/24] |
※ bootproto=static is required
Items other than the above are output to the configuration file with KEY = value
format
# example
includes:
- path/to/a.yaml
- path/to/b.yaml
Read order is this as 1.Pec.yaml 2.path/to/a.yaml 3.path/to/b.yaml
- pyama86