From 5308556a6c28ee33b663ccb0aa7ed40c2b3fa3b6 Mon Sep 17 00:00:00 2001 From: Alejandro Huertas Herrero Date: Mon, 20 Apr 2020 17:54:07 +0200 Subject: [PATCH] F #4215: add packet and ec2 example templates (#4498) Co-authored-by: Vlastimil Holer --- install.sh | 3 + share/oneprovision/examples/example_ec2.yaml | 73 ++++++++++++++++ .../oneprovision/examples/example_packet.yaml | 87 +++++++++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 share/oneprovision/examples/example_ec2.yaml create mode 100644 share/oneprovision/examples/example_packet.yaml diff --git a/install.sh b/install.sh index a6479acf78..15a09ef62c 100755 --- a/install.sh +++ b/install.sh @@ -686,6 +686,7 @@ INSTALL_ONEPROVISION_FILES=( ONEPROVISION_CONF_FILES:$ETC_LOCATION/cli ONEPROVISION_ANSIBLE_FILES:$SHARE_LOCATION/oneprovision ONEPROVISION_TEMPLATES_FILES:$SHARE_LOCATION/oneprovision + ONEPROVISION_EXAMPLES_FILES:$SHARE_LOCATION/oneprovision ONEPROVISION_LIB_FILES:$LIB_LOCATION/oneprovision/lib ONEPROVISION_LIB_RESOURCES_FILES:$LIB_LOCATION/oneprovision/lib/resources ONEPROVISION_LIB_PHYSICAL_R_FILES:$LIB_LOCATION/oneprovision/lib/resources/physical @@ -2358,6 +2359,8 @@ ONEPROVISION_ANSIBLE_FILES="share/oneprovision/ansible" ONEPROVISION_TEMPLATES_FILES="share/oneprovision/templates" +ONEPROVISION_EXAMPLES_FILES="share/oneprovision/examples" + ONEPROVISION_LIB_FILES="src/oneprovision/lib/ansible.rb \ src/oneprovision/lib/oneprovision.rb \ src/oneprovision/lib/driver.rb \ diff --git a/share/oneprovision/examples/example_ec2.yaml b/share/oneprovision/examples/example_ec2.yaml new file mode 100644 index 0000000000..e7a42f596d --- /dev/null +++ b/share/oneprovision/examples/example_ec2.yaml @@ -0,0 +1,73 @@ +--- + +############################################################# +# WARNING: You need to replace ***** values with your +# own credentials for the particular provider. You need to +# uncomment and update list of hosts to deploy based +# on your requirements. +############################################################# + +# Ansible playbook to configure hosts +playbook: "static_vxlan" + +# Provision name to use in all resources +name: "EC2Cluster" + +# Defaults sections with information related with Packet +defaults: + provision: + driver: "ec2" + instancetype: "i3.metal" + ec2_access: "***********************************" + ec2_secret: "***********************************" + region_name: "us-east-1" + cloud_init: true + +# Hosts to be deployed in Packet and created in OpenNebula +hosts: +# - reserved_cpu: "100" +# im_mad: "kvm" +# vm_mad: "kvm" +# provision: +# hostname: "centos-host" +# ami: "ami-66a7871c" + +# - reserved_cpu: "100" +# im_mad: "kvm" +# vm_mad: "kvm" +# provision: +# hostname: "ubuntu-host" +# ami: "ami-759bc50a" # (Ubuntu 16.04) + +# Datastores to be created in OpenNebula +datastores: + - name: "<%= @name %>-image" + ds_mad: "fs" + tm_mad: "ssh" + + - name: "<%= @name %>-system" + type: "system_ds" + tm_mad: "ssh" + +# Network to be created in OpenNebula +networks: + - name: "<%= @name %>-private-host-only-nat" + vn_mad: "dummy" + bridge: "br0" + dns: "8.8.8.8 8.8.4.4" + gateway: "192.168.150.1" + description: "Host-only private network with NAT" + ar: + - ip: "192.168.150.2" + size: "253" + type: "IP4" + + - name: "<%= @name %>-private" + vn_mad: "dummy" + bridge: "vxbr100" + mtu: "1450" + description: "Private networking" + ar: + - ip: "192.168.160.2" + size: "253" + type: "IP4" diff --git a/share/oneprovision/examples/example_packet.yaml b/share/oneprovision/examples/example_packet.yaml new file mode 100644 index 0000000000..ebe68244f7 --- /dev/null +++ b/share/oneprovision/examples/example_packet.yaml @@ -0,0 +1,87 @@ +--- + +############################################################# +# WARNING: You need to replace ***** values with your +# own credentials for the particular provider. You need to +# uncomment and update list of hosts to deploy based +# on your requirements. +############################################################# + +# Ansible playbook to configure hosts +playbook: "static_vxlan" + +# Provision name to use in all resources +name: "PacketCluster" + +# Defaults sections with information related with Packet +defaults: + provision: + driver: "packet" + packet_token: "**************************" + packet_project: "************************" + facility: "ams1" + plan: "baremetal_0" + os: "centos_7" + configuration: + iptables_masquerade_enabled: false # NAT breaks public networking + +# Hosts to be deployed in Packet and created in OpenNebula +hosts: +# - reserved_cpu: "100" +# im_mad: "kvm" +# vm_mad: "kvm" +# provision: +# hostname: "centos-host" +# os: "centos_7" + +# - reserved_cpu: "100" +# im_mad: "kvm" +# vm_mad: "kvm" +# provision: +# hostname: "ubuntu-host" +# os: "ubuntu_18_04" + +# Datastores to be created in OpenNebula +datastores: + - name: "<%= @name %>-image" + ds_mad: "fs" + tm_mad: "ssh" + + - name: "<%= @name %>-system" + type: "system_ds" + tm_mad: "ssh" + +# Network to be created in OpenNebula +networks: + - name: "<%= @name %>-private-host-only" + vn_mad: "dummy" + bridge: "br0" + description: "Host-only private network" + gateway: "192.168.150.1" + ar: + - ip: "192.168.150.2" + size: "253" + type: "IP4" + + - name: "<%= @name %>-private" + vn_mad: "dummy" + bridge: "vxbr100" + mtu: "1450" + description: "Private networking" + ar: + - ip: "192.168.160.2" + size: "253" + type: "IP4" + + - name: "<%= @name %>-public" + vn_mad: "alias_sdnat" + external: "yes" + description: "Public networking" + ar: + - size: "4" # select number of public IPs + type: "IP4" + ipam_mad: "packet" + packet_ip_type: "public_ipv4" + facility: "ams1" + packet_token: "********************************" + packet_project: "******************************"