Last active
July 10, 2017 06:24
-
-
Save christopherobin/b0e1156574ab4a56c33e7337a33830bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Ansible setup | |
# We don't want all the pip installs and various dependencies to conflict with | |
# normal yum packages, this solves the issue by creating an ansible virtualenv | |
# and tells ansible to use it | |
### | |
- hosts: all | |
become: true | |
tasks: | |
- name: "Create deployment folder" | |
file: path=/opt/deploy state=directory mode=0755 | |
tags: | |
- always | |
- name: "Install ansible dependencies" | |
package: | |
name: "{{ item }}" | |
state: present | |
with_items: | |
- python-virtualenv | |
- openssl-devel | |
tags: | |
- always | |
- name: "Install python libraries" | |
pip: | |
name: "{{ item }}" | |
state: latest | |
virtualenv: /opt/deploy | |
virtualenv_site_packages: yes | |
with_items: | |
- pip | |
- docker-py | |
tags: | |
- always | |
- name: "Tell subsequent tasks to use our deploy virtualenv" | |
set_fact: | |
ansible_python_interpreter: /opt/deploy/bin/python | |
tags: | |
- always |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment