Skip to content

Instantly share code, notes, and snippets.

@mdaniel
Created March 3, 2014 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdaniel/9320856 to your computer and use it in GitHub Desktop.
Save mdaniel/9320856 to your computer and use it in GitHub Desktop.
Ansible script for CouchDB on an Ubuntu Precise box
- hosts: all
sudo: true
vars:
couchdb_version: 1.5.0
couchdb_tar_256sum: abbdb2a6433124a4a4b902856f6a8a070d53bf7a55faa7aa8b6feb7127638fef
erlang_deb: http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/esl-erlang_16.b.3-2~ubuntu~precise_amd64.deb
tasks:
- name: apt-dependencies
apt: update_cache=yes pkg={{item}} state=present
with_items:
- build-essential
- g++
- erlang-dev
- erlang-manpages
- erlang-base-hipe
- erlang-eunit
- erlang-nox
- erlang-xmerl
- erlang-inets
- libmozjs185-dev
- libicu-dev
- libcurl4-gnutls-dev
- libtool
- name: unpack couchdb.tar
shell: |
creates=/var/tmp/apache-couchdb-{{couchdb_version}}/configure
cd /var/tmp
tar xzf ~vagrant/apache-couchdb-{{couchdb_version}}.tar.gz
chown -R vagrant:vagrant apache-couchdb-*
- name: build couchdb
shell: |
su - -c "cd /var/tmp/apache-couchdb*; ./configure && make" vagrant
- name: install couchdb
shell: |
creates=/usr/local/bin/couchdb
cd /var/tmp/apache-couch*
make install
- name: cleanup build
shell: |
rm -rf /var/tmp/apache-couch*
- name: create couchdb user and group
shell: |
if grep ^couchdb /etc/passwd >/dev/null; then exit 0; fi
if grep ^couchdb /etc/group >/dev/null; then exit 0; fi
useradd --user-group --shell /bin/bash --system \
--home /usr/local/var/lib/couchdb couchdb
- name: fixup permissions
# there is no creates, but it is safe to run this multiple times
shell: |
chown -R couchdb:couchdb /usr/local/var/{lib,log,run}/couchdb
chown -R couchdb:couchdb /usr/local/etc/couchdb
chmod 0770 /usr/local/var/{lib,log,run}/couchdb /usr/local/etc/couchdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment