forked from Otus-DevOps-2018-09/Kirill-Garbar_infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
51 lines (51 loc) · 2.98 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
dist: trusty
sudo: required
language: bash
env:
- PACKER_V=1.3.1 TF_V=0.11.10 TFLINT_V=0.7.2 ANS_V=2.7.1 ANSLINT_V=3.5.1
before_install:
- curl https://raw.githubusercontent.com/express42/otus-homeworks/2018-09/run.sh | bash
- sudo pip install --upgrade pip
install:
# packer
- wget https://releases.hashicorp.com/packer/${PACKER_V}/packer_${PACKER_V}_linux_amd64.zip -O packer.zip
- sudo unzip packer.zip -d /usr/bin
# #tf
- wget https://releases.hashicorp.com/terraform/${TF_V}/terraform_${TF_V}_linux_amd64.zip -O tf.zip
- sudo unzip tf.zip -d /usr/bin
# #tf-lint
- wget https://github.com/wata727/tflint/releases/download/v0.7.2/tflint_linux_amd64.zip -O tflint.zip
- sudo unzip tflint.zip -d /usr/bin
# #ans&ans-lint
- sudo pip install ansible==${ANS_V} ansible-lint==${ANSLINT_V}
- echo $PATH
before_script:
- touch ~/.ssh/appuser ~/.ssh/appuser.pub
- mv packer/variables.json.example packer/variables.json
- mv terraform/terraform.tfvars.example terraform/terraform.tfvars
- mv terraform/stage/terraform.tfvars.example terraform/stage/terraform.tfvars
- mv terraform/prod/terraform.tfvars.example terraform/prod/terraform.tfvars
script:
# packer
# Хотел здесь сделать двумя массивами и циклом, но не стал, потому что не смог объявить в блоке env массив.
# Трэвис из блока env автоматически конвертит в export, а массивы на export нельзя.
# Плюс к тому у нас два шаблона валидируются из директории packer, два шаблона из корневой.
- cd ${TRAVIS_BUILD_DIR}/packer
- packer validate -var-file=variables.json ubuntu16.json
- packer validate -var-file=variables.json immutable.json
- cd ${TRAVIS_BUILD_DIR}
- packer validate packer/app.json
- packer validate packer/db.json
# tf && tflint
- cd ${TRAVIS_BUILD_DIR}/terraform
- cd ${TRAVIS_BUILD_DIR}/terraform/stage
- terraform init -backend=false && terraform validate && tflint
- cd ${TRAVIS_BUILD_DIR}/terraform/prod
- terraform init -backend=false && terraform validate && tflint
# ansible-lint
- cd ${TRAVIS_BUILD_DIR}/ansible
- ansible-lint playbooks/*.yml --exclude=roles/jdauphant.nginx
notifications:
slack:
rooms:
secure: EhTC9IJTQ8T7wpX+rnOcidNbr/VhbenTUNnL0Trmxz0IEu5HVJVcwHs83dKdMMtwxMzQBqZByf6fobkSucSu71hJlL3tawIcGuyCOrsCDjsNSoMZTUf3gHQaM0ClU5M7jzttJEHITKUaDu2FsGkscfQeHjH+rLOObx/pf9qAch/IDBRMQ8ywcvCq03VAQGKW74Iw16qCax4c/YzCDFfJG6+HlaWkT3UifHSdXKs3+nI1bMd7WEY26lx/1dXWJf1CV/WDwI2vWPGns2jmaHxLuQLDR6wLNeMGvnyiJ4YtbB1U9TaWj5eauOG2n32ZXhl8oteNN/S8JRJB86SQLSTKbX+6ishXw3CTAPtEJqj8XcbxaA6pfG6uxxt1wBk9jn+jwB6hFfRFHU7JxgfO7lKdtE4e2fJsg++CJ1YG6QbJ8BFfBw2UAhbe+omjOaqnmcWcVwAnAt7Oq06wp7Ir3knLhyu8GOrNI9hhp3fHgda4RnH1So7ZsTiigQa7EtDOdH9rz+mS9+87uCBQjBEOqtEkWFF38f+N7W/4BGdX4jygbgDEMP4RJQkhu7P7e22mgzlnc78Cerj1N/zeHNTMndBuxdSSzdSKS4qmgjzcShqUeDHT1UHJKFB4U5cqR3NzDjjch7YQKlsaZIHDlQw0h6vMLMrDG0xwDTPC34o96OmAXMk=