diff --git a/defaults/main.yml b/defaults/main.yml index ab05cad..486088c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -3,4 +3,5 @@ dockerhost_group : "docker" docker_compose_version : "1.6.2" docker_compose_dir : "/opt/docker_compose" -docker_compose_install : True \ No newline at end of file +docker_compose_install : True +docker_install_py_module : False \ No newline at end of file diff --git a/tasks/docker-py.yml b/tasks/docker-py.yml new file mode 100644 index 0000000..4eafc48 --- /dev/null +++ b/tasks/docker-py.yml @@ -0,0 +1,5 @@ +--- + +- name: Install docker-py Python module + pip: + name="docker-py" \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index c955f0e..614c56a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -11,6 +11,10 @@ - name: Include apt tasks include: apt.yml +- name: Include docker-py + include: docker-py.yml + when: docker_install_py_module + - name: Install docker engine apt: pkg="docker-engine" diff --git a/test/integration/defaults/defaults.yml b/test/integration/defaults/defaults.yml index 49d2a99..ae53c3d 100644 --- a/test/integration/defaults/defaults.yml +++ b/test/integration/defaults/defaults.yml @@ -1,7 +1,7 @@ --- - name : Default - hosts : "all" + hosts : all gather_facts : True become : True connection : "{{ kitchen_connection | default('local') }}" diff --git a/test/integration/defaults/serverspec/default_spec.rb b/test/integration/defaults/serverspec/default_spec.rb new file mode 100644 index 0000000..0fcc962 --- /dev/null +++ b/test/integration/defaults/serverspec/default_spec.rb @@ -0,0 +1,9 @@ +require 'serverspec' + +# Required by serverspec +set :backend, :exec + +# Default version +describe command('docker --version') do + its(:stdout) { should contain('1.10') } +end diff --git a/test/integration/docker-py/docker-py.yml b/test/integration/docker-py/docker-py.yml new file mode 100644 index 0000000..81cbd9f --- /dev/null +++ b/test/integration/docker-py/docker-py.yml @@ -0,0 +1,18 @@ +--- + +- name : docker-py + hosts : "all" + gather_facts : True + become : True + connection : "{{ kitchen_connection | default('local') }}" + vars : + docker_install_py_module : True + + pre_tasks : + - name: Install pip + apt: + name="python-pip" + update_cache=yes + cache_valid_time=3600 + roles : + - "ansible-dockerhost" diff --git a/test/integration/docker-py/serverspec/default_spec.rb b/test/integration/docker-py/serverspec/default_spec.rb new file mode 100644 index 0000000..0fcc962 --- /dev/null +++ b/test/integration/docker-py/serverspec/default_spec.rb @@ -0,0 +1,9 @@ +require 'serverspec' + +# Required by serverspec +set :backend, :exec + +# Default version +describe command('docker --version') do + its(:stdout) { should contain('1.10') } +end