-
Notifications
You must be signed in to change notification settings - Fork 54
/
tfw.yml
81 lines (81 loc) · 2.75 KB
/
tfw.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
description: Travis Tiny Floating Whale
variables:
aws_access_key: "{{ env `AWS_ACCESS_KEY` }}"
aws_secret_key: "{{ env `AWS_SECRET_KEY` }}"
gce_account_file: "{{ env `GCE_ACCOUNT_FILE` }}"
gce_image_name: tfw-{{ timestamp }}-<%= git_desc %>
gce_project_id: "{{ env `GCE_PROJECT_ID` }}"
travis_cookbooks_branch: "{{ env `TRAVIS_COOKBOOKS_BRANCH` }}"
travis_cookbooks_sha: "{{ env `TRAVIS_COOKBOOKS_SHA` }}"
travis_subnet_id: "{{ env `TRAVIS_SUBNET_ID` }}"
travis_vpc_id: "{{ env `TRAVIS_VPC_ID` }}"
<% if !ENV['PACKER_TEMPLATES_BRANCH'].to_s.empty? %>
clean_packer_templates_branch: <%= ENV['PACKER_TEMPLATES_BRANCH'].gsub(/[^-a-zA-Z0-9]/, '-').gsub(/^-/, '').gsub(/-$/, '') %>
<% else %>
clean_packer_templates_branch: notset
<% end %>
<% if !ENV['TRAVIS_COOKBOOKS_BRANCH'].to_s.empty? %>
clean_travis_cookbooks_branch: <%= ENV['TRAVIS_COOKBOOKS_BRANCH'].gsub(/[^-a-zA-Z0-9]/, '-').gsub(/^-/, '').gsub(/-$/, '') %>
<% else %>
clean_travis_cookbooks_branch: notset
<% end %>
builders:
- type: googlecompute
name: googlecompute
communicator: ssh
ssh_timeout: 10m
ssh_port: 22
ssh_username: tfw
image_description: Travis Tiny Floating Whale
account_file: "{{ user `gce_account_file` }}"
project_id: "{{ user `gce_project_id` }}"
source_image: ubuntu-1604-xenial-v20190807
zone: us-central1-a
image_name: "{{ user `gce_image_name` }}"
machine_type: n1-standard-4
tags:
- tfw
- travis-ci-packer-templates
- "cookbooks-branch-{{ user `clean_travis_cookbooks_branch` }}"
- "branch-{{ user `clean_packer_templates_branch` }}"
- type: amazon-ebs
access_key: "{{ user `aws_access_key` }}"
secret_key: "{{ user `aws_secret_key` }}"
region: us-east-1
source_ami_filter:
filters:
virtualization-type: hvm
name: "*ubuntu-xenial-16.04-amd64-server-*"
root-device-type: ebs
owners:
- 099720109477
most_recent: true
ami_name: tfw {{ isotime "2006-01-02 15:04:06" | clean_ami_name }}
instance_type: t2.large
ssh_username: ubuntu
ami_virtualization_type: hvm
tags:
role: tfw
cookbooks_branch: "{{ user `clean_travis_cookbooks_branch` }}"
branch: "{{ user `clean_packer_templates_branch` }}"
associate_public_ip_address: true
subnet_id: "{{ user `travis_subnet_id` }}"
vpc_id: "{{ user `travis_vpc_id` }}"
provisioners:
- type: shell
inline:
sudo rm -rf /var/lib/apt/lists* ;
sudo apt-get update -yqq ;
sudo apt-get install -f
- type: shell
scripts:
- packer-scripts/packer-env-dump
- packer-scripts/tfw-bootstrap
- packer-scripts/purge
- packer-scripts/install-ubuntu-mainline-kernel
- packer-scripts/cleanup
- packer-scripts/minimize
environment_vars:
- TRAVIS_OBFUSCATE_PASSWORD=1
execute_command: "{{ .Vars }} exec sudo -E -S bash '{{ .Path }}'"