Skip to content

Commit

Permalink
Merge branch 'fixing_1604'
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Durivage committed Feb 10, 2017
2 parents d704e56 + 0c71754 commit c2ac818
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 26 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ apt_repository: deb https://apt.dockerproject.org/repo {{ ansible_lsb.id|lower }
# -H tcp://0.0.0.0:2375
# --log-level=debug
docker_opts: ""
# List of users to be added to 'docker' system group (disabled by default)
# SECURITY WARNING: 
# Be aware that granted users can easily get full root access on the docker host system!
docker_group_members: []
# configurable proxies: a reasonable default is to re-use the proxy from ansible_env:
# docker_http_proxy: "{{ ansible_env.http_proxy|default('') }}"
Expand All @@ -86,15 +90,13 @@ docker_opts: ""
docker_http_proxy:
docker_https_proxy:
# List of users to be added to 'docker' system group (disabled by default)
# SECURITY WARNING: 
# Be aware that granted users can easily get full root access on the docker host system!
docker_group_members: []
# Flags for whether to install pip packages
pip_install_pip: true
pip_install_setuptools: true
pip_install_docker_py: true
pip_install_docker_compose: true
install_docker_py_on_1604: false
# Versions for the python packages that are installed
pip_version_pip: latest
pip_version_setuptools: latest
Expand All @@ -110,6 +112,7 @@ update_docker_package: no
# Change these to 'present' if you're running Ubuntu 12.04-13.10 and are fine with less-than-latest packages
kernel_pkg_state: latest
cgroup_lite_pkg_state: latest
dmsetup_pkg_state: latest
# Force an install of the kernel extras, in case you're suffering from some issue related to the
# static binary provided by upstream Docker. For example, see this GitHub Issue in Docker:
# https://github.com/docker/docker/issues/12750
Expand All @@ -120,7 +123,6 @@ install_kernel_extras: false
# where an X/Unit desktop is actively being used. If you're not using an X/Unity on 12.04, you
# won't need to enable this.
install_xorg_pkgs: false
```

Dependencies
Expand Down
15 changes: 13 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ boxes = [
:cpu => "33",
:ram => "256"
},
{
:name => "ubuntu-1604",
:box => "ubuntu/xenial64",
:ip => '10.0.77.13',
:cpu => "33",
:ram => "512"
},
{
:name => "debian-jessie",
:box => "debian/jessie64",
:ip => '10.0.77.13',
:ip => '10.0.77.14',
:cpu => "33",
:ram => "256"
},
Expand All @@ -34,7 +41,6 @@ Vagrant.configure("2") do |config|
config.vm.define box[:name] do |vms|
vms.vm.box = box[:box]
vms.vm.box_url = box[:url]
vms.vm.hostname = "ansible-#{role}-#{box[:name]}"

vms.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--cpuexecutioncap", box[:cpu]]
Expand All @@ -43,6 +49,11 @@ Vagrant.configure("2") do |config|

vms.vm.network :private_network, ip: box[:ip]

# neccessary for ubuntu 16.04 and harmless for the rest
vms.vm.provision :shell do |shell|
shell.inline = "DEBIAN_FRONTEND=noninteractive apt-get -y install python-simplejson"
end

vms.vm.provision :ansible do |ansible|
ansible.playbook = "tests/vagrant.yml"
ansible.verbose = "vv"
Expand Down
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ pip_install_pip: true
pip_install_setuptools: true
pip_install_docker_py: true
pip_install_docker_compose: true
install_docker_py_on_1604: false

# Versions for the python packages that are installed
pip_version_pip: latest
pip_version_setuptools: latest
Expand All @@ -51,6 +53,7 @@ kernel_update_and_reboot_permitted: no

# Set to 'yes' or 'true' to enable updates (sets 'latest' in apt module)
update_docker_package: no

# Change these to 'present' if you're running Ubuntu 12.04-13.10 and are fine with less-than-latest packages
kernel_pkg_state: latest
cgroup_lite_pkg_state: latest
Expand Down
16 changes: 8 additions & 8 deletions tasks/kernel_check_and_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- linux-image-generic-lts-trusty
- linux-headers-generic-lts-trusty
register: kernel_result
when: "ansible_distribution_version|version_compare(12.04, '=')"
when: "ansible_distribution_version|version_compare('12.04', '=')"

- name: Install Xorg packages for backported kernels (very optional)
apt:
Expand All @@ -31,8 +31,8 @@
with_items:
- "linux-image-extra-{{ ansible_kernel }}"
- linux-image-extra-virtual
when: "ansible_distribution_version|version_compare(13.04, '=')
or ansible_distribution_version|version_compare(13.10, '=')
when: "ansible_distribution_version|version_compare('13.04', '=')
or ansible_distribution_version|version_compare('13.10', '=')
or install_kernel_extras"

# Fix for https://github.com/dotcloud/docker/issues/4568
Expand All @@ -43,13 +43,13 @@
update_cache: yes
cache_valid_time: 600
register: cgroup_lite_result
when: "ansible_distribution_version|version_compare(13.10, '=')"
when: "ansible_distribution_version|version_compare('13.10', '=')"

- name: Reboot instance
command: /sbin/shutdown -r now
register: reboot_result
when: "(ansible_distribution_version|version_compare(12.04, '=') and kernel_result|changed)
or (ansible_distribution_version|version_compare(13.10, '=') and cgroup_lite_result|changed)
when: "(ansible_distribution_version|version_compare('12.04', '=') and kernel_result|changed)
or (ansible_distribution_version|version_compare('13.10', '=') and cgroup_lite_result|changed)
or xorg_pkg_result|changed"

- name: Wait for instance to come online (10 minute timeout)
Expand All @@ -61,5 +61,5 @@
delay: 30
timeout: 600
state: started
when: "(ansible_distribution_version|version_compare(12.04, '=') and reboot_result|changed)
or (ansible_distribution_version|version_compare(13.10, '=') and cgroup_lite_result|changed)"
when: "(ansible_distribution_version|version_compare('12.04', '=') and reboot_result|changed)
or (ansible_distribution_version|version_compare('13.10', '=') and cgroup_lite_result|changed)"
23 changes: 16 additions & 7 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
pkg: dmsetup
state: "{{ dmsetup_pkg_state }}"
update_cache: "{{ 'yes' if dmsetup_pkg_state=='latest' else 'no' }}"
cache_valid_time: 600
cache_valid_time: "{{ docker_apt_cache_valid_time }}"
register: dmsetup_result
when: ansible_distribution_version|version_compare('16.04', '=')

Expand Down Expand Up @@ -172,11 +172,19 @@
state: "{{ 'latest' if item.version=='latest' else 'present' }}"
version: "{{ item.version if item.version!='latest' else omit }}"
with_items:
- { name: pip, version: "{{ pip_version_pip }}", install: "{{ pip_install_pip }}" }
- { name: setuptools, version: "{{ pip_version_setuptools }}", install: "{{ pip_install_setuptools }}" }
- { name: docker-py, version: "{{ pip_version_docker_py }}", install: "{{ pip_install_docker_py }}" }
- { name: docker-compose, version: "{{ _pip_version_docker_compose }}", install: "{{ pip_install_docker_compose }}" }
when: item.install
- name: pip
version: "{{ pip_version_pip }}"
install: "{{ pip_install_pip }}"
- name: setuptools
version: "{{ pip_version_setuptools }}"
install: "{{ pip_install_setuptools }}"
- name: docker-py
version: "{{ pip_version_docker_py }}"
install: "{{ pip_install_docker_py and (install_docker_py_on_1604 or not ansible_distribution_version|version_compare('16.04', '>=')) }}"
- name: docker-compose
version: "{{ _pip_version_docker_compose }}"
install: "{{ pip_install_docker_compose }}"
when: item.install|bool

- name: Check if /etc/updatedb.conf exists
stat:
Expand Down Expand Up @@ -248,5 +256,6 @@
when: docker_group_members is defined

- name: update facts if docker0 is not defined
action: setup filter="ansible_docker0"
setup:
filter: "ansible_docker0"
when: ansible_docker0 is not defined
8 changes: 4 additions & 4 deletions tests/vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# test file for docker.ubuntu role on vagrant
- hosts: all
become: yes

vars:
docker_group_members: [ '{{ ansible_ssh_user }}' ]

docker_group_members:
- "{{ ansible_ssh_user }}"
roles:
- docker.ubuntu
- role: docker.ubuntu
kernel_update_and_reboot_permitted: yes

0 comments on commit c2ac818

Please sign in to comment.