├── docs ├── upgrade.rst ├── changelog.rst ├── includes │ └── all.rst ├── copyright.rst ├── index.rst ├── scripts │ └── upgrade-from-v0.1.x-to-v0.2.x ├── introduction.rst ├── examples │ └── docker-redis.yml ├── playbooks │ └── docker.yml ├── defaults-detailed.rst ├── docker-virtualenv.rst └── getting-started.rst ├── handlers └── main.yml ├── templates ├── etc │ ├── ansible │ │ └── facts.d │ │ │ └── docker.fact.j2 │ ├── systemd │ │ └── system │ │ │ ├── docker.service.d │ │ │ └── http-proxy.conf.j2 │ │ │ └── docker.service.j2 │ ├── ferm │ │ └── hooks │ │ │ └── post.d │ │ │ └── restart-docker.j2 │ ├── default │ │ └── docker.j2 │ └── docker │ │ └── daemon.json.j2 └── usr │ └── local │ └── lib │ └── docker-ferment-wrapper.j2 ├── .gitignore ├── meta ├── main.yml └── ansigenome.yml ├── .travis.yml ├── COPYRIGHT ├── UPGRADE.rst ├── README.md ├── CHANGES.rst ├── tasks └── main.yml ├── defaults └── main.yml └── LICENSE /docs/upgrade.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../UPGRADE.rst 2 | -------------------------------------------------------------------------------- /docs/changelog.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../CHANGES.rst 2 | -------------------------------------------------------------------------------- /docs/includes/all.rst: -------------------------------------------------------------------------------- 1 | .. include:: includes/global.rst 2 | -------------------------------------------------------------------------------- /docs/copyright.rst: -------------------------------------------------------------------------------- 1 | Copyright 2 | ========= 3 | 4 | .. literalinclude:: ../COPYRIGHT 5 | 6 | -------------------------------------------------------------------------------- /handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Restart docker 4 | service: 5 | name: 'docker' 6 | state: 'restarted' 7 | 8 | 9 | -------------------------------------------------------------------------------- /templates/etc/ansible/facts.d/docker.fact.j2: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # {{ ansible_managed }} 4 | 5 | from __future__ import print_function 6 | from json import dumps 7 | from sys import exit 8 | 9 | output = {'installed': True} 10 | 11 | print(dumps(output, sort_keys=True, indent=2)) 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## For quick testing. 2 | ## Generated by https://github.com/ypid/ypid-ansible-common/blob/master/bin/sphinx-debops-role-build 3 | docs/Makefile 4 | docs/_build/ 5 | docs/conf.py 6 | docs/defaults.rst 7 | docs/includes/global.rst 8 | docs/_static/.gitkeep 9 | docs/_static/custom.css 10 | docs/_templates/.gitkeep 11 | docs/_templates/page.html 12 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. _debops.docker: 2 | 3 | Ansible role: debops.docker 4 | =========================== 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | introduction 10 | getting-started 11 | defaults 12 | defaults-detailed 13 | docker-virtualenv 14 | copyright 15 | changelog 16 | upgrade 17 | 18 | .. 19 | Local Variables: 20 | mode: rst 21 | ispell-local-dictionary: "american" 22 | End: 23 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | dependencies: [] 4 | 5 | galaxy_info: 6 | author: 'Maciej Delmanowski' 7 | description: 'Install and configure Docker Engine' 8 | company: 'DebOps' 9 | license: 'GPL-3.0' 10 | min_ansible_version: '1.9.0' 11 | platforms: 12 | - name: Debian 13 | versions: 14 | - jessie 15 | - stretch 16 | galaxy_tags: 17 | - virtualization 18 | - cloud 19 | - docker 20 | - containers 21 | -------------------------------------------------------------------------------- /templates/etc/systemd/system/docker.service.d/http-proxy.conf.j2: -------------------------------------------------------------------------------- 1 | # {{ ansible_managed }} 2 | 3 | {% if docker__env_http_proxy|d() or docker__env_https_proxy|d() %} 4 | [Service] 5 | Environment={% if docker__env_http_proxy|d() %}"HTTP_PROXY={{ docker__env_http_proxy }}" {% endif %}{% if docker__env_https_proxy|d() %}"HTTPS_PROXY={{ docker__env_https_proxy }}"{% endif %} {% if docker__env_no_proxy|d() %}"NO_PROXY={{ docker__env_no_proxy }}"{% endif %} 6 | {% endif %} 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | sudo: True 4 | dist: trusty 5 | language: 'python' 6 | python: '2.7' 7 | 8 | virtualenv: 9 | system_site_packages: true 10 | 11 | before_install: True 12 | install: True 13 | 14 | script: 15 | - 'git clone --depth 1 https://github.com/nickjj/rolespec' 16 | - 'cd rolespec ; bin/rolespec -r https://github.com/debops/test-suite' 17 | 18 | notifications: 19 | webhooks: 20 | - 'https://galaxy.ansible.com/api/v1/notifications/' 21 | -------------------------------------------------------------------------------- /docs/scripts/upgrade-from-v0.1.x-to-v0.2.x: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Upgrade inventory variables for migration from debops.docker v0.1.x to v0.2.x. 4 | # The script is idempotent. 5 | 6 | git ls-files -z | xargs --null -I '{}' find '{}' -type f -print0 \ 7 | | xargs --null sed --in-place --regexp-extended ' 8 | s/docker_etc_services_/docker__etc_services__/g; 9 | s/docker_ferm_/docker__ferm__/g; 10 | s/\<(docker)_([^_])/\1__\2/g; 11 | ' 12 | -------------------------------------------------------------------------------- /docs/introduction.rst: -------------------------------------------------------------------------------- 1 | Introduction 2 | ============ 3 | 4 | `Docker`_ is a lightweight virtualization platform based on Linux kernel 5 | features that allow creation and management of isolated application 6 | environments. 7 | 8 | .. _Docker: https://docker.com/ 9 | 10 | Installation 11 | ~~~~~~~~~~~~ 12 | 13 | This role requires at least Ansible ``v1.9.0``. To install it, run: 14 | 15 | .. code-block:: console 16 | 17 | user@host:~$ ansible-galaxy install debops.docker 18 | 19 | .. 20 | Local Variables: 21 | mode: rst 22 | ispell-local-dictionary: "american" 23 | End: 24 | -------------------------------------------------------------------------------- /meta/ansigenome.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | ansigenome_info: 4 | galaxy_url: "https://galaxy.ansible.com/debops/docker" 5 | github_url: "https://github.com/debops/ansible-docker" 6 | git_branch: "master" 7 | 8 | travis: True 9 | 10 | license_url: 'https://tldrlegal.com/license/gnu-general-public-license-v3-(gpl-3)' 11 | 12 | authors: 13 | - name: 'Maciej Delmanowski' 14 | email: 'drybjed@gmail.com' 15 | twitter: 'drybjed' 16 | github: 'drybjed' 17 | 18 | synopsis: | 19 | [Docker](https://docker.com/) is a lightweight virtualization platform 20 | based on Linux kernel features that allow creation and management of 21 | isolated application environments. 22 | -------------------------------------------------------------------------------- /docs/examples/docker-redis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Set up a Redis Docker container 4 | hosts: 'docker-host' 5 | become: True 6 | 7 | environment: '{{ inventory__environment | d({}) 8 | | combine(inventory__group_environment | d({})) 9 | | combine(inventory__host_environment | d({})) }}' 10 | 11 | vars: 12 | 13 | # Use Python from Docker virtualenv 14 | ansible_python_interpreter: '/usr/bin/env docker-python' 15 | 16 | tasks: 17 | 18 | - name: Manage redis container 19 | docker_container: 20 | name: 'local-redis' 21 | image: 'redis' 22 | published_ports: [ '127.0.0.1:6379:6379' ] 23 | restart_policy: 'always' 24 | state: 'started' 25 | -------------------------------------------------------------------------------- /docs/playbooks/docker.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Manage Docker service 4 | hosts: [ 'debops_service_docker' ] 5 | become: True 6 | 7 | environment: '{{ inventory__environment | d({}) 8 | | combine(inventory__group_environment | d({})) 9 | | combine(inventory__host_environment | d({})) }}' 10 | 11 | roles: 12 | 13 | - role: debops.etc_services 14 | tags: [ 'role::etc_services' ] 15 | etc_services__dependent_list: 16 | - '{{ docker__etc_services__dependent_list }}' 17 | 18 | - role: debops.ferm 19 | tags: [ 'role::ferm' ] 20 | ferm__dependent_rules: 21 | - '{{ docker__ferm__dependent_rules }}' 22 | 23 | - role: debops.docker 24 | tags: [ 'role::docker' ] 25 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | debops.docker - Manage Docker installation using Ansible 2 | 3 | Copyright (C) 2015-2016 Maciej Delmanowski 4 | Copyright (C) 2015-2017 DebOps https://debops.org/ 5 | 6 | This Ansible role is part of DebOps. 7 | 8 | DebOps is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License version 3, as 10 | published by the Free Software Foundation. 11 | 12 | DebOps is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with DebOps. If not, see https://www.gnu.org/licenses/. 19 | -------------------------------------------------------------------------------- /templates/etc/ferm/hooks/post.d/restart-docker.j2: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # {{ ansible_managed }} 4 | 5 | # After ferm is restarted, Docker needs to be restarted so that it adds its own 6 | # iptables rules where needed 7 | 8 | set -o nounset -o pipefail -o errexit 9 | 10 | # Check if we are running under systemd 11 | if pidof systemd > /dev/null 2>&1 ; then 12 | 13 | if [ "$(systemctl is-active docker.service)" == "active" ] ; then 14 | logger -t "ferm-post-hook" "Restarting Docker via ferm post hook..." 15 | systemctl restart docker.service 16 | fi 17 | 18 | else 19 | 20 | # I'm not sure if that's a good way to check for running Docker under 21 | # non-systemd systems, if there are issues please provide a better solution 22 | if [ -r /var/run/docker/metrics.sock ] ; then 23 | logger -t "ferm-post-hook" "Restarting Docker via ferm post hook..." 24 | service docker restart 25 | fi 26 | 27 | fi 28 | -------------------------------------------------------------------------------- /templates/usr/local/lib/docker-ferment-wrapper.j2: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # {{ ansible_managed }} 4 | 5 | script="/usr/local/bin/ferment" 6 | interface="${1:-docker0}" 7 | 8 | if [ -x ${script} ] ; then 9 | 10 | if $(ip link show ${interface} > /dev/null 2>&1) ; then 11 | 12 | # Check if we are running under systemd 13 | if pidof systemd > /dev/null 2>&1 ; then 14 | 15 | if [ "$(systemctl is-active docker.service)" == "active" ] ; then 16 | ${script} docker -i ${interface} -c $(ip address show dev ${interface} scope global | grep inet | awk '{print $2}') config 17 | fi 18 | 19 | else 20 | 21 | # I'm not sure if that's a good way to check for running Docker under 22 | # non-systemd systems, if there are issues please provide a better solution 23 | if [ -r /var/run/docker/metrics.sock ] ; then 24 | ${script} docker -i ${interface} -c $(ip address show dev ${interface} scope global | grep inet | awk '{print $2}') config 25 | fi 26 | 27 | fi 28 | fi 29 | fi 30 | -------------------------------------------------------------------------------- /docs/defaults-detailed.rst: -------------------------------------------------------------------------------- 1 | Default variable details 2 | ======================== 3 | 4 | .. include:: includes/all.rst 5 | 6 | Some of ``debops.docker`` default variables have more extensive configuration 7 | than simple strings or lists, here you can find documentation and examples for 8 | them. 9 | 10 | .. contents:: 11 | :local: 12 | :depth: 1 13 | 14 | 15 | .. _docker__ref_pip_packages: 16 | 17 | docker__pip_packages 18 | -------------------- 19 | 20 | The :envvar:`docker__default_pip_packages` and :envvar:`docker__pip_packages` 21 | list variables define what PyPI packages will be installed in the Python 22 | virtualenv environment controlled by the ``debops.docker`` role. You can 23 | specify either package names as string, or YAML dictionaries with specific 24 | parameters: 25 | 26 | ``name`` 27 | Required. The name of the PyPI package to install. 28 | 29 | ``version`` 30 | Optional. If specified, install the specified version of the PyPI package 31 | instead of the latest one. 32 | 33 | ``state`` 34 | Optional. If not specified or ``present``, the package will be installed in 35 | the Python virtualenv. If ``absent``, the package will be removed from the 36 | Python virtualenv. 37 | 38 | ``path`` and ``src`` 39 | Optional. If specified together, the role will create a symlink at the 40 | ``path`` location (should specify an absolute path) to the ``src`` file or 41 | directory. 42 | 43 | For example usage, see the default variables mentioned above. 44 | -------------------------------------------------------------------------------- /UPGRADE.rst: -------------------------------------------------------------------------------- 1 | .. _docker__ref_upgrade_nodes: 2 | 3 | Upgrade notes 4 | ============= 5 | 6 | The upgrade notes only describe necessary changes that you might need to make 7 | to your setup in order to use a new role release. Refer to the 8 | :ref:`docker__ref_changelog` for more details about what has changed. 9 | 10 | From v0.3.0 to v0.4.0 11 | --------------------- 12 | 13 | The :command:`ferment` script is now installed in a Python virtualenv, and 14 | symlinked in the :file:`/usr/local/bin/` directory. On existing installation 15 | you will need to remove the existing :file:`/usr/local/bin/ferment` script to 16 | not cause an error when Ansible creates the symlink. 17 | 18 | From v0.2.1 to v0.3.0 19 | --------------------- 20 | 21 | This role should not be run on a system where docker-engine or docker.io is already 22 | installed either manually or through running a previous version of this role. If you 23 | want to upgrade to docker-ce or docker-ee through this role, manually remove 24 | docker-engine or docker.io. Make sure to backup your docker data first. 25 | 26 | From v0.1.2 to v02.0 27 | -------------------- 28 | 29 | All inventory variables have been renamed so you might need to update your 30 | inventory. 31 | This script can come in handy to do this: 32 | 33 | .. literalinclude:: scripts/upgrade-from-v0.1.x-to-v0.2.x 34 | :language: shell 35 | 36 | The script is bundled with this role under 37 | :file:`docs/scripts/upgrade-from-v0.1.x-to-v0.2.x` and can be invoked from 38 | there. 39 | -------------------------------------------------------------------------------- /templates/etc/systemd/system/docker.service.j2: -------------------------------------------------------------------------------- 1 | # {{ ansible_managed }} 2 | 3 | [Unit] 4 | Description=Docker Application Container Engine 5 | Documentation=https://docs.docker.com 6 | After=network.target docker.socket 7 | Requires=docker.socket 8 | 9 | [Service] 10 | Type=notify 11 | # the default is not to use systemd for cgroups because the delegate issues still 12 | # exists and systemd currently does not support the cgroup feature set required 13 | # for containers run by docker 14 | {% if docker__register_version.stdout | version_compare('1.12', '>=') %} 15 | ExecStart=/usr/bin/dockerd {{ docker__options | join(" ") }} 16 | {% elif docker__register_version.stdout | version_compare('1.10', '>=') %} 17 | ExecStart=/usr/bin/docker daemon {{ docker__options | join(" ") }} 18 | {% else %} 19 | EnvironmentFile=-/etc/default/docker 20 | ExecStart=/usr/bin/docker -d -H fd:// $DOCKER_OPTS 21 | {% endif %} 22 | ExecReload=/bin/kill -s HUP $MAINPID 23 | # Having non-zero Limit*s causes performance problems due to accounting overhead 24 | # in the kernel. We recommend using cgroups to do container-local accounting. 25 | LimitNOFILE=infinity 26 | LimitNPROC=infinity 27 | LimitCORE=infinity 28 | # Uncomment TasksMax if your systemd version supports it. 29 | # Only systemd 226 and above support this version. 30 | TasksMax=infinity 31 | TimeoutStartSec=0 32 | # set delegate yes so that systemd does not reset the cgroups of docker containers 33 | Delegate=yes 34 | # kill only the docker process, not all processes in the cgroup 35 | KillMode=process 36 | 37 | [Install] 38 | WantedBy=multi-user.target 39 | 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## [![DebOps](https://debops.org/images/debops-small.png)](https://debops.org) docker 2 | 3 | 5 | 6 | [![Travis CI](https://img.shields.io/travis/debops/ansible-docker.svg?style=flat)](https://travis-ci.org/debops/ansible-docker) 7 | [![test-suite](https://img.shields.io/badge/test--suite-ansible--docker-blue.svg?style=flat)](https://github.com/debops/test-suite/tree/master/ansible-docker/) 8 | [![Ansible Galaxy](https://img.shields.io/badge/galaxy-debops.docker-660198.svg?style=flat)](https://galaxy.ansible.com/debops/docker) 9 | 10 | 11 | [Docker](https://docker.com/) is a lightweight virtualization platform 12 | based on Linux kernel features that allow creation and management of 13 | isolated application environments. 14 | 15 | ### Installation 16 | 17 | This role requires at least Ansible `v1.9.0`. To install it, run: 18 | 19 | ```Shell 20 | ansible-galaxy install debops.docker 21 | ``` 22 | 23 | ### Documentation 24 | 25 | More information about `debops.docker` can be found in the 26 | [official debops.docker documentation](https://docs.debops.org/en/latest/ansible/roles/ansible-docker/docs/). 27 | 28 | 29 | 30 | ### Are you using this as a standalone role without DebOps? 31 | 32 | You may need to include missing roles from the [DebOps common 33 | playbook](https://github.com/debops/debops-playbooks/blob/master/playbooks/common.yml) 34 | into your playbook. 35 | 36 | [Try DebOps now](https://debops.org/) for a complete solution to run your Debian-based infrastructure. 37 | 38 | 39 | 40 | 41 | 42 | ### Authors and license 43 | 44 | - [Maciej Delmanowski](https://docs.debops.org/en/latest/debops-keyring/docs/entities.html#debops-keyring-entity-drybjed) (maintainer) | [e-mail](mailto:drybjed@gmail.com) | [Twitter](https://twitter.com/drybjed) | [GitHub](https://github.com/drybjed) 45 | 46 | License: [GPL-3.0](https://tldrlegal.com/license/gnu-general-public-license-v3-%28gpl-3%29) 47 | 48 | *** 49 | 50 | This role is part of [DebOps](https://debops.org/). README generated by [ansigenome](https://github.com/nickjj/ansigenome/). 51 | -------------------------------------------------------------------------------- /templates/etc/default/docker.j2: -------------------------------------------------------------------------------- 1 | # {{ ansible_managed }} 2 | 3 | # Docker Upstart and SysVinit configuration file 4 | 5 | # Customize location of Docker binary (especially for development testing). 6 | #DOCKER="/usr/local/bin/docker" 7 | 8 | {% set docker__tpl_options = [] %} 9 | {% if docker__graph|d() %} 10 | {% set _ = docker__tpl_options.append("--graph " + docker__graph) %} 11 | {% endif %} 12 | {% if docker__bridge|d() %} 13 | {% set _ = docker__tpl_options.append("--bridge " + docker__bridge) %} 14 | {% endif %} 15 | {% if docker__fixed_cidr|d() %} 16 | {% set _ = docker__tpl_options.append("--fixed-cidr " + docker__fixed_cidr) %} 17 | {% endif %} 18 | {% if docker__dns_nameserver|d() %} 19 | {% for nameserver in docker__dns_nameserver %} 20 | {% set _ = docker__tpl_options.append("--dns " + nameserver) %} 21 | {% endfor %} 22 | {% endif %} 23 | {% if docker__dns_search|d() %} 24 | {% for domain in docker__dns_search %} 25 | {% set _ = docker__tpl_options.append("--dns-search " + domain) %} 26 | {% endfor %} 27 | {% endif %} 28 | {% if docker__listen|d() %} 29 | {% for host in docker__listen %} 30 | {% if host %} 31 | {% set _ = docker__tpl_options.append("-H " + host) %} 32 | {% endif %} 33 | {% endfor %} 34 | {% endif %} 35 | {% if docker__pki|d() | bool %} 36 | {% set _ = docker__tpl_options.append("--tlsverify") %} 37 | {% set _ = docker__tpl_options.append("--tlscacert " + docker__pki_path + "/" + docker__pki_realm + "/" + docker__pki_ca) %} 38 | {% set _ = docker__tpl_options.append("--tlscert " + docker__pki_path + "/" + docker__pki_realm + "/" + docker__pki_crt) %} 39 | {% set _ = docker__tpl_options.append("--tlskey " + docker__pki_path + "/" + docker__pki_realm + "/" + docker__pki_key) %} 40 | {% endif %} 41 | {% if docker__labels|d() %} 42 | {% for key, value in docker__labels.iteritems() %} 43 | {% set _ = docker__tpl_options.append("--label " + key + '="' + value + '"') %} 44 | {% endfor %} 45 | {% endif %} 46 | {% if docker__debug|d() | bool %} 47 | {% set _ = docker__tpl_options.append("--debug=true") %} 48 | {% endif %} 49 | {% if docker__registry_mirrors|d() %} 50 | {% for registry_mirror in docker__registry_mirrors %} 51 | {% if registry_mirror %} 52 | {% set _ = docker__tpl_options.append("--registry-mirror" + " " + registry_mirror) %} 53 | {% endif %} 54 | {% endfor %} 55 | {% endif %} 56 | {% if docker__options|d() %} 57 | {% for option in docker__options %} 58 | {% if option %} 59 | {% set _ = docker__tpl_options.append(option) %} 60 | {% endif %} 61 | {% endfor %} 62 | {% endif %} 63 | # Use DOCKER_OPTS to modify the daemon startup options. 64 | {% if docker__tpl_options %} 65 | DOCKER_OPTS='{{ docker__tpl_options | join(" ") }}' 66 | {% else %} 67 | #DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4" 68 | {% endif %} 69 | 70 | {% if docker__env_http_proxy|d() %} 71 | export http_proxy={{ docker__env_http_proxy }} 72 | {% endif %} 73 | {% if docker__env_https_proxy|d() %} 74 | export https_proxy={{ docker__env_https_proxy }} 75 | {% endif %} 76 | {% if docker__env_no_proxy|d() %} 77 | export no_proxy={{ docker__env_no_proxy }} 78 | {% endif %} 79 | # This is also a handy place to tweak where Docker's temporary files go. 80 | #export TMPDIR="/mnt/bigdrive/docker-tmp" 81 | -------------------------------------------------------------------------------- /docs/docker-virtualenv.rst: -------------------------------------------------------------------------------- 1 | .. _docker__ref_virtualenv: 2 | 3 | Docker virtualenv support 4 | ========================= 5 | 6 | .. include:: includes/all.rst 7 | 8 | 9 | .. contents:: 10 | :local: 11 | :depth: 1 12 | 13 | 14 | Python and Docker relationship 15 | ------------------------------ 16 | 17 | Docker can be expanded or managed by a few additional Python-based tools. The 18 | company behind Docker provides a :command:`docker-compose` Python script which 19 | can be used to manage multiple Docker containers at a time. Ansible provides 20 | a few Docker-related modules as well. Therefore a correctly configured Python 21 | environment is very useful on a Docker host. 22 | 23 | The ``debops.docker`` Ansible role maintains a separate Python 24 | :command:`virtualenv` environment just for Docker-related Python packages. This 25 | is done so that Python modules used by upstream Docker, don't affect the host 26 | Python environment. The Docker :command:`virtualenv` environment is by default 27 | located in the :file:`/usr/local/lib/docker/virtualenv/` directory but it can 28 | be changed if needed. 29 | 30 | The :command:`docker-compose` script will be symlinked in the host environment, 31 | in :file:`/usr/local/bin/docker-compose`, so that the command can be used from 32 | the host's shell. 33 | 34 | The Python interpreter located in the Docker :command:`virtualenv` environment 35 | will be exposed in the host environment as 36 | :file:`/usr/local/bin/docker-python`. That way you can use it in the Python 37 | scripts executed in the host environment. To use the Docker Python interpreter 38 | in a script, define it's shebang line as: 39 | 40 | .. code-block:: python 41 | 42 | #!/usr/bin/env docker-python 43 | 44 | 45 | Ansible modules and Docker virtualenv 46 | ------------------------------------- 47 | 48 | The default host does not have any Docker-related Python modules available, 49 | therefore Ansible modules that interact with Docker, like ``docker``, 50 | ``docker_container``, ``docker_image``, etc. will not work out of the box in 51 | normal Ansible playbooks and roles. To solve that, you can use the 52 | ``ansible_python_interpreter`` variable defined at the playbook level. Playbook 53 | variables cannot be templated by Jinja, therefore a static value must be used, 54 | and relates to the :command:`docker-python` command exposed earlier. 55 | 56 | Here's an example playbook that uses a Python interpreter from the Docker 57 | :command:`virtualenv` environment: 58 | 59 | .. literalinclude:: examples/docker-redis.yml 60 | :language: yaml 61 | 62 | Keep in mind that more extensive playbooks that use Ansible roles or modules 63 | other than the Docker-related ones might need to be executed in their own 64 | separate plays, to use the host Python interpreter instead of the one 65 | maintained in the Docker :command:`virtualenv` environment. Alternatively, you 66 | need to ensure that the Docker :command:`virtualenv` environment contains all 67 | needed Python modules. 68 | 69 | 70 | How to access the Docker virtualenv 71 | ----------------------------------- 72 | 73 | To enter the Docker :command:`virtualenv` environment on a host, execute the 74 | commands on the ``root`` account: 75 | 76 | .. code-block:: console 77 | 78 | cd /usr/local/lib/docker/virtualenv 79 | source bin/activate 80 | 81 | After that you can execute usual :command:`pip` commands to manage Python 82 | packages inside the environment. 83 | -------------------------------------------------------------------------------- /templates/etc/docker/daemon.json.j2: -------------------------------------------------------------------------------- 1 | {# docker daemon options for systemd managed systems #} 2 | {% set docker__tpl_options = {} %} 3 | {% if docker__bridge|d() -%} 4 | {% set _ = docker__tpl_options.update({"bridge": docker__bridge}) %} 5 | {%- endif %} 6 | {% if docker__live_restore|d() and docker__register_version.stdout | version_compare('1.12', '>=') -%} 7 | {% set lv_value = true if docker__live_restore else false %} 8 | {% set _ = docker__tpl_options.update({"live-restore": lv_value}) %} 9 | {%- endif %} 10 | {% if docker__graph|d() -%} 11 | {% set _ = docker__tpl_options.update({"graph": docker__graph}) %} 12 | {%- endif %} 13 | {% if docker__fixed_cidr|d() -%} 14 | {% set _ = docker__tpl_options.update({"fixed-cidr": docker__fixed_cidr}) %} 15 | {%- endif %} 16 | {% if docker__dns_nameserver|d() -%} 17 | {% set docker__tpl_dns_nameservers = [] %} 18 | {% for element in docker__dns_nameserver -%} 19 | {% set _ = docker__tpl_dns_nameservers.append(element) %} 20 | {%- endfor %} 21 | {% set _ = docker__tpl_options.update({"dns": docker__tpl_dns_nameservers}) %} 22 | {%- endif %} 23 | {% if docker__dns_search|d() -%} 24 | {% set docker__tpl_dns_search = [] %} 25 | {% for element in docker__dns_search -%} 26 | {% set _ = docker__tpl_dns_search.append(element) %} 27 | {%- endfor %} 28 | {% set _ = docker__tpl_options.update({"dns-search": docker__tpl_dns_search}) %} 29 | {%- endif %} 30 | {% if docker__listen|d() and docker__register_version.stdout | version_compare('1.10', '>=') -%} 31 | {% set docker__tpl_listen = [] %} 32 | {% for element in docker__listen -%} 33 | {% set _ = docker__tpl_listen.append(element) %} 34 | {%- endfor %} 35 | {% set _ = docker__tpl_options.update({"hosts": docker__tpl_listen}) %} 36 | {%- endif %} 37 | {% if docker__pki|d() | bool -%} 38 | {% set _ = docker__tpl_options.update({"tlsverify": true}) %} 39 | {% set _ = docker__tpl_options.update({"tlscacert": (docker__pki_path + "/" + docker__pki_realm + "/" + docker__pki_ca)}) %} 40 | {% set _ = docker__tpl_options.update({"tlscert": (docker__pki_path + "/" + docker__pki_realm + "/" + docker__pki_crt)}) %} 41 | {% set _ = docker__tpl_options.update({"tlskey": (docker__pki_path + "/" + docker__pki_realm + "/" + docker__pki_key)}) %} 42 | {%- endif %} 43 | {% if docker__debug|d() -%} 44 | {% set _ = docker__tpl_options.update({"debug": docker__debug}) %} 45 | {%- endif %} 46 | {% if docker__registry_mirrors|d() -%} 47 | {% set docker__tpl_registry_mirrors = [] %} 48 | {% for element in docker__registry_mirrors -%} 49 | {% set _ = docker__tpl_registry_mirrors.append(element) %} 50 | {%- endfor %} 51 | {% set _ = docker__tpl_options.update({"registry-mirrors": docker__tpl_registry_mirrors}) %} 52 | {%- endif %} 53 | {% if docker__labels|d() -%} 54 | {% set docker__tpl_labels = [] %} 55 | {% for key, value in docker__labels.iteritems() -%} 56 | {% set _ = docker__tpl_labels.append(key+"="+value) %} 57 | {%- endfor %} 58 | {% set _ = docker__tpl_options.update({"labels": docker__tpl_labels}) %} 59 | {%- endif %} 60 | {% if docker__storage_driver|d() -%} 61 | {% set _ = docker__tpl_options.update({"storage-driver": docker__storage_driver}) %} 62 | {%- endif %} 63 | {% if docker__storage_options|d() -%} 64 | {% set docker__tpl_storage_options = [] %} 65 | {% for key, value in docker__storage_options.iteritems() -%} 66 | {% set _ = docker__tpl_storage_options.append(key+"="+value) %} 67 | {%- endfor %} 68 | {% set _ = docker__tpl_options.update({"storage-opts": docker__tpl_storage_options}) %} 69 | {%- endif %} 70 | {% if docker__custom_daemon_options|d() -%} 71 | {% set _ = docker__tpl_options.update(docker__custom_daemon_options) %} 72 | {%- endif %} 73 | {{ docker__tpl_options | to_nice_json }} 74 | -------------------------------------------------------------------------------- /docs/getting-started.rst: -------------------------------------------------------------------------------- 1 | Getting started 2 | =============== 3 | 4 | .. include:: includes/all.rst 5 | 6 | .. contents:: 7 | :local: 8 | 9 | Initial configuration 10 | --------------------- 11 | 12 | Docker is available in two editions. Community Edition (CE) and Enterprise Edition (EE). 13 | Docker EE is not supported on Debian distributions. See also: `Docker variants`_. 14 | 15 | The Docker package from distribution repositories will be installed by default 16 | (on Jessie it means that the ``jessie-backports`` repository needs to be available, 17 | which is the default in DebOps). You can install the upstream version of Docker 18 | by setting the ``docker__upstream: True`` variable in Ansible’s inventory. 19 | Upstream Docker is installed on Debian Stretch by default, since the this 20 | release does not provide included Docker packages. 21 | 22 | If debops.pki_ was configured on the host, Docker will automatically listen 23 | on its TCP port for incoming TLS connections, which is by default blocked by 24 | the :program:`ferm` firewall. If you don't use a firewall or have it disabled, you might 25 | want to set :envvar:`docker__tcp` to ``False`` to disable this behavior. 26 | 27 | Docker manages its own network bridge and :command:`iptables` entries. On hosts 28 | that don't use upstream Docker packages, the :program:`ferment` Python script 29 | will be installed in a Python virtualenv to allow :program:`ferm` firewall to 30 | reload Docker firewall rules automatically, however it does not fully support 31 | Docker yet, so be aware of this when you modify the firewall configuration.You 32 | can restart :command:`docker` daemon to make sure that all firewall rules are 33 | set up correctly. 34 | 35 | On hosts with upstream Docker enabled and :command:`ferm`, a special post-hook 36 | script will be installed that restarts the Docker daemon after :command:`ferm` 37 | is restarted. In this case, :command:`ferment` will not be installed. 38 | 39 | The :command:`docker-compose` script will be installed on hosts with upstream 40 | Docker, in a Python virtualenv. It will be automatically available system-wide 41 | via a symlink in :file:`/usr/local/bin/` directory. 42 | 43 | To let the docker daemon trust a private registry with self-signed certificates, 44 | add the root CA used to sign the registry's certificate through the debops.pki_ 45 | role. 46 | 47 | This role does not support switching from Docker CE to Docker EE on an already installed 48 | machine. It does support switching from distribution repository to upstream. 49 | However, it is recommended to start with a clean machine if possible. 50 | 51 | ``debops.docker`` relies on configuration managed by debops.core_, 52 | debops.ferm_, and debops.pki_ Ansible roles. 53 | 54 | .. _Docker variants: https://docs.docker.com/engine/installation/#docker-variants 55 | 56 | Useful variables 57 | ---------------- 58 | 59 | This is a list of role variables which your most likely want to define in 60 | Ansible inventory to customize Docker: 61 | 62 | :envvar:`docker__tcp_allow` 63 | List of IP addresses or subnets that can connect to Docker daemon remotely 64 | over TLS. 65 | 66 | :envvar:`docker__admins` 67 | List of UNIX accounts that have access to Docker daemon socket. 68 | 69 | Example inventory 70 | ----------------- 71 | 72 | To configure Docker on a given remote host, it needs to be added to 73 | ``[debops_service_docker]`` Ansible inventory group: 74 | 75 | .. code-block:: none 76 | 77 | [debops_service_docker] 78 | hostname 79 | 80 | Example playbook 81 | ---------------- 82 | 83 | Here's an example playbook that can be used to manage Docker: 84 | 85 | .. literalinclude:: playbooks/docker.yml 86 | :language: yaml 87 | 88 | Ansible tags 89 | ------------ 90 | 91 | You can use Ansible ``--tags`` or ``--skip-tags`` parameters to limit what 92 | tasks are performed during Ansible run. This can be used after a host was first 93 | configured to speed up playbook execution, when you are sure that most of the 94 | configuration is already in the desired state. 95 | 96 | Available role tags: 97 | 98 | ``role::docker`` 99 | Main role tag, should be used in the playbook to execute all of the role 100 | tasks as well as role dependencies. 101 | 102 | ``role::docker:config`` 103 | Run tasks related to Docker configuration. 104 | 105 | ``role::docker:admins`` 106 | Manage access to Docker daemon by UNIX accounts. 107 | -------------------------------------------------------------------------------- /CHANGES.rst: -------------------------------------------------------------------------------- 1 | .. _docker__ref_changelog: 2 | 3 | Changelog 4 | ========= 5 | 6 | .. include:: includes/all.rst 7 | 8 | **debops.docker** 9 | 10 | This project adheres to `Semantic Versioning `__ 11 | and `human-readable changelog `__. 12 | 13 | The current role maintainer_ is drybjed_. 14 | 15 | 16 | `debops.docker master`_ - unreleased 17 | ------------------------------------ 18 | 19 | .. _debops.docker master: https://github.com/debops/ansible-docker/compare/v0.4.1...master 20 | 21 | 22 | `debops.docker v0.4.1`_ - 2017-09-21 23 | ------------------------------------ 24 | 25 | .. _debops.docker v0.4.1: https://github.com/debops/ansible-docker/compare/v0.4.0...v0.4.1 26 | 27 | Changed 28 | ~~~~~~~ 29 | 30 | - Install the ``virtualenv`` APT package conditionally depending on 31 | distribution release. [gasuketsu] 32 | 33 | 34 | `debops.docker v0.4.0`_ - 2017-09-18 35 | ------------------------------------ 36 | 37 | .. _debops.docker v0.4.0: https://github.com/debops/ansible-docker/compare/v0.3.0...v0.4.0 38 | 39 | Added 40 | ~~~~~ 41 | 42 | - Install :command:`docker-compose` from PyPI in a Python virtualenv 43 | environment, when upstream Docker support is enabled. The script will be 44 | available system-wide via a symlink in :file:`/usr/local/bin/` directory. 45 | [drybjed_] 46 | 47 | Changed 48 | ~~~~~~~ 49 | 50 | - Change the :command:`ferm` post-hook script into an Ansible template. 51 | [drybjed_] 52 | 53 | - Install :command:`ferment` from PyPI in a Python virtualenv environment to 54 | separate it from the system Python environment. Ferment is only installed 55 | when upstream Docker is not enabled. [drybjed_] 56 | 57 | Fixed 58 | ~~~~~ 59 | 60 | - Be more careful about interactions of the firewall with Docker and the init 61 | system. This should fix an issue where the host did not boot properly under 62 | :command:`systemd` since :command:`ferm` tried to restart Docker too early 63 | during the boot process. [drybjed_] 64 | 65 | - The :command:`ferment` wrapper script should correctly skip 66 | :command:`ferment` execution if Docker service is not running. [drybjed_] 67 | 68 | 69 | `debops.docker v0.3.0`_ - 2017-08-16 70 | ------------------------------------ 71 | 72 | .. _debops.docker v0.3.0: https://github.com/debops/ansible-docker/compare/v0.2.1...v0.3.0 73 | 74 | Added 75 | ~~~~~ 76 | 77 | - Ferm hook to restart docker daemon after ferm is restarted if :envvar:`docker__ferment` 78 | is set to False. [tallandtree_] 79 | 80 | - Use docker upstream repository by default on stretch installations [cultcom] 81 | 82 | - Switch to docker-ce and docker-ee. [tallandtree_] 83 | 84 | - Add the Ansible local facts for the ``debops.docker`` role so that other 85 | roles can detect if Docker is installed. [drybjed_] 86 | 87 | Changed 88 | ~~~~~~~ 89 | 90 | - Docker daemon listens on port 2376 when TLS is used. [tallandtree_] 91 | 92 | 93 | `debops.docker v0.2.1`_ - 2016-08-29 94 | ------------------------------------ 95 | 96 | .. _debops.docker v0.2.1: https://github.com/debops/ansible-docker/compare/v0.2.0...v0.2.1 97 | 98 | Added 99 | ~~~~~ 100 | 101 | - Support for dockerd (docker-engine 1.12). [tallandtree_] 102 | 103 | - Support for live restore (:envvar:`docker__live_restore`) of docker daemon 104 | (docker-engine 1.12) and other options. [tallandtree_] 105 | 106 | Changed 107 | ~~~~~~~ 108 | 109 | - Systemd configuration improved. [tallandtree_] 110 | 111 | - Support ``http_proxy``, ``https_proxy`` and ``no_proxy`` variables for Upstart 112 | systems. [tallandtree_] 113 | 114 | - Use custom distribution and release local facts for Docker upstream 115 | repository configuration. [drybjed_] 116 | 117 | - Use list of administrator accounts provided by the debops.core_ role. 118 | [drybjed_] 119 | 120 | 121 | `debops.docker v0.2.0`_ - 2016-07-20 122 | ------------------------------------ 123 | 124 | .. _debops.docker v0.2.0: https://github.com/debops/ansible-docker/compare/v0.1.2...v0.2.0 125 | 126 | Added 127 | ~~~~~ 128 | 129 | - Enable configuration of custom UDP ports in the firewall for additional 130 | services like ``consul``. [ddpaul] 131 | 132 | - Install ``python-setuptools`` APT package. [antoineco] 133 | 134 | - Add support for Docker behind a HTTP proxy using ``systemd`` service files. 135 | [tallandtree_] 136 | 137 | Changed 138 | ~~~~~~~ 139 | 140 | - Fix deprecation warnings in Ansible 2.1.0 related to bare and undefined 141 | variables. [antoineco] 142 | 143 | - Update documentation and Changelog. [ypid_, tallandtree_, drybjed_] 144 | 145 | - Rename all role variables from ``docker_*`` to ``docker__*`` to move them 146 | into their own namespace. [tallandtree_] 147 | 148 | - ``*.changed`` is changed to ``*|changed`` to ensure correct variable type 149 | resolution by Ansible. [tallandtree_] 150 | 151 | 152 | `debops.docker v0.1.2`_ - 2015-12-19 153 | ------------------------------------ 154 | 155 | .. _debops.docker v0.1.2: https://github.com/debops/ansible-docker/compare/v0.1.1...v0.1.2 156 | 157 | Added 158 | ~~~~~ 159 | 160 | - Add a default list variable which can be used to open additional ports in the 161 | firewall for Docker-related services. [drybjed_] 162 | 163 | - Create :file:`/etc/systemd/system` directory if not present for the Docker 164 | systemd unit file. [drybjed_] 165 | 166 | 167 | `debops.docker v0.1.1`_ - 2015-12-13 168 | ------------------------------------ 169 | 170 | .. _debops.docker v0.1.1: https://github.com/debops/ansible-docker/compare/v0.1.0...v0.1.1 171 | 172 | Changed 173 | ~~~~~~~ 174 | 175 | - Remove hard role dependencies and move additional role configuration to 176 | default variables. Ansible playbook can use this configuration to set up 177 | firewall rules and reserve ports in :file:`/etc/services`. [drybjed_] 178 | 179 | - Check if ``ansible_ssh_user`` contains a value before adding the default user 180 | to :command:`docker` group, otherwise use name of the user account running the 181 | Ansible playbook. [drybjed_] 182 | 183 | 184 | debops.docker v0.1.0 - 2015-09-06 185 | --------------------------------- 186 | 187 | Added 188 | ~~~~~ 189 | 190 | - Initial release. [drybjed_] 191 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Get upstream APT GPG key 4 | apt_key: 5 | id: '{{ docker__upstream_key }}' 6 | keyserver: '{{ ansible_local.core.keyserver 7 | if (ansible_local|d() and ansible_local.core|d() and 8 | ansible_local.core.keyserver) 9 | else "hkp://pool.sks-keyservers.net" }}' 10 | state: 'present' 11 | when: docker__upstream|d() | bool 12 | 13 | - name: Configure upstream APT repository 14 | apt_repository: 15 | repo: '{{ docker__upstream_repository }}' 16 | state: 'present' 17 | update_cache: True 18 | when: docker__upstream|d() | bool 19 | 20 | - name: Make sure that systemd directory exists 21 | file: 22 | path: '/etc/systemd/system' 23 | state: 'directory' 24 | owner: 'root' 25 | group: 'root' 26 | mode: '0755' 27 | when: ansible_service_mgr == 'systemd' 28 | tags: [ 'role::docker:config' ] 29 | 30 | - name: Make sure that docker.service.d directory exists 31 | file: 32 | path: '/etc/systemd/system/docker.service.d' 33 | state: 'directory' 34 | owner: 'root' 35 | group: 'root' 36 | mode: '0755' 37 | when: (ansible_service_mgr == 'systemd' and 38 | (docker__env_http_proxy is defined or docker__env_https_proxy is defined)) 39 | tags: [ 'role::docker:config' ] 40 | 41 | - name: Remove other version if upstream is modified 42 | apt: 43 | name: '{{ item }}' 44 | state: 'absent' 45 | install_recommends: False 46 | register: docker__register_other_version_removed 47 | with_flattened: 48 | - '{{ "docker.io" if docker__upstream|d() 49 | else docker__upstream_packagename }}' 50 | - '{{ "docker-engine" if docker__upstream|d() 51 | else [] }}' 52 | 53 | - name: Remove startup file(s) if present 54 | file: 55 | path: '{{ item }}' 56 | state: 'absent' 57 | tags: [ 'role::docker:config' ] 58 | with_flattened: 59 | - '/etc/systemd/system/docker.service' 60 | - '/lib/systemd/system/docker.service' 61 | - '/etc/default/docker' 62 | - '/etc/docker/daemon.json' 63 | - '/etc/systemd/system/docker.service.d/http-proxy.conf' 64 | when: (docker__register_other_version_removed|changed) 65 | 66 | - name: Install required packages 67 | apt: 68 | name: '{{ item }}' 69 | state: 'present' 70 | install_recommends: False 71 | with_flattened: 72 | - '{{ docker__mandatory_packages }}' 73 | - '{{ docker__upstream_packagename if docker__upstream|d() else "docker.io" }}' 74 | - '{{ docker__base_packages }}' 75 | - '{{ docker__packages }}' 76 | 77 | - name: Install Python packages in virtualenv 78 | pip: 79 | name: '{{ item.name | d(item) }}' 80 | version: '{{ item.version | d(omit) }}' 81 | virtualenv: '{{ docker__virtualenv }}' 82 | state: '{{ item.state | d("present") }}' 83 | with_flattened: 84 | - '{{ docker__default_pip_packages }}' 85 | - '{{ docker__pip_packages }}' 86 | 87 | - name: Expose Docker virtualenv for Ansible modules 88 | file: 89 | path: '{{ docker__virtualenv_python_symlink }}' 90 | src: '{{ docker__virtualenv_python_interpreter }}' 91 | state: 'link' 92 | 93 | - name: Symlink selected Python scripts to /usr/local/bin 94 | file: 95 | path: '{{ item.path }}' 96 | src: '{{ item.src }}' 97 | state: 'link' 98 | with_flattened: 99 | - '{{ docker__default_pip_packages }}' 100 | - '{{ docker__pip_packages }}' 101 | when: item.path|d() and item.src|d() and 102 | item.state|d('present') != 'absent' 103 | 104 | - name: Install ferment wrapper script 105 | template: 106 | src: 'usr/local/lib/docker-ferment-wrapper.j2' 107 | dest: '{{ docker__ferment_wrapper }}' 108 | owner: 'root' 109 | group: 'root' 110 | mode: '0755' 111 | when: docker__ferment | bool 112 | 113 | - name: Install ferm post hook 114 | template: 115 | src: 'etc/ferm/hooks/post.d/restart-docker.j2' 116 | dest: '/etc/ferm/hooks/post.d/restart-docker' 117 | owner: 'root' 118 | group: 'root' 119 | mode: '0755' 120 | when: docker__ferm_post_hook|bool 121 | 122 | - name: Check Docker version 123 | environment: 124 | LC_MESSAGES: 'C' 125 | shell: dpkg-query -W -f='${Version}\n' '{{ ("docker-ce" if docker__upstream|d() else "docker.io") }}' | cut -d- -f1 126 | register: docker__register_version 127 | changed_when: False 128 | failed_when: False 129 | tags: [ 'role::docker:config' ] 130 | 131 | - name: Configure Docker options 132 | template: 133 | src: 'etc/default/docker.j2' 134 | dest: '/etc/default/docker' 135 | owner: 'root' 136 | group: 'root' 137 | mode: '0644' 138 | notify: [ 'Restart docker' ] 139 | tags: [ 'role::docker:config' ] 140 | when: (ansible_service_mgr != 'systemd' or docker__register_version.stdout | version_compare('1.10', '<')) 141 | 142 | - name: Configure Docker systemd options 143 | template: 144 | src: 'etc/docker/daemon.json.j2' 145 | dest: '/etc/docker/daemon.json' 146 | owner: 'root' 147 | group: 'root' 148 | mode: '0644' 149 | notify: [ 'Restart docker' ] 150 | tags: [ 'role::docker:config' ] 151 | when: (ansible_service_mgr == 'systemd' and docker__register_version.stdout | version_compare('1.10', '>=')) 152 | 153 | - name: Install Debian systemd service unit 154 | template: 155 | src: 'etc/systemd/system/docker.service.j2' 156 | dest: '/etc/systemd/system/docker.service' 157 | owner: 'root' 158 | group: 'root' 159 | mode: '0644' 160 | register: docker__register_systemd_service 161 | notify: ['Restart docker' ] 162 | when: ansible_service_mgr == 'systemd' 163 | tags: [ 'role::docker:config' ] 164 | 165 | - name: Configure Docker proxy 166 | template: 167 | src: 'etc/systemd/system/docker.service.d/http-proxy.conf.j2' 168 | dest: '/etc/systemd/system/docker.service.d/http-proxy.conf' 169 | owner: 'root' 170 | group: 'root' 171 | mode: '0644' 172 | register: docker__register_systemd_proxy_present 173 | notify: ['Restart docker' ] 174 | when: (ansible_service_mgr == 'systemd' and 175 | (docker__env_http_proxy is defined or docker__env_https_proxy is defined)) 176 | tags: [ 'role::docker:config' ] 177 | 178 | - name: Reload systemd daemons 179 | command: systemctl daemon-reload 180 | notify: [ 'Restart docker'] 181 | when: (ansible_service_mgr == 'systemd' and 182 | ((docker__register_systemd_service|d() and 183 | docker__register_systemd_service|changed) or 184 | (docker__register_systemd_proxy_present|d() and 185 | docker__register_systemd_proxy_present|changed) or 186 | (docker__register_systemd_proxy_absent|d() and 187 | docker__register_systemd_proxy_absent|changed))) 188 | tags: [ 'role::docker:config' ] 189 | 190 | - name: Add specified users to 'docker' group 191 | user: 192 | name: '{{ item }}' 193 | groups: 'docker' 194 | append: True 195 | with_items: '{{ docker__admins }}' 196 | when: item|d() 197 | tags: [ 'role::docker:config', 'role::docker:admins' ] 198 | 199 | - name: Make sure that Ansible local facts directory exists 200 | file: 201 | path: '/etc/ansible/facts.d' 202 | state: 'directory' 203 | owner: 'root' 204 | group: 'root' 205 | mode: '0755' 206 | 207 | - name: Save APT local facts 208 | template: 209 | src: 'etc/ansible/facts.d/docker.fact.j2' 210 | dest: '/etc/ansible/facts.d/docker.fact' 211 | owner: 'root' 212 | group: 'root' 213 | mode: '0755' 214 | register: docker__register_facts 215 | 216 | - name: Update Ansible facts if they were modified 217 | action: setup 218 | when: docker__register_facts|changed 219 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # .. vim: foldmarker=[[[,]]]:foldmethod=marker 3 | 4 | # debops.docker default variables [[[ 5 | # =================================== 6 | 7 | # .. contents:: Sections 8 | # :local: 9 | # 10 | # .. include:: includes/all.rst 11 | 12 | 13 | # Docker packages and installation [[[ 14 | # ------------------------------------ 15 | 16 | # .. envvar:: docker__distribution [[[ 17 | # 18 | # The OS distribution which is used to select upstream APT repository. 19 | docker__distribution: '{{ ansible_local.core.distribution 20 | if (ansible_local|d() and ansible_local.core|d() and 21 | ansible_local.core.distribution|d()) 22 | else ansible_distribution }}' 23 | 24 | # ]]] 25 | # .. envvar:: docker__distribution_release [[[ 26 | # 27 | # The OS distribution relese which is used to select upstream APT repository. 28 | docker__distribution_release: '{{ ansible_local.core.distribution_release 29 | if (ansible_local|d() and ansible_local.core|d() and 30 | ansible_local.core.distribution_release|d()) 31 | else ansible_distribution_release }}' 32 | 33 | # ]]] 34 | # .. envvar:: docker__upstream [[[ 35 | # 36 | # By default ``debops.docker`` installs Docker from the system distribution 37 | # repositories. Here you can enable upstream repositories and install the 38 | # upstream version of Docker. 39 | # Note that switching from upstream to default on one host, may not always 40 | # work. You may need to manually remove the upstream version and configuration. 41 | docker__upstream: '{{ True 42 | if (docker__distribution_release == "stretch") 43 | else False }}' 44 | 45 | # ]]] 46 | # .. envvar:: docker__upstream_edition [[[ 47 | # 48 | # For upstream repositories the edition to be installed: ce or ee. Note that Docker EE 49 | # is not supported on Debian. 50 | docker__upstream_edition: 'ce' 51 | 52 | # ]]] 53 | # .. envvar:: docker__upstream_channel [[[ 54 | # 55 | # For upstream repositories choose the stable or edge channel. 56 | docker__upstream_channel: 'stable' 57 | 58 | # ]]] 59 | # .. envvar:: docker__upstream_key [[[ 60 | # 61 | # APT GPG key id used to sign the upstream Docker packages. 62 | docker__upstream_key: '{{ "9DC858229FC7DD38854AE2D88D81803C0EBFCD88" 63 | if (docker__upstream_edition == "ce") 64 | else "DD911E995A64A202E85907D6BC14F10B6D085F96" }}' 65 | 66 | # ]]] 67 | # .. envvar:: docker__upstream_packagename [[[ 68 | # 69 | # The full docker packagename to be installed. 70 | docker__upstream_packagename: '{{ "docker-" + docker__upstream_edition }}' 71 | 72 | # ]]] 73 | # .. envvar:: docker__upstream_arch_map [[[ 74 | # 75 | # A YAML dictionary that maps the ``ansible_architecture`` variable with its 76 | # corresponding processor architecture used in the Docker repository URLs. 77 | docker__upstream_arch_map: 78 | 'x86_64': 'amd64' 79 | 'armhf': 'armhf' 80 | 81 | # ]]] 82 | # .. envvar:: docker__upstream_repository [[[ 83 | # 84 | # Address of the Docker upstream APT repository. 85 | docker__upstream_repository: '{{ "deb [arch=" 86 | + docker__upstream_arch_map[ansible_architecture] 87 | + "] https://download.docker.com/linux/" + docker__distribution|lower + " " 88 | + docker__distribution_release + " " + docker__upstream_channel }}' 89 | 90 | # ]]] 91 | # .. envvar:: docker__mandatory_packages [[[ 92 | # 93 | # List of mandatory packages to install with Docker. 94 | docker__mandatory_packages: 95 | - 'apt-transport-https' 96 | - 'ca-certificates' 97 | - 'curl' 98 | - 'gnupg2' 99 | - 'software-properties-common' 100 | 101 | # ]]] 102 | # .. envvar:: docker__base_packages [[[ 103 | # 104 | # List of base packages to install with Docker. 105 | docker__base_packages: 106 | - "aufs-tools" 107 | - "python-pip" 108 | - "python-setuptools" 109 | - "python-virtualenv" 110 | - '{{ [ "virtualenv" ] if (ansible_distribution_release not in ["trusty", "wheezy"]) else [] }}' 111 | - "bridge-utils" 112 | - '{{ [ "cgroup-lite" ] if (ansible_distribution_release in ["trusty"]) else [] }}' 113 | 114 | # ]]] 115 | # .. envvar:: docker__packages [[[ 116 | # 117 | # List of additional packages to install with Docker. 118 | docker__packages: [] 119 | # ]]] 120 | # ]]] 121 | # Docker Python environment [[[ 122 | # ----------------------------- 123 | 124 | # The role prepares a separate Python virtualenv for Docker-related commands 125 | # and Ansible modules. See :ref:`docker__ref_virtualenv` for more details. 126 | 127 | # .. envvar:: docker__virtualenv [[[ 128 | # 129 | # Absolute path of the location of Docker virtualenv. 130 | docker__virtualenv: '/usr/local/lib/docker/virtualenv' 131 | 132 | # ]]] 133 | # .. envvar:: docker__virtualenv_python_interpreter [[[ 134 | # 135 | # Absolute path to the Python interpreter which will be exposed for Ansible 136 | # modules to work correctly with Docker virtualenv. 137 | docker__virtualenv_python_interpreter: '{{ docker__virtualenv + "/bin/python" }}' 138 | 139 | # ]]] 140 | # .. envvar:: docker__virtualenv_python_symlink [[[ 141 | # 142 | # Absolute path for the :command:`docker-python` symlink. 143 | docker__virtualenv_python_symlink: '/usr/local/bin/docker-python' 144 | 145 | # ]]] 146 | # .. envvar:: docker__default_pip_packages [[[ 147 | # 148 | # List od default Python packages to install in Docker virtualenv. The 149 | # corresponding binaries will be symlinked in the :file:`/usr/local/bin/` 150 | # directory to allow access from outside of the Python virtualenv. 151 | # See :ref:`docker__ref_pip_packages` for more details. 152 | docker__default_pip_packages: 153 | 154 | - name: 'docker' 155 | state: '{{ "present" if docker__upstream|bool else "absent" }}' 156 | 157 | - name: 'docker-compose' 158 | path: '/usr/local/bin/docker-compose' 159 | src: '{{ docker__virtualenv + "/bin/docker-compose" }}' 160 | state: '{{ "present" if docker__upstream|bool else "absent" }}' 161 | 162 | - name: 'docker-py' 163 | version: '0.5.3' 164 | state: '{{ "present" if docker__ferment|bool else "absent" }}' 165 | 166 | - name: 'ferment' 167 | path: '/usr/local/bin/ferment' 168 | src: '{{ docker__virtualenv + "/bin/ferment" }}' 169 | state: '{{ "present" if docker__ferment|bool else "absent" }}' 170 | 171 | # ]]] 172 | # .. envvar:: docker__pip_packages [[[ 173 | # 174 | # List of additional Python packages to install in Docker virtualenv. 175 | # See :ref:`docker__ref_pip_packages` for more details. 176 | docker__pip_packages: [] 177 | # ]]] 178 | # ]]] 179 | # Docker authentication [[[ 180 | # ------------------------- 181 | 182 | # .. envvar:: docker__admins [[[ 183 | # 184 | # List of UNIX accounts which should be added to :command:`docker` system group which 185 | # has access to the Docker UNIX socket. 186 | docker__admins: '{{ ansible_local.core.admin_users 187 | if (ansible_local|d() and ansible_local.core|d() and 188 | ansible_local.core.admin_users|d()) 189 | else [] }}' 190 | # ]]] 191 | # ]]] 192 | # Network configuration [[[ 193 | # ------------------------- 194 | 195 | # .. envvar:: docker__bridge [[[ 196 | # 197 | # Name of the bridge to use instead of the autogenerated ``docker0`` bridge. 198 | # The bridge should already exist on the server. 199 | docker__bridge: '' 200 | 201 | # ]]] 202 | # .. envvar:: docker__fixed_cidr [[[ 203 | # 204 | # Fixed subnet in CIDR format to confine dynamically allocated IP addresses. 205 | # Should be included in the IP address range set on the bridge. 206 | docker__fixed_cidr: '' 207 | 208 | # ]]] 209 | # .. envvar:: docker__dns_nameserver [[[ 210 | # 211 | # List of IP addresses of nameservers used by Docker. By default they 212 | # are gathered by the debops.core_ role from the :file:`/etc/resolv.conf` file of 213 | # the remote host. 214 | docker__dns_nameserver: '{{ ansible_local.resolver.nameserver 215 | if (ansible_local|d() and ansible_local.resolver|d() and 216 | ansible_local.resolver.nameserver|d()) 217 | else [] }}' 218 | 219 | # ]]] 220 | # .. envvar:: docker__dns_search [[[ 221 | # 222 | # List of DNS search domains to use by Docker. By default they are gathered by 223 | # the debops.core_ role from the :file:`/etc/resolv.conf` file of the remote host. 224 | docker__dns_search: '{{ ansible_local.resolver.search 225 | if (ansible_local|d() and ansible_local.resolver|d() and 226 | ansible_local.resolver.search|d()) 227 | else [] }}' 228 | # ]]] 229 | # ]]] 230 | # Remote Docker connection (TCP) [[[ 231 | # ---------------------------------- 232 | 233 | # .. envvar:: docker__tcp [[[ 234 | # 235 | # Enable or disable listening for TLS connections on the TCP docker port. By 236 | # default remote connections are enabled if the debops.pki_ role has been 237 | # configured on remote host (access is controlled by the firewall). 238 | docker__tcp: '{{ docker__pki | bool }}' 239 | 240 | # ]]] 241 | # .. envvar:: docker__tcp_bind [[[ 242 | # 243 | # IP address of the interface to listen on for incoming connections (all 244 | # interfaces by default). 245 | docker__tcp_bind: '0.0.0.0' 246 | 247 | # ]]] 248 | # .. envvar:: docker__unencrypted_tcp_port [[[ 249 | # 250 | # Port on which to listen for incoming unencrypted connections. 251 | docker__unencrypted_tcp_port: '2375' 252 | 253 | # ]]] 254 | # .. envvar:: docker__tls_tcp_port [[[ 255 | # 256 | # Port on which to listen for incoming TLS connections. 257 | docker__tls_tcp_port: '2376' 258 | 259 | # ]]] 260 | # .. envvar:: docker__tcp_port [[[ 261 | # 262 | # Port on which to listen for incoming TLS connections. 263 | docker__tcp_port: '{{ docker__tls_tcp_port if (docker__pki|d() | bool) else docker__unencrypted_tcp_port }}' 264 | 265 | # ]]] 266 | # .. envvar:: docker__tcp_allow [[[ 267 | # 268 | # List of IP addresses or subnets in CIDR format which are allowed to connect 269 | # to the Docker daemon over TLS. If it's not specified, remote connections are 270 | # denied by the firewall. 271 | docker__tcp_allow: [] 272 | 273 | # ]]] 274 | # .. envvar:: docker__tcp_listen [[[ 275 | # 276 | # Default connection configured in addition to local socket connection, using 277 | # TCP over TLS. 278 | docker__tcp_listen: '{{ ("tcp://" + docker__tcp_bind + ":" + docker__tcp_port) 279 | if (docker__tcp|d() | bool) else "" }}' 280 | 281 | # ]]] 282 | # .. envvar:: docker__custom_ports [[[ 283 | # 284 | # List of additional TCP/UDP ports to allow in the firewall, useful for other 285 | # Docker-related services, like Swarm, Consul. 286 | docker__custom_ports: [] 287 | # ]]] 288 | # ]]] 289 | # Docker configuration options [[[ 290 | # -------------------------------- 291 | 292 | # .. envvar:: docker__env_http_proxy [[[ 293 | # 294 | # Http Proxy settings for the docker daemon 295 | docker__env_http_proxy: '{{ ansible_env.http_proxy | d() }}' 296 | 297 | # ]]] 298 | # .. envvar:: docker__env_https_proxy [[[ 299 | # 300 | # Https Proxy settings for the docker daemon 301 | docker__env_https_proxy: '{{ ansible_env.https_proxy | d() }}' 302 | 303 | # ]]] 304 | # .. envvar:: docker__env_no_proxy [[[ 305 | # 306 | # No Proxy settings for the docker daemon 307 | docker__env_no_proxy: '{{ ansible_env.no_proxy | d() }}' 308 | 309 | # ]]] 310 | # .. envvar:: docker__listen [[[ 311 | # 312 | # List of host connections configured in the Docker daemon (``--host`` parameter). 313 | docker__listen: 314 | - '{{ "fd://" if ansible_service_mgr == "systemd" else "unix:///var/run/docker.sock" }}' 315 | - '{{ docker__tcp_listen }}' 316 | 317 | # ]]] 318 | # .. envvar:: docker__labels [[[ 319 | # 320 | # Dictionary with labels configured on the Docker daemon, each key is the label 321 | # name and value is the label attribute. Examples: 322 | # 323 | # .. code-block:: yaml 324 | # :linenos: 325 | # 326 | # docker__labels: 327 | # 'com.example.environment': 'production' 328 | # 'com.example.storage': 'extfs' 329 | # 330 | docker__labels: {} 331 | 332 | # ]]] 333 | # .. envvar:: docker__debug [[[ 334 | # 335 | # Start docker daemon in debug mode. 336 | docker__debug: False 337 | 338 | # ]]] 339 | # .. envvar:: docker__live_restore [[[ 340 | # 341 | # Enables keeping containers alive during daemon downtime. Only supported from 342 | # docker version 1.12 and above. 343 | docker__live_restore: False 344 | 345 | # ]]] 346 | # .. envvar:: docker__graph [[[ 347 | # 348 | # Alternative root path of the docker runtime. 349 | docker__graph: '/var/lib/docker' 350 | 351 | # ]]] 352 | # .. envvar:: docker__registry_mirrors [[[ 353 | # 354 | # List of registry mirrors. 355 | docker__registry_mirrors: [] 356 | 357 | # ]]] 358 | # .. envvar:: docker__storage_driver [[[ 359 | # 360 | # Storage driver for docker volumes. 361 | docker__storage_driver: '{{ "aufs" 362 | if (ansible_distribution_release in ["wheezy", "jessie" ]) 363 | else "overlay" }}' 364 | 365 | # ]]] 366 | # .. envvar:: docker__storage_options [[[ 367 | # 368 | # Additional docker storage driver options. 369 | docker__storage_options: {} 370 | 371 | # ]]] 372 | # .. envvar:: docker__custom_daemon_options [[[ 373 | # 374 | # Allows passing of arbitrary/unsupported configuration options to 375 | # 'daemon.json'. 376 | docker__custom_daemon_options: {} 377 | 378 | # ]]] 379 | # .. envvar:: docker__options [[[ 380 | # 381 | # List of additional options passed to :command:`docker` daemon. Examples: 382 | # 383 | # .. code-block:: yaml 384 | # :linenos: 385 | # 386 | # docker__options: 387 | # - '--icc=false' 388 | # - '--insecure-registry=10.1.0.0/16' 389 | # 390 | docker__options: [] 391 | # ]]] 392 | # ]]] 393 | # PKI and certificates [[[ 394 | # ------------------------ 395 | 396 | # .. envvar:: docker__pki [[[ 397 | # 398 | # Enable or disable support for PKI certificates managed by debops.pki_. 399 | docker__pki: '{{ (True 400 | if (ansible_local|d() and ansible_local.pki|d() and 401 | ansible_local.pki.enabled|d() | bool) 402 | else False) | bool }}' 403 | 404 | # ]]] 405 | # .. envvar:: docker__pki_path [[[ 406 | # 407 | # Directory where PKI files are located on the remote host. 408 | docker__pki_path: '{{ ansible_local.pki.base_path 409 | if (ansible_local|d() and ansible_local.pki|d() and 410 | ansible_local.pki.base_path|d()) 411 | else "/etc/pki" }}' 412 | 413 | # ]]] 414 | # .. envvar:: docker__pki_realm [[[ 415 | # 416 | # Name of the PKI realm used by Docker. 417 | docker__pki_realm: '{{ ansible_local.pki.realm 418 | if (ansible_local|d() and ansible_local.pki|d() and 419 | ansible_local.pki.realm|d()) 420 | else "system" }}' 421 | 422 | # ]]] 423 | # .. envvar:: docker__pki_ca [[[ 424 | # 425 | # Name of the Root CA certificate file used by Docker. 426 | docker__pki_ca: 'CA.crt' 427 | 428 | # ]]] 429 | # .. envvar:: docker__pki_crt [[[ 430 | # 431 | # Name of the host certificate used by Docker. 432 | docker__pki_crt: 'default.crt' 433 | 434 | # ]]] 435 | # .. envvar:: docker__pki_key [[[ 436 | # 437 | # Name of the private key file used by Docker. 438 | docker__pki_key: 'default.key' 439 | # ]]] 440 | # ]]] 441 | # Firewall and ferment support [[[ 442 | # -------------------------------- 443 | 444 | # .. envvar:: docker__ferm_post_hook [[[ 445 | # 446 | # Enable or disable installation for the :program:`ferm` post hook when :program:`ferment` 447 | # is disabled. 448 | docker__ferm_post_hook: '{{ True 449 | if (ansible_local|d() and ansible_local.ferm|d() and 450 | not docker__ferment|bool) else False }}' 451 | 452 | # ]]] 453 | # .. envvar:: docker__ferment [[[ 454 | # 455 | # Enable or disable support for :program:`ferment` script, which can generate :program:`ferm` 456 | # configuration with the current Docker state. 457 | docker__ferment: '{{ True 458 | if (ansible_local|d() and ansible_local.ferm|d() and 459 | not docker__upstream|bool) 460 | else False }}' 461 | 462 | # ]]] 463 | # .. envvar:: docker__ferment_wrapper [[[ 464 | # 465 | # Path to the :program:`ferment` wrapper script used to generate :program:`ferm` configuration. 466 | docker__ferment_wrapper: '{{ (ansible_local.root.lib 467 | if (ansible_local|d() and ansible_local.root|d() and 468 | ansible_local.root.lib|d()) 469 | else "/usr/local/lib") + "/docker-ferment-wrapper" }}' 470 | # ]]] 471 | # ]]] 472 | # Configuration for other Ansible roles [[[ 473 | # ----------------------------------------- 474 | 475 | # .. envvar:: docker__etc_services__dependent_list [[[ 476 | # 477 | # Configuration for debops.etc_services_ role which registers port numbers 478 | # for Docker REST API. 479 | docker__etc_services__dependent_list: 480 | 481 | - name: 'docker' 482 | port: '{{ docker__unencrypted_tcp_port }}' 483 | comment: 'Docker REST API (plain text)' 484 | 485 | - name: 'docker-s' 486 | port: '{{ docker__tls_tcp_port }}' 487 | comment: 'Docker REST API (SSL)' 488 | 489 | # ]]] 490 | # .. envvar:: docker__ferm__dependent_rules [[[ 491 | # 492 | # Configuration for debops.ferm_ role which enables support for :program:`ferment` 493 | # script and opens access to the Docker REST API in the firewall. 494 | docker__ferm__dependent_rules: 495 | 496 | - type: 'custom' 497 | weight: '99' 498 | role: 'docker' 499 | name: 'ferment_rules' 500 | rules: | 501 | @def $DOCKER_FERMENT = `test -x {{ docker__ferment_wrapper }} && echo 1 || echo 0`; 502 | @if $DOCKER_FERMENT { 503 | @include '{{ docker__ferment_wrapper + (" " + docker__bridge if docker__bridge else "") }}|'; 504 | } 505 | state: '{{ "present" if docker__ferment|bool else "absent" }}' 506 | 507 | - type: 'accept' 508 | dport: '{{ [ docker__tcp_port ] + docker__custom_ports }}' 509 | protocol: [ 'tcp', 'udp' ] 510 | saddr: '{{ docker__tcp_allow }}' 511 | accept_any: False 512 | weight: '50' 513 | role: 'docker' 514 | name: 'service_rules' 515 | # ]]] 516 | # ]]] 517 | # ]]] 518 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | 676 | --------------------------------------------------------------------------------