Added AMI tagging for AWS provider +

* minor syntax fixes
* added official Stretch manifest
This commit is contained in:
Marcin Kulisz 2016-09-22 17:19:40 +01:00
parent b63f19ec73
commit 5267d95360
7 changed files with 124 additions and 46 deletions

View file

@ -110,7 +110,7 @@ class Manifest(object):
self.system = self.data['system']
from bootstrapvz.common.releases import get_release
self.release = get_release(self.system['release'])
# The packages and plugins section is not required
# The packages and plugins sections are not required
self.packages = self.data['packages'] if 'packages' in self.data else {}
self.plugins = self.data['plugins'] if 'plugins' in self.data else {}

View file

@ -49,6 +49,9 @@ def validate_manifest(data, validator, error):
def resolve_tasks(taskset, manifest):
"""
Function setting up tasks to run for this provider
"""
from bootstrapvz.common.releases import wheezy, jessie, stable
taskset.update(task_groups.get_standard_groups(manifest))

View file

@ -3,6 +3,9 @@ $schema: http://json-schema.org/draft-04/schema#
title: EC2 manifest
type: object
properties:
tags:
type: object
minProperties: 1
provider:
type: object
properties:

View file

@ -125,3 +125,9 @@ class RegisterAMI(Task):
registration_params['sriov_net_support'] = 'simple'
info._ec2['image'] = info._ec2['connection'].register_image(**registration_params)
# Setting up tags on the AMI
if 'tags' in info.manifest.data:
raw_tags = info.manifest.data['tags']
tags = {k: v.format(**info.manifest_vars) for k, v in raw_tags.items()}
info._ec2['connection'].create_tags(info._ec2['image'], tags)

View file

@ -54,4 +54,4 @@ plugins:
username: admin
enable_modules:
cloud_init_modules:
- { module: growpart, position: 4}
- {module: growpart, position: 4}

View file

@ -0,0 +1,66 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-{%H}{%M}-ebs
tags:
Name: "Stretch 9.0 alpha"
Debian: "9.0~{%Y}{%m}{%d}"
provider:
name: ec2
virtualization: hvm
enhanced_networking: simple
# credentials:
# access-key: AFAKEACCESSKEYFORAWS
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
system:
release: stretch
architecture: amd64
bootloader: grub
charmap: UTF-8
locale: en_US
timezone: UTC
volume:
backing: ebs
partitions:
type: gpt
root:
filesystem: ext4
size: 8GiB
packages:
mirror: http://cloudfront.debian.net/debian
components:
- main
- contrib
- non-free
install:
- awscli
- python-boto
- python3-boto
- apt-transport-https
- lvm2
- ncurses-term
- parted
- cloud-init
- cloud-utils
- gdisk
- systemd
- systemd-sysv
plugins:
cloud_init:
metadata_sources: Ec2
username: admin
enable_modules:
cloud_init_modules:
- {module: growpart, position: 4}
# ec2_launch:
# security_group_ids:
# # this have to be a NONE VPC SG
# - sg-398a704f
# instance_type: m3.medium
# ssh_key: my_ssh_key
# print_public_ip: "/tmp/stretch-ami-test-ip"
# tags:
# Name: "testing-ami-{system.release}"
# Debian: "9.0~{%Y}{%m}{%d}{%H}{%M}"
# deregister_ami: false