version: 2
jobs:
build:
docker:
- image: circleci/php:7.1
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "composer.json" }}
- v1-dependencies-
- run: composer install -n --prefer-dist
- save_cache:
paths:
- ./vendor
key: v1-dependencies-{{ checksum "composer.json" }}
deploy:
- image: ansible/ansible:ubuntu1604
environment:
ANSIBLE_HOST_KEY_CHECKING: no
- run:
name: Install system packages.
command: pip install --upgrade pip && pip install ansible
key: v1-{{ .Branch }}-{{ checksum "./ansible/requirements.yml" }}
- run: ansible-galaxy install -r ansible/requirements.yml
- '/root/.ansible/roles'
- run: ansible-playbook ansible/deploy.yml -i ansible/hosts -e 'git_branch=master' -u opdavies --become
workflows:
build_test_and_deploy:
- build
- deploy:
requires: