Skip to content

Instantly share code, notes, and snippets.

View emilgaripov's full-sized avatar

Emil Garipov emilgaripov

View GitHub Profile
provider "vsphere" {
user = "${var.vsphere_user}"
password = "${var.vsphere_password}"
vsphere_server = "${var.vsphere_server}"
version = "1.15.0"
# If you have a self-signed cert
allow_unverified_ssl = true
}
provider "vsphere" {
user = "${var.vsphere_user}"
password = "${var.vsphere_password}"
vsphere_server = "${var.vsphere_server}"
# If you have a self-signed cert
allow_unverified_ssl = true
}
data "vsphere_datacenter" "dc" {
vsphere_user = "vsphere_user"
vsphere_password = "mysupersecretpassword"
vsphere_server = "vsphere_ip_or_host_address"
vsphere_datacenter = "localhost.localdomain"
vsphere_datastore = "datastore1"
vsphere_resource_pool = "kubernetes"
vsphere_network = "VM Network"
vsphere_virtual_machine_template = "k8s-template"
vsphere_virtual_machine_name = "terraform-vsphere-clone-test"
variable "vsphere_user" {}
variable "vsphere_password" {}
variable "vsphere_server" {}
variable "vsphere_datacenter" {}
variable "vsphere_datastore" {}
variable "vsphere_resource_pool" {}
variable "vsphere_network" {}
variable "vsphere_virtual_machine_template" {}
variable "vsphere_virtual_machine_name" {}
@emilgaripov
emilgaripov / data
Last active January 30, 2022 12:39
data "vsphere_datacenter" "dc" {
name = "${var.vsphere_datacenter}"
}
data "vsphere_datastore" "datastore" {
name = "${var.vsphere_datastore}"
datacenter_id = data.vsphere_datacenter.dc.id
}
data "vsphere_resource_pool" "pool" {
provider "vsphere" {
user = var.vsphere_user
password = var.vsphere_password
vsphere_server = var.vsphere_server
# If you have a self-signed cert
allow_unverified_ssl = true
}
@emilgaripov
emilgaripov / traceroute.py
Last active September 10, 2020 13:06
traceroute.textfsm
traceroute = """
r2#traceroute 90.0.0.9 source 33.0.0.2
traceroute 90.0.0.9 source 33.0.0.2
Type escape sequence to abort.
Tracing the route to 90.0.0.9
VRF info: (vrf in name/id, vrf out name/id)
1 10.0.12.1 1 msec 0 msec 0 msec
2 15.0.0.5 0 msec 5 msec 4 msec
3 57.0.0.7 4 msec 1 msec 4 msec
4 79.0.0.9 4 msec * 1 msec
@emilgaripov
emilgaripov / name_error
Last active September 3, 2020 02:35
vlans.py
# -*- coding: utf-8 -*-
'''
Задание 4.5
Из строк command1 и command2 получить список VLANов,
которые есть и в команде command1 и в команде command2.
Результатом должен быть список: ['1', '3', '8']
Ограничение: Все задания надо выполнять используя только пройденные темы.
@emilgaripov
emilgaripov / name_error_trace
Last active September 3, 2020 02:35
NameError
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-2-44d4e36cfb4a> in <module>
18 command2 = command2.strip().split()
19 command2 = command2[-1].split(',')
---> 20 vlans = sorted(list(set(comand1 + command2)))
21 print(vlans)
22
NameError: name 'comand1' is not defined
@emilgaripov
emilgaripov / value_error_comments
Created May 5, 2020 12:29
ValueError Comment
'''
Задание 5.2
Запросить у пользователя ввод IP-сети в формате: 10.1.1.0/24
Затем вывести информацию о сети и маске в таком формате:
Network:
10 1 1 0
00001010 00000001 00000001 00000000