Skip to content

Instantly share code, notes, and snippets.

@christopherobin
Last active July 10, 2017 06:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christopherobin/b0e1156574ab4a56c33e7337a33830bc to your computer and use it in GitHub Desktop.
Save christopherobin/b0e1156574ab4a56c33e7337a33830bc to your computer and use it in GitHub Desktop.
### 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