Skip to content

Instantly share code, notes, and snippets.

@dch
Last active February 3, 2016 18:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dch/86982e187e97a9b23bf5 to your computer and use it in GitHub Desktop.
Save dch/86982e187e97a9b23bf5 to your computer and use it in GitHub Desktop.
scripts used for building updated couchdb releases via launchpad
# bootstraps a remote node to respect ansible's authority
# https://gist.github.com/86982e187e97a9b23bf5
# ansible-playbook -i IP.add.re.ss, ./packagingtools.yml -u root
---
- hosts: all
become: yes
vars:
home: "{{ lookup('env', 'HOME') }}"
keys: "{{ home }}/.ssh/authorized_keys"
tasks:
- name: create ansible user if missing
user:
name=ansible
password=*
createhome=yes
system=yes
state=present
uid=666
- name: ensure system groups are present
group: name={{item}} state=present system=yes
with_items:
- admin
- ansible
- couchdb
- name: enable key-based ssh access for ansible user
authorized_key:
user: ansible
key: "{{ item }}"
with_file: "{{ keys }}"
- name: ensure sudoers.d is enabled
lineinfile:
dest=/etc/sudoers
state=present
backup=yes
regexp='^#includedir /etc/sudoers.d' line='#includedir /etc/sudoers.d'
- name: set up password-less sudo for ansible users
copy:
content='%ansible ALL=(ALL) NOPASSWD:ALL'
dest=/etc/sudoers.d/ansible
owner=root
group=root
mode=0440
- name: add admin users but remember to unlock their accounts afterwards
user: name={{item}} state=present groups=ansible,couchdb append=yes
with_items:
- dch
- kxepal
- name: install repo tools
apt: pkg={{item}} state=installed
with_items:
- python-pycurl
- python-software-properties
when: ansible_distribution == "Ubuntu"
- name: Add mosh stable repository from PPA
apt_repository: repo=ppa:keithw/mosh update_cache=yes
when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version <= 14
- name: install bat-belt ops tools
apt: pkg={{item}} state=installed
with_items:
- dstat
- htop
- sysstat
- blktrace
- iotop
- procps
- ngrep
- avahi-daemon
- yajl-tools
- tmux
- mosh
- tree
- zsh
- name: install monitoring tools
apt: pkg={{item}} state=installed
with_items:
- libyajl-dev
- libprotobuf-c-dev
- protobuf-c-compiler
- libcurl4-openssl-dev
- libnl-3-dev
- libgcrypt-dev
- name: install network tools
apt: pkg={{item}} state=installed
with_items:
- libmnl-dev
when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version >= 14
- name: install network tools
apt: pkg={{item}} state=installed
with_items:
- iproute-dev
when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version < 14
- name: install couchdb build dependencies
apt: pkg={{item}} state=installed
with_items:
- erlang-dev
- erlang-manpages
- erlang-eunit
- erlang-nox
- erlang-xmerl
- erlang-inets
- libmozjs185-dev
- autoconf
- autoconf-archive
- gnu-standards
- libicu-dev
- curl
- libcurl4-openssl-dev
- libtool
- help2man
- name: install couchdb documentation dependencies
apt: pkg={{item}} state=installed
with_items:
- texlive-latex-base
- texlive-latex-recommended
- texlive-latex-extra
- texlive-fonts-recommended
- texinfo
- name: install packaging tools
apt: pkg={{item}} state=installed
with_items:
- packaging-dev
- python-pip
- git
- quilt
- debhelper
- gnupg-agent
- pbuilder
- ruby
- bzr
- ubuntu-dev-tools
- dh-make
- build-essential
- packaging-dev
- dpkg-dev
- name: install packaging tools
apt: pkg={{item}} state=installed
with_items:
- rubygems
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version < 14
- name: install ubuntu packaging tools
apt: pkg={{item}} state=installed
with_items:
- bzr-builder
when: ansible_distribution == "Ubuntu"
- name: install updated python packages for CouchDB build dependencies
pip: name={{item}}
with_items:
- sphinx
- docutils
- http
- pygments
- name: create ramdisk mountpoint
file: path=/ramdisk state=directory mode=750 group=root owner=root
- name: create ramdisk
mount: name=/ramdisk fstype=tmpfs src=tmpfs opts=noatime,size=1024m state=mounted
- name: configure avahi to broadcast ssh availability
command: /bin/cp /usr/share/doc/avahi-daemon/examples/ssh.service /etc/avahi/services/
args:
creates: /etc/avahi/services/ssh.service
notify:
- restart avahi
handlers:
- name: restart avahi
service: name=avahi-daemon state=restarted
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "boxcutter/ubuntu1510"
config.vm.network :public_network, ip: "10.0.0.199"
config.vm.provider :vmware_fusion do |v|
v.vmx["memsize"] = "1024"
v.vmx["numvcpus"] = "2"
end
config.vm.provision "ansible" do |ansible|
ansible.host_key_checking = false
ansible.playbook = "./packagingtools.yml"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment