Skip to content

Instantly share code, notes, and snippets.

@netmarkjp
Last active August 29, 2015 14:04
Show Gist options
  • Save netmarkjp/dd99b87de8ba77365d5a to your computer and use it in GitHub Desktop.
Save netmarkjp/dd99b87de8ba77365d5a to your computer and use it in GitHub Desktop.
install docker(latest) + nsenter(2.24.2) with ansible
- hosts: all
sudo: yes
tasks:
- apt: upgrade=yes update_cache=yes cache_valid_time=86400
- apt: name={{ item }} state=installed
with_items:
- git
- etckeeper
- apt: name={{ item }} state=installed
with_items:
- vim
- curl
- tmux
- man
- strace
- telnet
- dstat
- apt: name={{ item }} state=installed
with_items:
- apt-transport-https
- apt: update_cache=yes
- apt_key: keyserver=hkp://keyserver.ubuntu.com:80 id=36A1D7869245C8950F966E92D8576A8BA88D21E9
ignore_errors: True
- lineinfile: dest=/etc/apt/sources.list.d/docker.list line='deb https://get.docker.io/ubuntu docker main' create=yes
- apt: name={{ item }} state=installed update_cache=yes
with_items:
- lxc-docker
- lineinfile: dest=/etc/default/docker line='DOCKER_OPTS="$DOCKER_OPTS -H tcp://0.0.0.0:2375"'
notify: restart docker
- lineinfile: dest=/etc/default/docker line='DOCKER_OPTS="$DOCKER_OPTS -H unix:///var/run/docker.sock"'
notify: restart docker
- service: name=docker enabled=yes state=started
- apt: name={{ item }} state=installed
with_items:
- build-essential
- pkg-config
- autoconf
- libtool
- autopoint
- git: repo=git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git dest=/usr/local/src/util-linux version=v2.24.2
register: nsenter_clone
- shell: cd /usr/local/src/util-linux ; ./autogen.sh && ./configure --without-ncurses && make nsenter && cp -f nsenter /usr/local/bin/.
when: nsenter_clone|changed
handlers:
- name: restart docker
service: name=docker state=restarted
@netmarkjp
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment