diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..33f18e5 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,35 @@ +version: 2 + +jobs: + deploy: + working_directory: ~/oliverdavies-uk + docker: + - image: ansible/ansible:ubuntu1604 + environment: + ANSIBLE_HOST_KEY_CHECKING: no + steps: + # Installation + - run: + name: Install System Packages + command: pip install --upgrade pip && pip install ansible + + # Dependencies + - checkout + - restore_cache: + key: oliverdavies-uk-{{ .Branch }}-{{ checksum "./tools/ansible/requirements.yml" }}-v1 + - run: ansible-galaxy install -r tools/ansible/requirements.yml + - save_cache: + key: oliverdavies-uk-{{ .Branch }}-{{ checksum "./tools/ansible/requirements.yml" }}-v1 + paths: + - '/root/.ansible/roles' + + # Deploy + - run: echo $ANSIBLE_VAULT_PASS > ./tools/ansible/.vault-pass.txt + - run: ansible-playbook tools/ansible/deploy.yml --vault-password-file=./tools/ansible/.vault-pass.txt + - run: rm ./tools/ansible/.vault-pass.txt + +workflows: + version: 2 + build_test_and_deploy: + jobs: + - deploy