{"id":369173,"date":"2024-05-21T03:57:48","date_gmt":"2024-05-21T03:57:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=369173"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T03:57:48","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=369173","title":{"rendered":"<span>Packer: \u043c\u0443\u043b\u044c\u0442\u0438\u0441\u0431\u043e\u0440\u043a\u0430, \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/105\/f14\/fde\/105f14fde500ed74f91c2e8c82334601.png\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/105\/f14\/fde\/105f14fde500ed74f91c2e8c82334601.png\"\/><\/figure>\n<p><em>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/em><\/p>\n<p><strong>Packer<\/strong> \u2014 \u044d\u0442\u043e <em>open-source<\/em> \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f <strong>\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0437\u043e\u0432<\/strong> \u0434\u043b\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u0422.\u0435 \u0441 \u043f\u0430\u043a\u0435\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0434\u043b\u044f <em>Amazon<\/em> <em>EC2<\/em>, <em>VMware<\/em>, <em>Docker<\/em> \u0438 \u0442.\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <strong>\u0435\u0434\u0438\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438.<\/strong><\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 <strong>\u043c\u0443\u043b\u044c\u0442\u0438\u0441\u0431\u043e\u0440\u043a\u0438<\/strong>, <strong>\u043f\u043e\u0441\u0442<\/strong>&#8212;<strong>\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432<\/strong> \u0438<strong> \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445<\/strong> <strong>\u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432<\/strong>.<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433. \u0444\u0430\u0439\u043b<\/h4>\n<p>\u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u0430\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 <a href=\"https:\/\/developer.hashicorp.com\/packer\/install?product_intent=packer\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b Packer \u0432 HCL2 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d \u0432 \u0431\u043b\u043e\u043a\u0438, \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442, \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0431\u0440\u0430\u0437.<\/p>\n<p><strong>\u0411\u043b\u043e\u043a\u0438<\/strong> \u2014 \u044d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 HCL2. \u041e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0438 \u0442\u0435\u043b\u043e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0431\u043b\u043e\u043a\u0438, \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0431\u043b\u043e\u043a\u0438:<\/p>\n<ul>\n<li>\n<p><code>source<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430.<\/p>\n<\/li>\n<li>\n<p><code>build<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0431\u043e\u0440\u043a\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p><code>variable<\/code> \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><code>locals<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b<\/strong> \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0431\u043b\u043e\u043a\u0435 <code>source<\/code> \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>ami_name<\/code> \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u0438 <a href=\"https:\/\/docs.aws.amazon.com\/AWSEC2\/latest\/UserGuide\/AMIs.html\">AMI<\/a>.<\/p>\n<p><strong>\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/strong> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432. HCL2 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 HCL2 \u0434\u043b\u044f Packer:<\/p>\n<pre><code class=\"yaml\">variable \"region\" {   type    = string   default = \"us-west-2\" }  source \"amazon-ebs\" \"example\" {   ami_name      = \"packer-example-${var.region}\"   instance_type = \"t2.micro\"   region        = var.region   source_ami_filter {     filters = {       name                = \"ubuntu\/images\/*ubuntu-xenial-16.04-amd64-server-*\"       root-device-type    = \"ebs\"       virtualization-type = \"hvm\"     }     owners      = [\"099720109477\"]     most_recent = true   } }  build {   sources = [     \"source.amazon-ebs.example\"   ] }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code>region<\/code>, \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a <code>amazon-ebs<\/code> \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>example<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f AMI \u043d\u0430 \u0431\u0430\u0437\u0435 Ubuntu Xenial 16.04. \u0417\u0430\u0442\u0435\u043c, \u0432 \u0431\u043b\u043e\u043a\u0435 <code>build<\/code>, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>source.amazon-ebs.example<\/code>.<\/p>\n<h4>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043e\u0431\u0437\u043e\u0440 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430<\/h4>\n<p>\u042f\u0437\u044b\u043a HCL \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 Packer. <\/p>\n<p>HCL \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0430\u0440\u0438\u0444\u043c. \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>add<\/code>, <code>subtract<\/code>, <code>multiply<\/code>, \u0438 <code>divide<\/code>:<\/p>\n<pre><code class=\"python\">variable \"count\" {   type = number   default = 5 }  locals {   count_plus_one = add(var.count, 1)   count_double = multiply(var.count, 2) }<\/code><\/pre>\n<p><code>format<\/code>, <code>join<\/code>, <code>split<\/code>, \u0438 <code>replace<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438:<\/p>\n<pre><code class=\"python\">locals {   formatted_string = format(\"This is a %s\", \"string\")   joined_string = join(\", \", [\"Hello\", \"World\"])   splitted_array = split(\", \", \"Hello, World\")   replaced_string = replace(\"Hello, World\", \"World\", \"Packer\") }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>length<\/code>, <code>element<\/code>, <code>sort<\/code>, \u0438 <code>merge<\/code>:<\/p>\n<pre><code class=\"python\">locals {   list_example = [\"one\", \"two\", \"three\"]   list_length = length(local.list_example)   second_element = element(local.list_example, 1)   sorted_list = sort(local.list_example) }<\/code><\/pre>\n<p><code>file<\/code> \u0438 <code>templatefile<\/code>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:<\/p>\n<pre><code class=\"python\">locals {   user_data = file(\"${path.module}\/user-data.sh\")   rendered_template = templatefile(\"${path.module}\/config.tpl\", { name = \"world\" }) }<\/code><\/pre>\n<p> <code>timestamp<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043c\u0435\u0442\u043a\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438:<\/p>\n<pre><code class=\"python\">locals {   current_timestamp = timestamp() }<\/code><\/pre>\n<p><code>md5<\/code>, <code>sha1<\/code>, \u0438 <code>bcrypt<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0445\u0435\u0448\u0435\u0439 \u0441\u0442\u0440\u043e\u043a:<\/p>\n<pre><code class=\"python\">locals {   md5_hash = md5(\"Hello, World\") }<\/code><\/pre>\n<p><code>uuid<\/code> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u0430 <code>cidrsubnet<\/code> \u0438 <code>cidrhost<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u0435\u0432\u044b\u043c\u0438 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438:<\/p>\n<pre><code class=\"python\">locals {   unique_id = uuid()   subnet_address = cidrsubnet(\"10.0.0.0\/16\", 8, 0) }<\/code><\/pre>\n<h4>\u041c\u0443\u043b\u044c\u0442\u0438\u0441\u0431\u043e\u0440\u043a\u0430<\/h4>\n<p><strong>\u041c\u0443\u043b\u044c\u0442\u0438\u0441\u0431\u043e\u0440\u043a\u0430<\/strong> \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0441\u0431\u043e\u0440\u043a\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433 \u0444\u0430\u0439\u043b\u0435 Packer. <strong>\u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0441\u0431\u043e\u0440\u043a\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443<\/strong> \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0430\u043a\u0435\u0440 <strong>\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e<\/strong> <strong>\u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e<\/strong>, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043e\u0431\u0440\u0430\u0437\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<p>\u041c\u0443\u043b\u044c\u0442\u0438\u0441\u0431\u043e\u0440\u043a\u0430 \u0434\u043b\u044f Amazon EC2 \u0438 Docker:<\/p>\n<pre><code class=\"yaml\">source \"amazon-ebs\" \"amazon-linux\" {   ami_name      = \"packer-example-{{timestamp}}\"   instance_type = \"t2.micro\"   region        = \"us-west-2\"   source_ami_filter {     filters = {       name                = \"amzn2-ami-hvm-*-x86_64-gp2\"       root-device-type    = \"ebs\"       virtualization-type = \"hvm\"     }     owners     = [\"137112412989\"]     most_recent = true   } }  source \"docker\" \"ubuntu\" {   image  = \"ubuntu:18.04\"   commit = true }  build {   sources = [     \"source.amazon-ebs.amazon-linux\",     \"source.docker.ubuntu\",   ] }<\/code><\/pre>\n<p><strong>\u041e\u0431\u0430 \u043e\u0431\u0440\u0430\u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e<\/strong>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0431\u0449\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441\u0431\u043e\u0440\u043a\u0438.<\/p>\n<p>\u041c\u0443\u043b\u044c\u0442\u0438\u0441\u0431\u043e\u0440\u043a\u0430 \u0434\u043b\u044f VirtualBox \u0438 VMware:<\/p>\n<pre><code class=\"yaml\">source \"virtualbox-iso\" \"windows-10\" {   iso_url      = \"http:\/\/example.com\/windows-10.iso\"   iso_checksum = \"abc123\"   \/\/ \u0434\u043e\u043f. \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f VirtualBox }  source \"vmware-iso\" \"windows-10\" {   iso_url      = \"http:\/\/example.com\/windows-10.iso\"   iso_checksum = \"abc123\"   \/\/ \u0434\u043e\u043f. \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f VMware }  build {   sources = [     \"source.virtualbox-iso.windows-10\",     \"source.vmware-iso.windows-10\",   ] }<\/code><\/pre>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 ISO-\u043e\u0431\u0440\u0430\u0437, Packer \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0434\u0432\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0437\u0430, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<h4>\u041f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b  <\/h4>\n<p><strong>\u041f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b<\/strong> \u0432 Packer \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u0431\u043b\u043e\u043a\u0435 <code>post-processors<\/code> \u0438 <strong>\u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u044b \u043a\u0430\u043a \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438<\/strong> \u0438\u043b\u0438 \u043a\u0430\u043a <strong>\u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0437\u0430\u0434\u0430\u0447.<\/strong> Packer \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u044d\u0442\u0438 \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043e\u0431\u0440\u0430\u0437\u043e\u0432. <\/p>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043e\u0431\u0440\u0430\u0437\u0430 \u0432 Amazon S3:<\/p>\n<pre><code class=\"yaml\">post-processors {   type = \"amazon-s3\"   only = [\"amazon-ebs.ubuntu\"]   bucket = \"my-packer-images\"   region = \"us-west-2\"   key = \"packer\/{{user `version`}}\/{{.BuildName}}.ami\"   acl = \"private\" }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 <code>amazon-s3<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430 \u0434\u043b\u044f Amazon EBS \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 S3 bucket. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 bucket, \u0440\u0435\u0433\u0438\u043e\u043d, \u043f\u0443\u0442\u044c \u0438 \u043a\u043b\u044e\u0447 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Vagrant box:<\/p>\n<pre><code class=\"yaml\">post-processors {   type = \"vagrant\"   only = [\"virtualbox-iso.ubuntu\"]   output = \"builds\/ubuntu-{{user `version`}}.box\" }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 <code>vagrant<\/code> \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0437, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0434\u043b\u044f VirtualBox, \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 Vagrant box, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0435\u0433\u043e \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438.<\/p>\n<p>\u041c\u0438\u043d\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0430 Docker:<\/p>\n<pre><code class=\"yaml\">post-processors {   type = \"docker-tag\"   repository = \"user\/ubuntu\"   tag = \"latest\" } post-processors {   type = \"docker-push\"   only = [\"docker.ubuntu\"] }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b <code>docker-tag<\/code> \u0438 <code>docker-push<\/code> \u044e\u0437\u0430\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e Docker \u043e\u0431\u0440\u0430\u0437\u0430 \u0432 Docker Hub.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0446\u0435\u043f\u043e\u0447\u0435\u043a \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432:<\/p>\n<pre><code class=\"yaml\">post-processors {   sequence {     post-processors {       type = \"vagrant\"     }     post-processors {       type = \"vagrant-cloud\"       box_tag = \"myusername\/mybox\"       access_token = \"{{user `vagrant_cloud_token`}}\"     }   } }<\/code><\/pre>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><code>type<\/code>: \u0442\u0438\u043f \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>vagrant<\/code>, <code>amazon-s3<\/code>).<\/p>\n<\/li>\n<li>\n<p><code>only<\/code>: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0434\u043b\u044f \u043a\u0430\u043a\u0438\u0445 \u0441\u0431\u043e\u0440\u043e\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440.<\/p>\n<\/li>\n<li>\n<p><code>except<\/code>: \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 \u0438\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p><code>keep_input_artifact<\/code>: \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043b\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b<\/h4>\n<p>Packer \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u0443 <code>packer-sdc<\/code> \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043a\u043e\u0434\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u0430:<\/p>\n<pre><code class=\"bash\">packer-sdc plugin new -name=my-custom-plugin -type=[builder|provisioner|post-processor]<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>Builder<\/code>. Packer \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 RPC \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043f\u043b\u0430\u0433\u0438\u043d\u0430\u043c\u0438, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0430, \u0442.\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0444\u043e\u043a\u0443\u0441\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-logic:<\/p>\n<pre><code class=\"go\">package main  import (     \"github.com\/hashicorp\/packer-plugin-sdk\/packer\"     \"github.com\/hashicorp\/packer-plugin-sdk\/plugin\" )  type MyCustomBuilder struct {     \/\/ \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Builder }  func (b *MyCustomBuilder) Prepare(raws ...interface{}) ([]string, []string, error) {     \/\/ \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 }  \/\/ \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f  func main() {     server, err := plugin.Server()     if err != nil {         panic(err)     }     server.RegisterBuilder(new(MyCustomBuilder))     server.Serve() }<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b Go \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<pre><code class=\"go\">func TestMyCustomBuilder_Prepare(t *testing.T) {     \/\/ \u0442\u0435\u0441\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 Prepare \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 \u043b\u043e\u043a\u0430\u043b \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e Packer.<\/p>\n<pre><code class=\"bash\">go build -o packer-plugin-my-custom-plugin . mkdir -p ~\/.packer.d\/plugins mv packer-plugin-my-custom-plugin ~\/.packer.d\/plugins\/<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0432\u043e\u0438\u0445 Packer \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445, \u0443\u043a\u0430\u0437\u0430\u0432 \u0435\u0433\u043e \u0438\u043c\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"yaml\">{   \"builders\": [     {       \"type\": \"my-custom-plugin\",       \"some_parameter\": \"value\"     }   ] }<\/code><\/pre>\n<p><code>my-custom-plugin<\/code> &#8212; \u044d\u0442\u043e \u0442\u0438\u043f \u043f\u043b\u0430\u0433\u0438\u043d\u0430, \u0430 <code>some_parameter<\/code> &#8212; \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0432 \u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043b\u0438\u0442\u044c \u043d\u0430 \u0433\u0438\u0442 \u0441\u0432\u043e\u0435 \u0441\u043e\u043a\u0440\u043e\u0432\u0438\u0449\u0435 \u0438\u043b\u0438 \u0436\u0435 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0443 \u0441\u0435\u0431\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435.<\/p>\n<hr\/>\n<p><em>\u0421 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0430\u043c\u0438 \u043f\u0430\u043a\u0435\u0440 \u043c\u043e\u0436\u043d\u043e <\/em><a href=\"https:\/\/developer.hashicorp.com\/packer\/integrations?product_intent=packer\"><em>\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c \u0437\u0434\u0435\u0441\u044c.<\/em><\/a><em> \u0410 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u043e \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 <\/em><a href=\"https:\/\/otus.pw\/19DD\/\"><em>\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0443\u0440\u0441\u043e\u0432 \u043e\u0442 \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u043e\u0432 \u043e\u0442\u0440\u0430\u0441\u043b\u0438<\/em><\/a><em>.<\/em><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/796135\/\"> https:\/\/habr.com\/ru\/articles\/796135\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p><em>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/em><\/p>\n<p><strong>Packer<\/strong> \u2014 \u044d\u0442\u043e <em>open-source<\/em> \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f <strong>\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0437\u043e\u0432<\/strong> \u0434\u043b\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u0422.\u0435 \u0441 \u043f\u0430\u043a\u0435\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0434\u043b\u044f <em>Amazon<\/em> <em>EC2<\/em>, <em>VMware<\/em>, <em>Docker<\/em> \u0438 \u0442.\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <strong>\u0435\u0434\u0438\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438.<\/strong><\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 <strong>\u043c\u0443\u043b\u044c\u0442\u0438\u0441\u0431\u043e\u0440\u043a\u0438<\/strong>, <strong>\u043f\u043e\u0441\u0442<\/strong>&#8212;<strong>\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432<\/strong> \u0438<strong> \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445<\/strong> <strong>\u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432<\/strong>.<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433. \u0444\u0430\u0439\u043b<\/h4>\n<p>\u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u0430\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 <a href=\"https:\/\/developer.hashicorp.com\/packer\/install?product_intent=packer\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b Packer \u0432 HCL2 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d \u0432 \u0431\u043b\u043e\u043a\u0438, \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442, \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0431\u0440\u0430\u0437.<\/p>\n<p><strong>\u0411\u043b\u043e\u043a\u0438<\/strong> \u2014 \u044d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 HCL2. \u041e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0438 \u0442\u0435\u043b\u043e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0431\u043b\u043e\u043a\u0438, \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0431\u043b\u043e\u043a\u0438:<\/p>\n<ul>\n<li>\n<p><code>source<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430.<\/p>\n<\/li>\n<li>\n<p><code>build<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0431\u043e\u0440\u043a\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p><code>variable<\/code> \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><code>locals<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b<\/strong> \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0431\u043b\u043e\u043a\u0435 <code>source<\/code> \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>ami_name<\/code> \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u0438 <a href=\"https:\/\/docs.aws.amazon.com\/AWSEC2\/latest\/UserGuide\/AMIs.html\">AMI<\/a>.<\/p>\n<p><strong>\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/strong> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432. HCL2 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 HCL2 \u0434\u043b\u044f Packer:<\/p>\n<pre><code class=\"yaml\">variable \"region\" {   type    = string   default = \"us-west-2\" }  source \"amazon-ebs\" \"example\" {   ami_name      = \"packer-example-${var.region}\"   instance_type = \"t2.micro\"   region        = var.region   source_ami_filter {     filters = {       name                = \"ubuntu\/images\/*ubuntu-xenial-16.04-amd64-server-*\"       root-device-type    = \"ebs\"       virtualization-type = \"hvm\"     }     owners      = [\"099720109477\"]     most_recent = true   } }  build {   sources = [     \"source.amazon-ebs.example\"   ] }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code>region<\/code>, \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a <code>amazon-ebs<\/code> \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>example<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f AMI \u043d\u0430 \u0431\u0430\u0437\u0435 Ubuntu Xenial 16.04. \u0417\u0430\u0442\u0435\u043c, \u0432 \u0431\u043b\u043e\u043a\u0435 <code>build<\/code>, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>source.amazon-ebs.example<\/code>.<\/p>\n<h4>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043e\u0431\u0437\u043e\u0440 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430<\/h4>\n<p>\u042f\u0437\u044b\u043a HCL \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 Packer. <\/p>\n<p>HCL \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0430\u0440\u0438\u0444\u043c. \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>add<\/code>, <code>subtract<\/code>, <code>multiply<\/code>, \u0438 <code>divide<\/code>:<\/p>\n<pre><code class=\"python\">variable \"count\" {   type = number   default = 5 }  locals {   count_plus_one = add(var.count, 1)   count_double = multiply(var.count, 2) }<\/code><\/pre>\n<p><code>format<\/code>, <code>join<\/code>, <code>split<\/code>, \u0438 <code>replace<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438:<\/p>\n<pre><code class=\"python\">locals {   formatted_string = format(\"This is a %s\", \"string\")   joined_string = join(\", \", [\"Hello\", \"World\"])   splitted_array = split(\", \", \"Hello, World\")   replaced_string = replace(\"Hello, World\", \"World\", \"Packer\") }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>length<\/code>, <code>element<\/code>, <code>sort<\/code>, \u0438 <code>merge<\/code>:<\/p>\n<pre><code class=\"python\">locals {   list_example = [\"one\", \"two\", \"three\"]   list_length = length(local.list_example)   second_element = element(local.list_example, 1)   sorted_list = sort(local.list_example) }<\/code><\/pre>\n<p><code>file<\/code> \u0438 <code>templatefile<\/code>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:<\/p>\n<pre><code class=\"python\">locals {   user_data = file(\"${path.module}\/user-data.sh\")   rendered_template = templatefile(\"${path.module}\/config.tpl\", { name = \"world\" }) }<\/code><\/pre>\n<p> <code>timestamp<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043c\u0435\u0442\u043a\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438:<\/p>\n<pre><code class=\"python\">locals {   current_timestamp = timestamp() }<\/code><\/pre>\n<p><code>md5<\/code>, <code>sha1<\/code>, \u0438 <code>bcrypt<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0445\u0435\u0448\u0435\u0439 \u0441\u0442\u0440\u043e\u043a:<\/p>\n<pre><code class=\"python\">locals {   md5_hash = md5(\"Hello, World\") }<\/code><\/pre>\n<p><code>uuid<\/code> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u0430 <code>cidrsubnet<\/code> \u0438 <code>cidrhost<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u0435\u0432\u044b\u043c\u0438 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438:<\/p>\n<pre><code class=\"python\">locals {   unique_id = uuid()   subnet_address = cidrsubnet(\"10.0.0.0\/16\", 8, 0) }<\/code><\/pre>\n<h4>\u041c\u0443\u043b\u044c\u0442\u0438\u0441\u0431\u043e\u0440\u043a\u0430<\/h4>\n<p><strong>\u041c\u0443\u043b\u044c\u0442\u0438\u0441\u0431\u043e\u0440\u043a\u0430<\/strong> \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0441\u0431\u043e\u0440\u043a\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433 \u0444\u0430\u0439\u043b\u0435 Packer. <strong>\u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0441\u0431\u043e\u0440\u043a\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443<\/strong> \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0430\u043a\u0435\u0440 <strong>\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e<\/strong> <strong>\u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e<\/strong>, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043e\u0431\u0440\u0430\u0437\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<p>\u041c\u0443\u043b\u044c\u0442\u0438\u0441\u0431\u043e\u0440\u043a\u0430 \u0434\u043b\u044f Amazon EC2 \u0438 Docker:<\/p>\n<pre><code class=\"yaml\">source \"amazon-ebs\" \"amazon-linux\" {   ami_name      = \"packer-example-{{timestamp}}\"   instance_type = \"t2.micro\"   region        = \"us-west-2\"   source_ami_filter {     filters = {       name                = \"amzn2-ami-hvm-*-x86_64-gp2\"       root-device-type    = \"ebs\"       virtualization-type = \"hvm\"     }     owners     = [\"137112412989\"]     most_recent = true   } }  source \"docker\" \"ubuntu\" {   image  = \"ubuntu:18.04\"   commit = true }  build {   sources = [     \"source.amazon-ebs.amazon-linux\",     \"source.docker.ubuntu\",   ] }<\/code><\/pre>\n<p><strong>\u041e\u0431\u0430 \u043e\u0431\u0440\u0430\u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e<\/strong>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0431\u0449\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441\u0431\u043e\u0440\u043a\u0438.<\/p>\n<p>\u041c\u0443\u043b\u044c\u0442\u0438\u0441\u0431\u043e\u0440\u043a\u0430 \u0434\u043b\u044f VirtualBox \u0438 VMware:<\/p>\n<pre><code class=\"yaml\">source \"virtualbox-iso\" \"windows-10\" {   iso_url      = \"http:\/\/example.com\/windows-10.iso\"   iso_checksum = \"abc123\"   \/\/ \u0434\u043e\u043f. \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f VirtualBox }  source \"vmware-iso\" \"windows-10\" {   iso_url      = \"http:\/\/example.com\/windows-10.iso\"   iso_checksum = \"abc123\"   \/\/ \u0434\u043e\u043f. \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f VMware }  build {   sources = [     \"source.virtualbox-iso.windows-10\",     \"source.vmware-iso.windows-10\",   ] }<\/code><\/pre>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 ISO-\u043e\u0431\u0440\u0430\u0437, Packer \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0434\u0432\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0437\u0430, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<h4>\u041f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b  <\/h4>\n<p><strong>\u041f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b<\/strong> \u0432 Packer \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u0431\u043b\u043e\u043a\u0435 <code>post-processors<\/code> \u0438 <strong>\u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u044b \u043a\u0430\u043a \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438<\/strong> \u0438\u043b\u0438 \u043a\u0430\u043a <strong>\u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0437\u0430\u0434\u0430\u0447.<\/strong> Packer \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u044d\u0442\u0438 \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043e\u0431\u0440\u0430\u0437\u043e\u0432. <\/p>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043e\u0431\u0440\u0430\u0437\u0430 \u0432 Amazon S3:<\/p>\n<pre><code class=\"yaml\">post-processors {   type = \"amazon-s3\"   only = [\"amazon-ebs.ubuntu\"]   bucket = \"my-packer-images\"   region = \"us-west-2\"   key = \"packer\/{{user `version`}}\/{{.BuildName}}.ami\"   acl = \"private\" }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 <code>amazon-s3<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430 \u0434\u043b\u044f Amazon EBS \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 S3 bucket. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 bucket, \u0440\u0435\u0433\u0438\u043e\u043d, \u043f\u0443\u0442\u044c \u0438 \u043a\u043b\u044e\u0447 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Vagrant box:<\/p>\n<pre><code class=\"yaml\">post-processors {   type = \"vagrant\"   only = [\"virtualbox-iso.ubuntu\"]   output = \"builds\/ubuntu-{{user `version`}}.box\" }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 <code>vagrant<\/code> \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0437, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0434\u043b\u044f VirtualBox, \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 Vagrant box, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0435\u0433\u043e \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438.<\/p>\n<p>\u041c\u0438\u043d\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0430 Docker:<\/p>\n<pre><code class=\"yaml\">post-processors {   type = \"docker-tag\"   repository = \"user\/ubuntu\"   tag = \"latest\" } post-processors {   type = \"docker-push\"   only = [\"docker.ubuntu\"] }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b <code>docker-tag<\/code> \u0438 <code>docker-push<\/code> \u044e\u0437\u0430\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e Docker \u043e\u0431\u0440\u0430\u0437\u0430 \u0432 Docker Hub.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0446\u0435\u043f\u043e\u0447\u0435\u043a \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432:<\/p>\n<pre><code class=\"yaml\">post-processors {   sequence {     post-processors {       type = \"vagrant\"     }     post-processors {       type = \"vagrant-cloud\"       box_tag = \"myusername\/mybox\"       access_token = \"{{user `vagrant_cloud_token`}}\"     }   } }<\/code><\/pre>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><code>type<\/code>: \u0442\u0438\u043f \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>vagrant<\/code>, <code>amazon-s3<\/code>).<\/p>\n<\/li>\n<li>\n<p><code>only<\/code>: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0434\u043b\u044f \u043a\u0430\u043a\u0438\u0445 \u0441\u0431\u043e\u0440\u043e\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440.<\/p>\n<\/li>\n<li>\n<p><code>except<\/code>: \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 \u0438\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p><code>keep_input_artifact<\/code>: \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043b\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b<\/h4>\n<p>Packer \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u0443 <code>packer-sdc<\/code> \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043a\u043e\u0434\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u0430:<\/p>\n<pre><code class=\"bash\">packer-sdc plugin new -name=my-custom-plugin -type=[builder|provisioner|post-processor]<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>Builder<\/code>. Packer \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 RPC \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043f\u043b\u0430\u0433\u0438\u043d\u0430\u043c\u0438, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0430, \u0442.\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0444\u043e\u043a\u0443\u0441\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-logic:<\/p>\n<pre><code class=\"go\">package main  import (     \"github.com\/hashicorp\/packer-plugin-sdk\/packer\"     \"github.com\/hashicorp\/packer-plugin-sdk\/plugin\" )  type MyCustomBuilder struct {     \/\/ \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Builder }  func (b *MyCustomBuilder) Prepare(raws ...interface{}) ([]string, []string, error) {     \/\/ \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 }  \/\/ \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f  func main() {     server, err := plugin.Server()     if err != nil {         panic(err)     }     server.RegisterBuilder(new(MyCustomBuilder))     server.Serve() }<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b Go \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<pre><code class=\"go\">func TestMyCustomBuilder_Prepare(t *testing.T) {     \/\/ \u0442\u0435\u0441\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 Prepare \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 \u043b\u043e\u043a\u0430\u043b \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e Packer.<\/p>\n<pre><code class=\"bash\">go build -o packer-plugin-my-custom-plugin . mkdir -p ~\/.packer.d\/plugins mv packer-plugin-my-custom-plugin ~\/.packer.d\/plugins\/<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0432\u043e\u0438\u0445 Packer \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445, \u0443\u043a\u0430\u0437\u0430\u0432 \u0435\u0433\u043e \u0438\u043c\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"yaml\">{   \"builders\": [     {       \"type\": \"my-custom-plugin\",       \"some_parameter\": \"value\"     }   ] }<\/code><\/pre>\n<p><code>my-custom-plugin<\/code> &#8212; \u044d\u0442\u043e \u0442\u0438\u043f \u043f\u043b\u0430\u0433\u0438\u043d\u0430, \u0430 <code>some_parameter<\/code> &#8212; \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0432 \u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043b\u0438\u0442\u044c \u043d\u0430 \u0433\u0438\u0442 \u0441\u0432\u043e\u0435 \u0441\u043e\u043a\u0440\u043e\u0432\u0438\u0449\u0435 \u0438\u043b\u0438 \u0436\u0435 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0443 \u0441\u0435\u0431\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435.<\/p>\n<hr\/>\n<p><em>\u0421 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0430\u043c\u0438 \u043f\u0430\u043a\u0435\u0440 \u043c\u043e\u0436\u043d\u043e <\/em><a href=\"https:\/\/developer.hashicorp.com\/packer\/integrations?product_intent=packer\"><em>\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c \u0437\u0434\u0435\u0441\u044c.<\/em><\/a><em> \u0410 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u043e \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 <\/em><a href=\"https:\/\/otus.pw\/19DD\/\"><em>\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0443\u0440\u0441\u043e\u0432 \u043e\u0442 \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u043e\u0432 \u043e\u0442\u0440\u0430\u0441\u043b\u0438<\/em><\/a><em>.<\/em><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/796135\/\"> https:\/\/habr.com\/ru\/articles\/796135\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-369173","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/369173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=369173"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/369173\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=369173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=369173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=369173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}