Here is a simple Ansible playbook to install Scrapy on an Amazon Web Services (AWS) EC2 instance. It includes all the prerequisites packages for Scrapy and is based on Python 3.5.
Note: This installs the scrapy app and not scrapyd, the scrapy daemon.

The EC2 image I used is an AWS 64 bit Linux AMI (ami-ebd02392) but it should work on any recent YUM based image.

Just save the contents below as part of an Ansible role or single playbook.

---
- name: Install Scrapy prereqs
  yum: pkg={{item}} state=present
  with_items:
    - gcc
    - python35
    - python35-devel 
    - python35-pip 
    - libxml2 
    - libxml2-devel 
    - libxslt
    - libxslt-devel
    - libffi 
    - libffi-devel 
    - openssl 
    - openssl-devel

- name: Install Scrapy
  pip:
    executable: pip-3.5
    name: scrapy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s