Skip to content

Instantly share code, notes, and snippets.

View f4rx's full-sized avatar

Aleksey Stepanenko f4rx

View GitHub Profile
@f4rx
f4rx / install.sh
Last active November 28, 2019 12:32
Install docker
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
apt-get update
apt-get -y install \
@f4rx
f4rx / .gitlab-ci.yml
Created November 28, 2019 12:37
gitlab-ci
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
GIT_STRATEGY: FETCH
stages:
- lints
- build
- test_create_infra
- tests
- test_destroy_infra
@f4rx
f4rx / main.tf
Created November 28, 2019 12:55
one-server main.tf
#############################################
# Initialize OpenStack provider
provider "openstack" {
domain_name = "${var.domain_name}"
tenant_id = "${var.project_id}"
user_name = "${var.user_name}"
password = "${var.user_password}"
auth_url = "https://api.selvpc.ru/identity/v3"
region = "${var.region}"
}
@f4rx
f4rx / main.tf
Created November 29, 2019 09:01
terraform LB octavia
###################################
# Configure the OpenStack Provider
###################################
provider "openstack" {
domain_name = "${var.domain_name}"
tenant_id = "${var.project_id}"
user_name = "${var.user_name}"
password = "${var.user_password}"
auth_url = "https://api.selvpc.ru/identity/v3"
region = "${var.region}"
@f4rx
f4rx / image_list.txt
Created January 13, 2020 09:04
image_list.txt
bash-5.0# openstack image list --public
+--------------------------------------+--------------------------------------------+--------+
| ID | Name | Status |
+--------------------------------------+--------------------------------------------+--------+
| 4bf30993-828a-4468-9c8f-5a97ebe09f7d | CentOS 7 64-bit | active |
| dede8b0e-9297-4a65-8f5a-32e82a4e0b27 | CentOS 7 Minimal 64-bit | active |
| ed14e2ad-3fad-40ea-8979-ea4ae8d805be | CentOS 8 64-bit | active |
| 88c8d109-164e-4d6f-a1a4-64fafefeb09f | CoreOS | active |
| 8be6ff81-21e1-464c-a343-c6e2ab4226c9 | Debian 10 (Buster) 64-bit | active |
| 2d548634-9a42-4497-b849-48bfa32e66db | Debian 9 (Stretch) 64-bit | active |
@f4rx
f4rx / main.tf
Created January 21, 2020 10:32
terraform-1
resource "openstack_compute_flavor_v2" "flavor-node" {
name = "node.${var.project_id}-${random_string.random_name_1.result}"
ram = var.ram
vcpus = "1"
disk = "0"
is_public = "false"
}
@f4rx
f4rx / create_server main.tf
Created January 21, 2020 12:08
terraform create server module
###################################
# Create port
###################################
resource "openstack_networking_port_v2" "port_1" {
name = "node-eth0"
network_id = var.network_id
fixed_ip {
subnet_id = var.subnet_id
@f4rx
f4rx / 1.count.md
Last active April 22, 2022 19:42
2.modules
variable "server_count" {
  default = 1
}
resource "openstack_networking_port_v2" "port_1" {
  name       = "node-${count.index}-eth0"
 count = var.server_count
@f4rx
f4rx / main.tf
Created January 22, 2020 15:03
count terraform
resource "openstack_networking_port_v2" "port" {
count = "${var.server_count}"
name = "node-${count.index}-eth0"
...
}
resource "openstack_blockstorage_volume_v3" "volume" {
count = "${var.server_count}"
name = "volume-for-node-${count.index}"
...
}
@f4rx
f4rx / server2.tf
Last active April 22, 2022 19:39
server2.tf
###################################
# Create port
###################################
resource "openstack_networking_port_v2" "port_2" {
name = "node-eth0"
network_id = openstack_networking_network_v2.network_1.id
fixed_ip {
subnet_id = openstack_networking_subnet_v2.subnet_1.id