forked from tekniqueltd/packer-debian9
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
51 lines (41 loc) · 1.5 KB
/
.travis.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
---
language: python
python: "2.7"
# Use the new container infrastructure
sudo: false
dist: trusty
# Install ansible
addons:
apt:
packages:
- python-pip
- wget
- unzip
- jq
install:
# Install packer
- wget https://releases.hashicorp.com/packer/1.0.3/packer_1.0.3_linux_amd64.zip && unzip packer_1.0.3_linux_amd64.zip
# Install ansible and ansible-lint
- pip install ansible
- pip install ansible-lint
- pip install awscli
# Print ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=ansible/roles' > ansible/ansible.cfg
script:
# Download and checksum installer iso
- >
iso_checksum=$(jq --raw-output '.variables.iso_checksum' packer-debian9-qemu-kvm.json)
&& iso_checksum_type="$(jq --raw-output '.variables.iso_checksum_type' packer-debian9-qemu-kvm.json)"
&& iso_file_url="$(jq --raw-output '.variables.dynamic_mirror_url' packer-debian9-qemu-kvm.json)"
&& iso_file_name="$(jq --raw-output '.variables.iso_name' packer-debian9-qemu-kvm.json)"
&& wget "${iso_file_url}/${iso_file_name}"
&& ${iso_checksum_type}sum ${iso_file_name} | grep ${iso_checksum}
# Validate templates
- packer validate -var 'source_ami=ami-628ad918' ./packer-debian9-ec2ami.json
- packer validate ./packer-debian9-qemu-kvm.json
# Syntax check ansible playbook
- ansible-playbook -vvvv ansible/playbook.yml -i 'localhost,' --syntax-check
# Lint check ansible playbook
- ansible-lint ansible/playbook.yml