From ac6456c6d5139b5082569378dbf77fcfef978c92 Mon Sep 17 00:00:00 2001 From: aeivanov Date: Thu, 7 Dec 2023 21:22:14 +0000 Subject: [PATCH] add folder packer --- packer/files/key.json | 8 ++++++++ packer/scripts/install_mongodb.sh | 8 ++++++++ packer/scripts/install_ruby.sh | 4 ++++ packer/ubuntu16.json | 27 +++++++++++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 packer/files/key.json create mode 100755 packer/scripts/install_mongodb.sh create mode 100755 packer/scripts/install_ruby.sh create mode 100644 packer/ubuntu16.json diff --git a/packer/files/key.json b/packer/files/key.json new file mode 100644 index 0000000..a042848 --- /dev/null +++ b/packer/files/key.json @@ -0,0 +1,8 @@ +{ + "id": "ajegg8175h1q90thaise", + "service_account_id": "ajeo9k17dj25iuj6h5au", + "created_at": "2023-12-07T20:04:07.729402726Z", + "key_algorithm": "RSA_2048", + "public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtQ6f1kCIJbJFcDeYXRnQ\n61/1j7RbT3OsFUaetHP3WEZUx4Tr2RzjnnOjLUVkRIjjU/0Y8VWGLQx2b3bmBZ4P\nbngq+WtySVei+jLVk8o+gpK4AriuX5J15G/CfuOBgrCaXZok/YSi7h8ni7TU1YF6\nkjmUV/3JRZPG08xuiZh5pvATcpTlLUMopWCdhhGoci4B0QjX2pPl1d27u/thdu0O\nLe5RZX0k9jhC6v3T/FMPNpMPxUxnctejxpz+OWGuOdW0MPJPKL50C5WlB58M2EPI\nMahfmnRLkLZV4Yr4fR6Si+cvZIYQNKWeUURTYRxlqLCcnf+9We6hf9MuylJP24rd\n/QIDAQAB\n-----END PUBLIC KEY-----\n", + "private_key": "PLEASE DO NOT REMOVE THIS LINE! Yandex.Cloud SA Key ID \u003cajegg8175h1q90thaise\u003e\n-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC1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JI5tnlSOW4aTnUz2cwSQtwuhqGr0iBrwc3LEI7FPad1LnHmkB\nDI2iuJh1vuuHxCxSjyt60UF4+38eYL7JwmTfpzvJEINsqx3zbjVtFPLoT1ot6ARs\nCNbSob0lJWIEFfsw06MondEetv7rQHvdYb7k99HWqACM7xcBe+yisSlkqQKBgAV0\nLxMMhNzLbf424EB+wsfo5d3aGQ0olvkAMADv5wl35cuc+csn8R4Zt6RZ3ZAGJ9gw\nNOD1sgYS73uzfW1qffumU15egwPtn1DwX1xFiq5eV89IWWupQKRmnykXS0Xucn4W\np+vX2TaHnzr+kQfIy4YdJtwcD+4gC6PVPVw/D+bzAoGBAIG4hoYliH4zpZPoeu5p\nkGAvWtgL3N5iZ8A62Bwy1qb6U5QFyUuCYKOHfL/zB4OJzpg1cmzMJQgI8pkyCDAo\nVvYpQ5DvB571rBbzeRDBKbZmJIpiGW74ELEqJSlPCnnfApbZDflRaE/L7URTXB9f\n5FeFGlxGhsg5Mmwd0eBaSPHu\n-----END PRIVATE KEY-----\n" +} \ No newline at end of file diff --git a/packer/scripts/install_mongodb.sh b/packer/scripts/install_mongodb.sh new file mode 100755 index 0000000..44cd82f --- /dev/null +++ b/packer/scripts/install_mongodb.sh @@ -0,0 +1,8 @@ +#!/bin/bash +wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add - +echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list +apt-get update +sleep 30 +apt-get install -y mongodb-org +systemctl start mongod +systemctl enable mongod diff --git a/packer/scripts/install_ruby.sh b/packer/scripts/install_ruby.sh new file mode 100755 index 0000000..7a2d563 --- /dev/null +++ b/packer/scripts/install_ruby.sh @@ -0,0 +1,4 @@ +#!/bin/bash +apt-get update +sleep 30 +apt-get install -y ruby-full ruby-bundler build-essential diff --git a/packer/ubuntu16.json b/packer/ubuntu16.json new file mode 100644 index 0000000..9166ebd --- /dev/null +++ b/packer/ubuntu16.json @@ -0,0 +1,27 @@ +{ + "builders": [ + { + "type": "yandex", + "service_account_key_file": "files/key.json", + "folder_id": "b1getl3tuf5pfgn1so0j", + "source_image_family": "ubuntu-1604-lts", + "image_name": "reddit-base-{{timestamp}}", + "image_family": "reddit-base", + "ssh_username": "ubuntu", + "platform_id": "standard-v1", + "use_ipv4_nat": true + } + ], + "provisioners": [ + { + "type": "shell", + "script": "scripts/install_ruby.sh", + "execute_command": "sudo {{.Path}}" + }, + { + "type": "shell", + "script": "scripts/install_mongodb.sh", + "execute_command": "sudo {{.Path}}" + } + ] +}