mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-08 21:17:43 +03:00
parent
61d43e8e50
commit
b1964b86d1
@ -5,6 +5,7 @@
|
||||
src: ifcfg.j2
|
||||
dest: /etc/sysconfig/network-scripts/ifcfg-{{ networking_iface }}
|
||||
notify: restart network
|
||||
when: private_ip is defined
|
||||
|
||||
- name: Force all notified handlers to run now
|
||||
meta: flush_handlers
|
||||
|
23
share/oneprovision/ansible/vultr_metal.yml
Normal file
23
share/oneprovision/ansible/vultr_metal.yml
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
gather_facts: false
|
||||
roles:
|
||||
- python
|
||||
|
||||
- hosts: nodes
|
||||
roles:
|
||||
- ddc
|
||||
- opennebula-repository
|
||||
- { role: opennebula-node-kvm, when: oneprovision_hypervisor == 'kvm' or oneprovision_hypervisor == 'qemu' }
|
||||
- { role: opennebula-node-firecracker, when: oneprovision_hypervisor == 'firecracker' }
|
||||
- { role: opennebula-node-lxc, when: oneprovision_hypervisor == 'lxc' }
|
||||
- opennebula-ssh
|
||||
- role: iptables
|
||||
iptables_base_rules_services:
|
||||
- { protocol: 'tcp', port: 22 }
|
||||
# TCP/179 bgpd (TODO: only needed on Route Refector(s))
|
||||
- { protocol: 'tcp', port: 179 }
|
||||
# TCP/8742 default VXLAN port on Linux (UDP/4789 default IANA)
|
||||
- { protocol: 'udp', port: 8472 }
|
||||
- update-replica
|
@ -0,0 +1,23 @@
|
||||
name: 'vultr-london'
|
||||
|
||||
description: 'Edge cluster in Vultr London'
|
||||
provider: 'vultr_metal'
|
||||
|
||||
plain:
|
||||
image: 'VULTR'
|
||||
location_key: 'region'
|
||||
provision_type: 'metal'
|
||||
|
||||
connection:
|
||||
key: 'Vultr key'
|
||||
region: 'lhr'
|
||||
|
||||
inputs:
|
||||
- name: 'vultr_os'
|
||||
type: 'list'
|
||||
options:
|
||||
- '362'
|
||||
- name: 'vultr_plan'
|
||||
type: 'list'
|
||||
options:
|
||||
- 'vbm-8c-132gb'
|
@ -34,7 +34,7 @@ inputs:
|
||||
- name: 'vultr_plan'
|
||||
type: text
|
||||
description: "Vultr plan (device type)"
|
||||
default: 'vc2-1c-1gb'
|
||||
default: 'vbm-8c-132gb'
|
||||
|
||||
- name: 'vultr_os'
|
||||
type: text
|
||||
|
@ -29,13 +29,13 @@ networks:
|
||||
vultr_ip_type: 'v4'
|
||||
ipam_mad: 'vultr'
|
||||
|
||||
vntemplates:
|
||||
- name: "${provision}-private"
|
||||
vn_mad: 'vxlan'
|
||||
phydev: 'ens7'
|
||||
automatic_vlan_id: 'yes'
|
||||
netrole: 'private'
|
||||
vxlan_mode: 'evpn'
|
||||
vxlan_tep: 'dev'
|
||||
ip_link_conf: 'nolearning='
|
||||
cluster_ids: "${cluster.0.id}"
|
||||
# vntemplates:
|
||||
# - name: "${provision}-private"
|
||||
# vn_mad: 'vxlan'
|
||||
# phydev: 'ens7'
|
||||
# automatic_vlan_id: 'yes'
|
||||
# netrole: 'private'
|
||||
# vxlan_mode: 'evpn'
|
||||
# vxlan_tep: 'dev'
|
||||
# ip_link_conf: 'nolearning='
|
||||
# cluster_ids: "${cluster.0.id}"
|
||||
|
@ -36,7 +36,7 @@ extends:
|
||||
# ansible/vultr.yml for the specific roles applied.
|
||||
#-------------------------------------------------------------------------------
|
||||
playbook:
|
||||
- vultr
|
||||
- vultr_metal
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# defaults: Common configuration attributes for provision objects
|
||||
|
@ -11,6 +11,7 @@
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
require 'opennebula/document_json'
|
||||
require 'opennebula/wait_ext'
|
||||
|
||||
|
@ -14,10 +14,10 @@ resource "vultr_bare_metal_server" "device_<%= obj['ID'] %>" {
|
||||
}
|
||||
|
||||
output "ip_<%= obj['ID'] %>" {
|
||||
value = vultr_instance.device_<%= obj['ID'] %>.main_ip
|
||||
value = vultr_bare_metal_server.device_<%= obj['ID'] %>.main_ip
|
||||
}
|
||||
|
||||
output "device_id_<%= obj['ID'] %>" {
|
||||
value = vultr_instance.device_<%= obj['ID'] %>.id
|
||||
value = vultr_bare_metal_server.device_<%= obj['ID'] %>.id
|
||||
}
|
||||
|
||||
|
@ -64,32 +64,6 @@ module OneProvision
|
||||
Base64.strict_encode64(user_data)
|
||||
end
|
||||
|
||||
# Add configuration variables to host template
|
||||
#
|
||||
# @param host [OneProvision::Host] Host information
|
||||
def add_host_vars(host)
|
||||
host.one.add_element(
|
||||
'//TEMPLATE',
|
||||
'ANSIBLE_HOST_VARS' => "private_ip=#{private_ip(host)}"
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Get private IP of an instance
|
||||
#
|
||||
# @param host [OneProvision::Host] Host information
|
||||
#
|
||||
# @return [String] Instance private IP
|
||||
def private_ip(host)
|
||||
v = ::Vultr.new(@provider.connection['KEY'])
|
||||
i = v.instance(host.one['TEMPLATE/PROVISION/DEPLOY_ID'])
|
||||
|
||||
raise OneProvisionLoopException i if ::VultrError.error?(i)
|
||||
|
||||
i['internal_ip']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -41,6 +41,33 @@ module OneProvision
|
||||
super
|
||||
end
|
||||
|
||||
# Add configuration variables to host template
|
||||
#
|
||||
# @param host [OneProvision::Host] Host information
|
||||
def add_host_vars(host)
|
||||
host.one.add_element(
|
||||
'//TEMPLATE',
|
||||
'ANSIBLE_HOST_VARS' => "private_ip=#{private_ip(host)}"
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Get private IP of an instance
|
||||
#
|
||||
# @param host [OneProvision::Host] Host information
|
||||
#
|
||||
# @return [String] Instance private IP
|
||||
def private_ip(host)
|
||||
v = ::Vultr.new(@provider.connection['KEY'])
|
||||
i = v.instance(host.one['TEMPLATE/PROVISION/DEPLOY_ID'])
|
||||
|
||||
raise OneProvisionLoopException i if ::VultrError.error?(i)
|
||||
|
||||
i['internal_ip']
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user