diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..d385756 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,59 @@ +name: "ericsysmin.docker.docker" +on: + push: + paths: + - "roles/docker/**" + - "molecule/docker/**" + - ".github/workflows/docker.yml" + pull_request: + paths: + - "roles/docker/**" + - "molecule/docker/**" + - ".github/workflows/docker.yml" +jobs: + molecule: + runs-on: ubuntu-latest + env: + PY_COLORS: 1 + ANSIBLE_FORCE_COLOR: 1 + strategy: + fail-fast: true + matrix: + molecule_distro: + - { "distro": "centos-8", "command": "/usr/sbin/init" } + - { "distro": "fedora-32", "command": "/usr/sbin/init" } + - { "distro": "fedora-31", "command": "/usr/sbin/init" } + - { "distro": "fedora-30", "command": "/usr/lib/systemd/systemd" } + - { "distro": "ubuntu-18.04", "command": "/lib/systemd/systemd" } + - { "distro": "ubuntu-20.04", "command": "/lib/systemd/systemd" } + - { "distro": "ubuntu-22.04", "command": "/lib/systemd/systemd" } + - { "distro": "debian-10", "command": "/lib/systemd/systemd" } + - { "distro": "debian-11", "command": "/lib/systemd/systemd" } + collection_role: + - docker + steps: + - name: Check out code + uses: actions/checkout@v1 + with: + path: ansible_collections/ericsysmin/docker + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Install dependencies + run: | + sudo apt install apt-transport-https ca-certificates curl software-properties-common + curl -fsSL https://get.docker.com -o get-docker.sh + sudo sh get-docker.sh + python -m pip install --upgrade pip + pip install ansible molecule yamllint ansible-lint molecule-plugins[docker] + + - name: Run role tests + run: >- + molecule --version && + ansible --version && + MOLECULE_COMMAND=${{ matrix.molecule_distro.command }} + MOLECULE_DISTRO=${{ matrix.molecule_distro.distro }} + molecule --debug test -s ${{ matrix.collection_role }} diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..dc562d6 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,60 @@ +# Sample workflow for building and deploying a Jekyll site to GitHub Pages +name: Deploy Jekyll with GitHub Pages dependencies preinstalled + +on: + # Runs on pushes targeting the default branch + push: + branches: ["1.0.0-dev"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install antsibull-docs ansible + ls -lart + ansible-galaxy collection install . + antsibull-docs sphinx-init --use-current --dest-dir dest ericsysmin.docker + cd dest; pip install -r requirements.txt + ./build.sh + mv build/html ../_site + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 24e5cb0..d7d1f89 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,12 @@ --- -name: "release" +name: release on: release: types: - created jobs: release: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: ANSIBLE_GALAXY_TOKEN: ${{ secrets.ANSIBLE_GALAXY_TOKEN }} ANSIBLE_FORCE_COLOR: 1 @@ -14,10 +14,10 @@ jobs: - name: Check out code uses: actions/checkout@v1 - - name: Set up Python 3.8 - uses: actions/setup-python@v1 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.12 - name: Install dependencies run: | diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f2a3839..0000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ ---- -dist: bionic -language: python -services: - - docker - -before_install: - - sudo apt-get -qq update - -env: - global: - - COLLECTION_NAMESPACE: ericsysmin - - COLLECTION_NAME: docker - matrix: - - MOLECULE_DISTRO: centos:7 - MOLECULE_SERVICE_MANAGER: systemd - MOLECULE_COMMAND: /usr/sbin/init - - MOLECULE_DISTRO: fedora:27 - MOLECULE_SERVICE_MANAGER: systemd - MOLECULE_COMMAND: /usr/sbin/init - - MOLECULE_DISTRO: fedora:28 - MOLECULE_SERVICE_MANAGER: systemd - MOLECULE_COMMAND: /usr/sbin/init - - MOLECULE_DISTRO: ubuntu:xenial - MOLECULE_COMMAND: /sbin/init - - MOLECULE_DISTRO: ubuntu:bionic - MOLECULE_SERVICE_MANAGER: systemd - MOLECULE_COMMAND: /lib/systemd/systemd - - MOLECULE_DISTRO: debian:stretch - MOLECULE_SERVICE_MANAGER: systemd - MOLECULE_COMMAND: /lib/systemd/systemd - -install: - - pip install molecule yamllint ansible-lint docker - -before_script: - - cd ../ - - mkdir -p ansible_collections/$COLLECTION_NAMESPACE - - mv ansible-collection-$COLLECTION_NAME ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME - - cd ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME - -script: - - molecule test diff --git a/.yamllint b/.yamllint deleted file mode 100644 index 8827676..0000000 --- a/.yamllint +++ /dev/null @@ -1,33 +0,0 @@ ---- -# Based on ansible-lint config -extends: default - -rules: - braces: - max-spaces-inside: 1 - level: error - brackets: - max-spaces-inside: 1 - level: error - colons: - max-spaces-after: -1 - level: error - commas: - max-spaces-after: -1 - level: error - comments: disable - comments-indentation: disable - document-start: disable - empty-lines: - max: 3 - level: error - hyphens: - level: error - indentation: disable - key-duplicates: enable - line-length: disable - new-line-at-end-of-file: disable - new-lines: - type: unix - trailing-spaces: disable - truthy: disable diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 0000000..50a71be --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,27 @@ +=============================== +Ericsysmin.Docker Release Notes +=============================== + +.. contents:: Topics + + +v1.0.0 +====== + +Release Summary +--------------- + +1.0.0 release of the Docker role + +Major Changes +------------- + +- added recent versions of OS tests +- ensured existing role works with newer OS releases +- updated all tasks to meet newer ansible-lint requirements +- updated molecule testing + +New Roles +--------- + +- ericsysmin.docker.docker - Ansible role to deploy Docker CE or Docker EE diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/README.md b/README.md index ca94618..8063bdf 100644 --- a/README.md +++ b/README.md @@ -1,103 +1,17 @@ # Ansible Collection: ericsysmin.docker -[![Build Status](https://travis-ci.com/ericsysmin/ansible-collection-docker.svg?branch=master)](https://travis-ci.com/ericsysmin/ansible-collection-docker) +Documentation can be found here: ## Role Summary This role provides the following: -- Installation of Docker following Docker-Engine install procedures as documented by Docker. -- It will manage kernel versions as well, verifying the that the correct kernel for Docker support is installed. - -Supports the following Operating Systems: - -- CentOS 7 -- RedHat 7 -- Fedora 24 -- Fedora 23 -- Fedora 26 -- Fedora 27 -- Fedora 29 -- OracleLinux 7 -- Ubuntu 14.04 -- Ubuntu 16.04 +- Installation of Docker following Docker-Engine install procedures as documented by Docker. +- It will manage kernel versions as well, verifying the that the correct kernel for Docker support is installed. ## Requirements -This role requires Ansible 2.4 or higher. Requirements are listed in the metadata file. - -## Role Variables - -For more information about the variables many can be found - -| Variable | Required | Default | Comments | -| ------------------------------------- | -------- | ----------- | --------------------------------------------------------------------------------------------- | -| `docker_edition` | No | `ce` | Specifies either ce, or ee version of Docker. | -| `docker_ee_url` | No | `Undefined` | Docker EE URL from the Docker Store | -| `docker_repo` | No | `docker` | Defines how Ansible manages the repository. Options are "other" and "docker" | -| `docker_channel` | No | `stable` | What release channel of Docker to install. | -| `docker_ee_version` | No | `17.03` | Docker EE version for EE repository | -| `docker_storage_driver` | No | `Undefined` | Storage driver to use | -| `docker_block_device` | No | `Undefined` | The device name used for the storage driver. | -| `docker_mount_opts` | No | `Undefined` | The mount options when mounting filesystems | -| `docker_storage_opts` | No | `Undefined` | Storage driver options | -| `docker_api_cors_header` | No | `Undefined` | Set CORS headers in the remote API | -| `docker_authorization_plugins` | No | `Undefined` | Authorization plugins to load | -| `docker_bip` | No | `Undefined` | Specify network bridge IP | -| `docker_bridge` | No | `Undefined` | Attach containers to a network bridge | -| `docker_cgroup_parent` | No | `Undefined` | Set parent cgroup for all containers | -| `docker_cluster_store` | No | `Undefined` | Set cluster store options | -| `docker_cluster_store_opts` | No | `Undefined` | Please see dockerd manual for info | -| `docker_cluster_advertise` | No | `Undefined` | Address or interface name to advertise | -| `docker_debug` | No | `Undefined` | Enable debug mode | -| `docker_default_gateway` | No | `Undefined` | Container default gateway IPv4 address | -| `docker_default_gateway_v6` | No | `Undefined` | Container default gateway IPv6 address | -| `docker_default_runtime` | No | `Undefined` | Default OCI runtime for containers | -| `docker_default_ulimits` | No | `Undefined` | Default ulimits for containers | -| `docker_disable_legacy_registry` | No | `Undefined` | Disable contacting legacy registries | -| `docker_dns` | No | `Undefined` | DNS server to use | -| `docker_dns_opts` | No | `Undefined` | DNS options to use | -| `docker_dns_search` | No | `Undefined` | DNS search domains to use | -| `docker_exec_opts` | No | `Undefined` | Runtime execution options | -| `docker_exec_root` | No | `Undefined` | Root directory for execution state files | -| `docker_fixed_cidr` | No | `Undefined` | IPv4 subnet for fixed IPs | -| `docker_fixed_cidr_v6` | No | `Undefined` | IPv6 subnet for fixed IPs | -| `docker_graph` | No | `Undefined` | Root of the Docker runtime | -| `docker_group` | No | `Undefined` | Group for the unix socket | -| `docker_hosts` | No | `Undefined` | Daemon socket(s) to connect to | -| `docker_icc` | No | `Undefined` | Enable inter-container communication | -| `docker_insecure_registries` | No | `Undefined` | Enable insecure registry communication | -| `docker_ip` | No | `Undefined` | Default IP when binding container ports | -| `docker_iptables` | No | `Undefined` | Enable addition of iptables rules | -| `docker_ipv6` | No | `Undefined` | Enable IPv6 networking | -| `docker_ip_forward` | No | `Undefined` | Enable net.ipv4.ip_forward | -| `docker_ip_masq` | No | `Undefined` | Enable IP masquerading | -| `docker_labels` | No | `Undefined` | Set key=value labels to the daemon | -| `docker_live_restore` | No | `Undefined` | Enables keeping containers alive during daemon downtime | -| `docker_log_driver` | No | `Undefined` | Default driver for container logs | -| `docker_log_level` | No | `Undefined` | Set the logging level | -| `docker_log_opts` | No | `Undefined` | Default log driver options for containers | -| `docker_max_concurrent_downloads` | No | `Undefined` | Set the max concurrent downloads for each pull | -| `docker_max_concurrent_uploads` | No | `Undefined` | Set the max concurrent uploads for each push | -| `docker_mtu` | No | `Undefined` | Set the containers network MTU | -| `docker_oom_score_adjust` | No | `Undefined` | Set the oom_score_adj for the daemon | -| `docker_pidfile` | No | `Undefined` | Path to use for daemon PID file | -| `docker_raw_logs` | No | `Undefined` | Full timestamps without ANSI coloring | -| `docker_registry_mirrors` | No | `Undefined` | Preferred Docker registry mirror | -| `docker_runtimes` | No | `Undefined` | Register an additional OCI compatible runtime | -| `docker_selinux_enabled` | No | `Undefined` | Enable selinux support | -| `docker_swarm_default_advertise_addr` | No | `Undefined` | Set default address or interface for swarm advertised address | -| `docker_tls` | No | `Undefined` | Use TLS; implied by –tlsverify | -| `docker_tlscacert` | No | `Undefined` | Trust certs signed only by this CA | -| `docker_tlscert` | No | `Undefined` | Path to TLS certificate file | -| `docker_tlskey` | No | `Undefined` | Path to TLS key file | -| `docker_tlsverify` | No | `Undefined` | Use TLS and verify the remote | -| `docker_userland_proxy` | No | `Undefined` | Use userland proxy for loopback traffic | -| `docker_userns_remap` | No | `Undefined` | User/Group setting for user namespaces | -| `docker_users` | No | `Undefined` | A list of system users to be added to the docker group (so they can use Docker on the server) | -| `docker_http_proxy` | No | `Undefined` | Set the Docker service to use HTTP_PROXY | -| `docker_https_proxy` | No | `Undefined` | Set the Docker service to use HTTPS_PROXY | -| `docker_no_proxy_params` | No | `Undefined` | Do not proxy for Docker service params | +This role requires Ansible 2.9 or higher. Requirements are listed in the metadata file. ## Example Playbooks @@ -130,7 +44,7 @@ Install docker with AUFS. This is recommended for production deployment on Ubunt ## License -Apache 2.0 +MIT ## Author Information diff --git a/build/galaxy_deploy.yml b/build/galaxy_deploy.yml index b2a65e4..45a419b 100644 --- a/build/galaxy_deploy.yml +++ b/build/galaxy_deploy.yml @@ -1,5 +1,7 @@ --- -- hosts: localhost +# code: language=ansible +- name: Deploy the collection to Ansible Galaxy + hosts: localhost connection: local gather_facts: false vars: @@ -7,31 +9,39 @@ tag: "{{ github_tag.split('/')[-1] }}" pre_tasks: - name: Ensure the ANSIBLE_GALAXY_TOKEN environment variable is set. - fail: + ansible.builtin.fail: msg: ANSIBLE_GALAXY_TOKEN is not set. - when: "lookup('env','ANSIBLE_GALAXY_TOKEN') | length == 0" + when: lookup('env', 'ANSIBLE_GALAXY_TOKEN') | length == 0 + - name: Ensure the ~/.ansible directory exists. - file: + ansible.builtin.file: path: ~/.ansible state: directory + mode: "0755" + - name: Write the Galaxy token to ~/.ansible/galaxy_token - copy: + ansible.builtin.copy: content: | - token: {{ lookup('env','ANSIBLE_GALAXY_TOKEN') }} + token: {{ lookup('env', 'ANSIBLE_GALAXY_TOKEN') }} dest: ~/.ansible/galaxy_token + mode: "0644" + tasks: - name: Template out the galaxy.yml file. - template: + ansible.builtin.template: src: templates/galaxy.yml.j2 dest: ../galaxy.yml + mode: "0644" register: galaxy_yml - - name: Build the collection. # noqa 503 - command: > + + - name: Build the collection. # noqa no-changed-when no-handler + ansible.builtin.command: > ansible-galaxy collection build chdir=../ when: galaxy_yml.changed - - name: Publish the collection. # noqa 503 - command: > + + - name: Publish the collection. # noqa no-changed-when no-handler + ansible.builtin.command: > ansible-galaxy collection publish ./ericsysmin-docker-{{ tag }}.tar.gz chdir=../ when: galaxy_yml.changed diff --git a/build/templates/galaxy.yml.j2 b/build/templates/galaxy.yml.j2 index 516fa8d..1e438fa 100644 --- a/build/templates/galaxy.yml.j2 +++ b/build/templates/galaxy.yml.j2 @@ -1,58 +1,20 @@ -### REQUIRED - -# The namespace of the collection. This can be a company/brand/organization or product namespace under which all -# content lives. May only contain alphanumeric characters and underscores. Additionally namespaces cannot start with -# underscores or numbers and cannot contain consecutive underscores +--- +# code: language=ansible namespace: ericsysmin - -# The name of the collection. Has the same character restrictions as 'namespace' name: docker - -# The version of the collection. Must be compatible with semantic versioning version: "{{ tag }}" - -# The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md - -# A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) -# @nicks:irc/im.site#channel' authors: - Eric Anderson - - -### OPTIONAL but strongly recommended - -# A short summary description of the collection description: Docker collection - -# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only -# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file' -# license: -# - GPL-2.0-or-later - -# The path to the license file for the collection. This path is relative to the root of the collection. This key is -# mutually exclusive with 'license' license_file: LICENSE - -# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character -# requirements as 'namespace' and 'name' tags: - docker - -# Collections that this collection requires to be installed for it to be usable. The key of the dict is the -# collection label 'namespace.name'. The value is a version range -# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version -# range specifiers can be set and are separated by ',' -#dependencies: {} - -# The URL of the originating SCM repository +dependencies: { + "community.general": "*", + "ansible.posix": "*" +} repository: https://github.com/ericsysmin/ansible-collection-docker - -# The URL to any online docs #documentation: http://docs.example.com - -# The URL to the homepage of the collection/project homepage: https://github.com/ericsysmin/ansible-collection-docker - -# The URL to the collection issue tracker issues: https://github.com/ericsysmin/ansible-collection-docker/issues diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml new file mode 100644 index 0000000..cfa515e --- /dev/null +++ b/changelogs/.plugin-cache.yaml @@ -0,0 +1,23 @@ +objects: + role: + docker: + description: Ansible role to install and configure Docker + name: docker + version_added: null +plugins: + become: {} + cache: {} + callback: {} + cliconf: {} + connection: {} + filter: {} + httpapi: {} + inventory: {} + lookup: {} + module: {} + netconf: {} + shell: {} + strategy: {} + test: {} + vars: {} +version: 1.0.0 diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml new file mode 100644 index 0000000..eb7afe3 --- /dev/null +++ b/changelogs/changelog.yaml @@ -0,0 +1,16 @@ +ancestor: null +releases: + 1.0.0: + release_date: '2024-02-01' + changes: + release_summary: 1.0.0 release of the Docker role + major_changes: + - added recent versions of OS tests + - ensured existing role works with newer OS releases + - updated all tasks to meet newer ansible-lint requirements + - updated molecule testing + objects: + role: + - name: docker + description: Ansible role to deploy Docker CE or Docker EE + namespace: null diff --git a/changelogs/config.yaml b/changelogs/config.yaml new file mode 100644 index 0000000..24ff439 --- /dev/null +++ b/changelogs/config.yaml @@ -0,0 +1,32 @@ +changelog_filename_template: ../CHANGELOG.rst +changelog_filename_version_depth: 0 +changes_file: changelog.yaml +changes_format: combined +ignore_other_fragment_extensions: true +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +prelude_section_name: release_summary +prelude_section_title: Release Summary +sanitize_changelog: true +sections: + - - major_changes + - Major Changes + - - minor_changes + - Minor Changes + - - breaking_changes + - Breaking Changes / Porting Guide + - - deprecated_features + - Deprecated Features + - - removed_features + - Removed Features (previously deprecated) + - - security_fixes + - Security Fixes + - - bugfixes + - Bugfixes + - - known_issues + - Known Issues +title: Ericsysmin.Docker +trivial_section_name: trivial +use_fqcn: true diff --git a/dest/.gitignore b/dest/.gitignore new file mode 100644 index 0000000..0a39f3e --- /dev/null +++ b/dest/.gitignore @@ -0,0 +1,8 @@ +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +# Created with antsibull-docs 2.6.1 + +/temp-rst +/build diff --git a/dest/antsibull-docs.cfg b/dest/antsibull-docs.cfg new file mode 100644 index 0000000..19c644d --- /dev/null +++ b/dest/antsibull-docs.cfg @@ -0,0 +1,24 @@ +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +# Created with antsibull-docs 2.6.1 + +breadcrumbs = true +indexes = true +use_html_blobs = false + +# You can specify ways to convert a collection name (.) to an URL here. +# You can replace either of or by "*" to match all values in that place, +# or use "*" for the collection name to match all collections. In the URL, you can use +# {namespace} and {name} for the two components of the collection name. If you want to use +# "{" or "}" in the URL, write "{{" or "}}" instead. Basically these are Python format +# strings (https://docs.python.org/3.8/library/string.html#formatstrings). +collection_url = { + * = "https://galaxy.ansible.com/ui/repo/published/{namespace}/{name}/" +} + +# The same wildcard rules and formatting rules as for collection_url apply. +collection_install = { + * = "ansible-galaxy collection install {namespace}.{name}" +} diff --git a/dest/build.sh b/dest/build.sh new file mode 100755 index 0000000..68e2b0a --- /dev/null +++ b/dest/build.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +# Created with antsibull-docs 2.6.1 + +set -e + +pushd "$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +trap "{ popd; }" EXIT + +# Create collection documentation into temporary directory +rm -rf temp-rst +mkdir -p temp-rst +chmod og-w temp-rst # antsibull-docs wants that directory only readable by itself +antsibull-docs \ + --config-file antsibull-docs.cfg \ + collection \ + --use-current \ + --dest-dir temp-rst \ + ericsysmin.docker + +# Copy collection documentation into source directory +rsync -cprv --delete-after temp-rst/collections/ rst/collections/ + +# Build Sphinx site +sphinx-build -M html rst build -c . -W --keep-going + diff --git a/dest/conf.py b/dest/conf.py new file mode 100644 index 0000000..21cfbb3 --- /dev/null +++ b/dest/conf.py @@ -0,0 +1,46 @@ +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +# Created with antsibull-docs 2.6.1 + +# This file only contains a selection of the most common options. For a full list see the +# documentation: +# http://www.sphinx-doc.org/en/master/config + +project = 'Ansible collections' +copyright = 'Ansible contributors' + +title = 'Ansible Collections Documentation' +html_short_title = 'Ansible Collections Documentation' + +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx_antsibull_ext'] + +pygments_style = 'ansible' + +highlight_language = 'YAML+Jinja' + +html_theme = 'sphinx_ansible_theme' +html_show_sphinx = False + +display_version = False + +html_use_smartypants = True +html_use_modindex = False +html_use_index = False +html_copy_source = False + +# See https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#confval-intersphinx_mapping for the syntax +intersphinx_mapping = { + 'python': ('https://docs.python.org/2/', (None, '../python2.inv')), + 'python3': ('https://docs.python.org/3/', (None, '../python3.inv')), + 'jinja2': ('http://jinja.palletsprojects.com/', (None, '../jinja2.inv')), + 'ansible_devel': ('https://docs.ansible.com/ansible/devel/', (None, '../ansible_devel.inv')), + # If you want references to resolve to a released Ansible version (say, `5`), uncomment and replace X by this version: + # 'ansibleX': ('https://docs.ansible.com/ansible/X/', (None, '../ansibleX.inv')), +} + +default_role = 'any' + +nitpicky = True + diff --git a/dest/requirements.txt b/dest/requirements.txt new file mode 100644 index 0000000..a369438 --- /dev/null +++ b/dest/requirements.txt @@ -0,0 +1,10 @@ +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +# Created with antsibull-docs 2.6.1 + +antsibull-docs >= 2.0.0, < 3.0.0 +ansible-pygments +sphinx +sphinx-ansible-theme >= 0.9.0 diff --git a/dest/rst/collections/environment_variables.rst b/dest/rst/collections/environment_variables.rst new file mode 100644 index 0000000..e7b9060 --- /dev/null +++ b/dest/rst/collections/environment_variables.rst @@ -0,0 +1,15 @@ + +:orphan: + +.. meta:: + :antsibull-docs: 2.6.1 + +.. _list_of_collection_env_vars: + +Index of all Collection Environment Variables +============================================= + +The following index documents all environment variables declared by plugins in collections. +Environment variables used by the ansible-core configuration are documented in :ref:`ansible_configuration_settings`. + +No environment variables have been defined. diff --git a/dest/rst/collections/ericsysmin/docker/docker_role.rst b/dest/rst/collections/ericsysmin/docker/docker_role.rst new file mode 100644 index 0000000..630255d --- /dev/null +++ b/dest/rst/collections/ericsysmin/docker/docker_role.rst @@ -0,0 +1,2569 @@ + +.. Document meta + +:orphan: + +.. |antsibull-internal-nbsp| unicode:: 0xA0 + :trim: + +.. meta:: + :antsibull-docs: 2.6.1 + +.. Anchors + +.. _ansible_collections.ericsysmin.docker.docker_role: + +.. Title + +ericsysmin.docker.docker role -- Ansible role to install and configure Docker ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This role is part of the `ericsysmin.docker collection `_ (version 1.0.0). + + It is not included in ``ansible-core``. + To check whether it is installed, run :code:`ansible-galaxy collection list`. + + To install it use: :code:`ansible-galaxy collection install ericsysmin.docker`. + + To use it in a playbook, specify: :code:`ericsysmin.docker.docker`. + +.. contents:: + :local: + :depth: 2 + + +.. Entry point title + +Entry point ``main`` -- Ansible role to install and configure Docker +-------------------------------------------------------------------- + +.. version_added + + +.. Deprecated + + +Synopsis +^^^^^^^^ + +.. Description + +- Installation of Docker following Docker-Engine install procedures as documented by Docker. +- It will manage kernel versions as well, verifying the that the correct kernel for Docker support is installed. + +.. Requirements + + +.. Options + +Parameters +^^^^^^^^^^ + +.. tabularcolumns:: \X{1}{3}\X{2}{3} + +.. list-table:: + :width: 100% + :widths: auto + :header-rows: 1 + :class: longtable ansible-option-table + + * - Parameter + - Comments + + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_api_cors_header: + + .. rst-class:: ansible-option-title + + **docker_api_cors_header** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Set CORS headers in the remote API + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_authorization_plugins: + + .. rst-class:: ansible-option-title + + **docker_authorization_plugins** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Authorization plugins to load + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_bip: + + .. rst-class:: ansible-option-title + + **docker_bip** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Specify network bridge IP + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_block_device: + + .. rst-class:: ansible-option-title + + **docker_block_device** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + The device name used for the storage driver. + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_bridge: + + .. rst-class:: ansible-option-title + + **docker_bridge** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Attach containers to a network bridge + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_cgroup_parent: + + .. rst-class:: ansible-option-title + + **docker_cgroup_parent** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Set parent cgroup for all containers + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_channel: + + .. rst-class:: ansible-option-title + + **docker_channel** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + What release channel of Docker to install. + + + .. rst-class:: ansible-option-line + + :ansible-option-default-bold:`Default:` :ansible-option-default:`"stable"` + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_cluster_advertise: + + .. rst-class:: ansible-option-title + + **docker_cluster_advertise** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Address or interface name to advertise + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_cluster_store: + + .. rst-class:: ansible-option-title + + **docker_cluster_store** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Set cluster store options + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_cluster_store_opts: + + .. rst-class:: ansible-option-title + + **docker_cluster_store_opts** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Please see dockerd manual for info + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_debug: + + .. rst-class:: ansible-option-title + + **docker_debug** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Enable debug mode + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_default_gateway: + + .. rst-class:: ansible-option-title + + **docker_default_gateway** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Container default gateway IPv4 address + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_default_gateway_v6: + + .. rst-class:: ansible-option-title + + **docker_default_gateway_v6** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Container default gateway IPv6 address + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_default_runtime: + + .. rst-class:: ansible-option-title + + **docker_default_runtime** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Default OCI runtime for containers + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_default_ulimits: + + .. rst-class:: ansible-option-title + + **docker_default_ulimits** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Default ulimits for containers + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_disable_legacy_registry: + + .. rst-class:: ansible-option-title + + **docker_disable_legacy_registry** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Disable contacting legacy registries + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_dns: + + .. rst-class:: ansible-option-title + + **docker_dns** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + DNS server to use + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_dns_opts: + + .. rst-class:: ansible-option-title + + **docker_dns_opts** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + DNS options to use + + + .. raw:: html + +
+ + * - .. raw:: html + +
+ + + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_dns_search: + + .. rst-class:: ansible-option-title + + **docker_dns_search** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + DNS search domains to use + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_edition: + + .. rst-class:: ansible-option-title + + **docker_edition** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Specifies either ce, or ee version of Docker. + + + .. rst-class:: ansible-option-line + + :ansible-option-default-bold:`Default:` :ansible-option-default:`"ce"` + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_ee_url: + + .. rst-class:: ansible-option-title + + **docker_ee_url** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Docker EE URL from the Docker Store + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_ee_version: + + .. rst-class:: ansible-option-title + + **docker_ee_version** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Docker EE version for EE repository + + + .. rst-class:: ansible-option-line + + :ansible-option-default-bold:`Default:` :ansible-option-default:`17.03` + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_exec_opts: + + .. rst-class:: ansible-option-title + + **docker_exec_opts** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Runtime execution options + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_exec_root: + + .. rst-class:: ansible-option-title + + **docker_exec_root** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Root directory for execution state files + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_fixed_cidr: + + .. rst-class:: ansible-option-title + + **docker_fixed_cidr** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + IPv4 subnet for fixed IPs + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_fixed_cidr_v6: + + .. rst-class:: ansible-option-title + + **docker_fixed_cidr_v6** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + IPv6 subnet for fixed IPs + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_graph: + + .. rst-class:: ansible-option-title + + **docker_graph** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Root of the Docker runtime + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_group: + + .. rst-class:: ansible-option-title + + **docker_group** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Group for the unix socket + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_hosts: + + .. rst-class:: ansible-option-title + + **docker_hosts** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Daemon socket(s) to connect to + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_http_proxy: + + .. rst-class:: ansible-option-title + + **docker_http_proxy** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Set the Docker service to use HTTP\_PROXY + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_https_proxy: + + .. rst-class:: ansible-option-title + + **docker_https_proxy** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Set the Docker service to use HTTPS\_PROXY + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_icc: + + .. rst-class:: ansible-option-title + + **docker_icc** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Enable inter-container communication + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_insecure_registries: + + .. rst-class:: ansible-option-title + + **docker_insecure_registries** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Enable insecure registry communication + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_ip: + + .. rst-class:: ansible-option-title + + **docker_ip** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Default IP when binding container ports + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_ip_forward: + + .. rst-class:: ansible-option-title + + **docker_ip_forward** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Enable net.ipv4.ip\_forward + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_ip_masq: + + .. rst-class:: ansible-option-title + + **docker_ip_masq** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Enable IP masquerading + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_iptables: + + .. rst-class:: ansible-option-title + + **docker_iptables** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Enable addition of iptables rules + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_ipv6: + + .. rst-class:: ansible-option-title + + **docker_ipv6** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Enable IPv6 networking + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_labels: + + .. rst-class:: ansible-option-title + + **docker_labels** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Set key=value labels to the daemon + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_live_restore: + + .. rst-class:: ansible-option-title + + **docker_live_restore** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Enables keeping containers alive during daemon downtime + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_log_driver: + + .. rst-class:: ansible-option-title + + **docker_log_driver** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Default driver for container logs + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_log_level: + + .. rst-class:: ansible-option-title + + **docker_log_level** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Set the logging level + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_log_opts: + + .. rst-class:: ansible-option-title + + **docker_log_opts** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Default log driver options for containers + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_max_concurrent_downloads: + + .. rst-class:: ansible-option-title + + **docker_max_concurrent_downloads** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Set the max concurrent downloads for each pull + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_max_concurrent_uploads: + + .. rst-class:: ansible-option-title + + **docker_max_concurrent_uploads** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Set the max concurrent uploads for each push + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_mount_opts: + + .. rst-class:: ansible-option-title + + **docker_mount_opts** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + The mount options when mounting filesystems + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_mtu: + + .. rst-class:: ansible-option-title + + **docker_mtu** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Set the containers network MTU + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_no_proxy_params: + + .. rst-class:: ansible-option-title + + **docker_no_proxy_params** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Do not proxy for Docker service params + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_oom_score_adjust: + + .. rst-class:: ansible-option-title + + **docker_oom_score_adjust** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Set the oom\_score\_adj for the daemon + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_pidfile: + + .. rst-class:: ansible-option-title + + **docker_pidfile** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Path to use for daemon PID file + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_raw_logs: + + .. rst-class:: ansible-option-title + + **docker_raw_logs** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Full timestamps without ANSI coloring + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_registry_mirrors: + + .. rst-class:: ansible-option-title + + **docker_registry_mirrors** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Preferred Docker registry mirror + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_repo: + + .. rst-class:: ansible-option-title + + **docker_repo** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Defines how Ansible manages the repository + + Options are \ :literal:`other`\ and \ :literal:`docker`\ + + + .. rst-class:: ansible-option-line + + :ansible-option-default-bold:`Default:` :ansible-option-default:`"docker"` + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_runtimes: + + .. rst-class:: ansible-option-title + + **docker_runtimes** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Register an additional OCI compatible runtime + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_selinux_enabled: + + .. rst-class:: ansible-option-title + + **docker_selinux_enabled** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Enable selinux support + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_storage_driver: + + .. rst-class:: ansible-option-title + + **docker_storage_driver** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Storage driver to use + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_storage_opts: + + .. rst-class:: ansible-option-title + + **docker_storage_opts** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Storage driver options + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_swarm_default_advertise_addr: + + .. rst-class:: ansible-option-title + + **docker_swarm_default_advertise_addr** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Set default address or interface for swarm advertised address + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_tls: + + .. rst-class:: ansible-option-title + + **docker_tls** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Use TLS; implied by –tlsverify + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_tlscacert: + + .. rst-class:: ansible-option-title + + **docker_tlscacert** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Trust certs signed only by this CA + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_tlscert: + + .. rst-class:: ansible-option-title + + **docker_tlscert** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Path to TLS certificate file + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_tlskey: + + .. rst-class:: ansible-option-title + + **docker_tlskey** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Path to TLS key file + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_tlsverify: + + .. rst-class:: ansible-option-title + + **docker_tlsverify** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Use TLS and verify the remote + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_userland_proxy: + + .. rst-class:: ansible-option-title + + **docker_userland_proxy** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Use userland proxy for loopback traffic + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_userns_remap: + + .. rst-class:: ansible-option-title + + **docker_userns_remap** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + User/Group setting for user namespaces + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.ericsysmin.docker.docker_role__parameter-main__docker_users: + + .. rst-class:: ansible-option-title + + **docker_users** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + A list of system users to be added to the docker group (so they can use Docker on the server) + + + .. raw:: html + +
+ + +.. Attributes + + +.. Notes + + +.. Seealso + + +Authors +^^^^^^^ + +- Eric Anderson + + + +.. Extra links + +Collection links +~~~~~~~~~~~~~~~~ + +.. ansible-links:: + + - title: "Issue Tracker" + url: "https://github.com/ericsysmin/ansible-collection-docker/issues" + external: true + - title: "Repository (Sources)" + url: "https://github.com/ericsysmin/ansible-collection-docker" + external: true + + +.. Parsing errors + diff --git a/dest/rst/collections/ericsysmin/docker/index.rst b/dest/rst/collections/ericsysmin/docker/index.rst new file mode 100644 index 0000000..10aee54 --- /dev/null +++ b/dest/rst/collections/ericsysmin/docker/index.rst @@ -0,0 +1,66 @@ + + +.. meta:: + :antsibull-docs: 2.6.1 + + +.. _plugins_in_ericsysmin.docker: + +Ericsysmin.Docker +================= + +Collection version 1.0.0 + +.. contents:: + :local: + :depth: 1 + +Description +----------- + +Docker collection + +**Author:** + +* Eric Anderson + + +.. ansible-links:: + + - title: "Issue Tracker" + url: "https://github.com/ericsysmin/ansible-collection-docker/issues" + external: true + - title: "Repository (Sources)" + url: "https://github.com/ericsysmin/ansible-collection-docker" + external: true + + + + +.. toctree:: + :maxdepth: 1 + + +Plugin Index +------------ + +There are no plugins in the ericsysmin.docker collection with automatically generated documentation. + + +Role Index +---------- + +These are the roles in the ericsysmin.docker collection: + +* :ansplugin:`docker role ` -- Ansible role to install and configure Docker + +.. toctree:: + :maxdepth: 1 + :hidden: + + docker_role + + +.. seealso:: + + List of :ref:`collections ` with docs hosted here. diff --git a/dest/rst/collections/ericsysmin/index.rst b/dest/rst/collections/ericsysmin/index.rst new file mode 100644 index 0000000..1280370 --- /dev/null +++ b/dest/rst/collections/ericsysmin/index.rst @@ -0,0 +1,19 @@ + + +.. meta:: + :antsibull-docs: 2.6.1 + +.. _list_of_collections_ericsysmin: + +Collections in the Ericsysmin Namespace +======================================= + +These are the collections documented here in the **ericsysmin** namespace. + +* :ref:`ericsysmin.docker ` + +.. toctree:: + :maxdepth: 1 + :hidden: + + docker/index diff --git a/dest/rst/collections/index.rst b/dest/rst/collections/index.rst new file mode 100644 index 0000000..35ba198 --- /dev/null +++ b/dest/rst/collections/index.rst @@ -0,0 +1,20 @@ + +:orphan: + +.. meta:: + :antsibull-docs: 2.6.1 + +.. _list_of_collections: + +Collection Index +================ + +These are the collections documented here. + +* :ref:`ericsysmin.docker ` + +.. toctree:: + :maxdepth: 1 + :hidden: + + ericsysmin/index diff --git a/dest/rst/collections/index_role.rst b/dest/rst/collections/index_role.rst new file mode 100644 index 0000000..1e3d294 --- /dev/null +++ b/dest/rst/collections/index_role.rst @@ -0,0 +1,16 @@ + +:orphan: + +.. meta:: + :antsibull-docs: 2.6.1 + +.. _list_of_role_plugins: + +Index of all Roles +================== + +ericsysmin.docker +----------------- + +* :ansplugin:`ericsysmin.docker.docker#role` -- Ansible role to install and configure Docker + diff --git a/dest/rst/index.rst b/dest/rst/index.rst new file mode 100644 index 0000000..a180d9a --- /dev/null +++ b/dest/rst/index.rst @@ -0,0 +1,31 @@ + +.. Created with antsibull-docs 2.6.1 + +.. _docsite_root_index: + +Welcome to my Ansible collection documentation +============================================== + +This docsite contains documentation of ericsysmin.docker. + + +.. toctree:: + :maxdepth: 2 + :caption: Collections: + + collections/index + + +.. toctree:: + :maxdepth: 1 + :caption: Plugin indexes: + :glob: + + collections/index_* + + +.. toctree:: + :maxdepth: 1 + :caption: Reference indexes: + + collections/environment_variables diff --git a/docs/readme.md b/docs/readme.md index 367b977..eb7c715 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -1,14 +1,17 @@ -## Installing Docker via Ansible -### Default Docker Install -``` +# Installing Docker via Ansible + +## Default Docker Install + +```yaml --- - hosts: all roles: - role: avinetworks.docker ``` -### Install Docker w/devicemapper -``` +## Install Docker w/devicemapper + +```yaml --- - hosts: all roles: @@ -17,8 +20,9 @@ docker_block_device: /dev/sda3 ``` -### Install Docker w/HTTP Proxy Support -``` +## Install Docker w/HTTP Proxy Support + +```yaml --- - hosts: all roles: @@ -27,8 +31,9 @@ docker_https_proxy: https://proxy.example.com:443/ ``` -### Install Docker w/HTTP Proxy Support & without proxy on internal sites -``` +## Install Docker w/HTTP Proxy Support & without proxy on internal sites + +```yaml --- - hosts: all roles: @@ -38,8 +43,9 @@ docker_no_proxy_params: "localhost,127.0.0.0/8,docker-registry.example.com" ``` -### Install Docker and customize the storage directory of images and containers -``` +## Install Docker and customize the storage directory of images and containers + +```yaml --- - hosts: all roles: @@ -47,8 +53,9 @@ docker_graph: /home/docker ``` -### Install/Upgrade Docker. Avoid container downtime during the upgrade of a Docker -``` +## Install/Upgrade Docker. Avoid container downtime during the upgrade of a Docker + +```yaml --- - hosts: all roles: diff --git a/galaxy.yml b/galaxy.yml index 33878d4..18207be 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,58 +1,21 @@ -### REQUIRED - -# The namespace of the collection. This can be a company/brand/organization or product namespace under which all -# content lives. May only contain alphanumeric characters and underscores. Additionally namespaces cannot start with -# underscores or numbers and cannot contain consecutive underscores +--- namespace: ericsysmin - -# The name of the collection. Has the same character restrictions as 'namespace' name: docker - -# The version of the collection. Must be compatible with semantic versioning -version: 0.1.1 - -# The path to the Markdown (.md) readme file. This path is relative to the root of the collection +version: "1.0.0" readme: README.md - -# A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) -# @nicks:irc/im.site#channel' authors: -- Eric Anderson - - -### OPTIONAL but strongly recommended - -# A short summary description of the collection + - Eric Anderson description: Docker collection - -# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only -# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file' -# license: -# - GPL-2.0-or-later - -# The path to the license file for the collection. This path is relative to the root of the collection. This key is -# mutually exclusive with 'license' -license_file: LICENSE - -# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character -# requirements as 'namespace' and 'name' +license: + - MIT tags: - docker - -# Collections that this collection requires to be installed for it to be usable. The key of the dict is the -# collection label 'namespace.name'. The value is a version range -# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version -# range specifiers can be set and are separated by ',' -#dependencies: {} - -# The URL of the originating SCM repository + - infrastructure +dependencies: { + "community.general": "*", + "ansible.posix": "*" +} repository: https://github.com/ericsysmin/ansible-collection-docker - -# The URL to any online docs -#documentation: http://docs.example.com - -# The URL to the homepage of the collection/project homepage: https://github.com/ericsysmin/ansible-collection-docker - -# The URL to the collection issue tracker issues: https://github.com/ericsysmin/ansible-collection-docker/issues +documentation: https://ericsysmin.github.io/ansible-collection-docker/ diff --git a/meta/runtime.yml b/meta/runtime.yml new file mode 100644 index 0000000..bb3fca1 --- /dev/null +++ b/meta/runtime.yml @@ -0,0 +1 @@ +requires_ansible: '>=2.14.0' diff --git a/molecule/default/.ansible-lint b/molecule/default/.ansible-lint deleted file mode 100644 index e74e096..0000000 --- a/molecule/default/.ansible-lint +++ /dev/null @@ -1,6 +0,0 @@ ---- -parseable: true -skip_list: - - ANSIBLE0010 -use_default_rules: true -verbosity: 1 diff --git a/molecule/default/.yamllint b/molecule/default/.yamllint deleted file mode 100644 index a027086..0000000 --- a/molecule/default/.yamllint +++ /dev/null @@ -1,11 +0,0 @@ ---- -extends: default - -rules: - braces: - max-spaces-inside: 1 - level: error - brackets: - max-spaces-inside: 1 - level: error - line-length: disable diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2 deleted file mode 100644 index 1478f38..0000000 --- a/molecule/default/Dockerfile.j2 +++ /dev/null @@ -1,30 +0,0 @@ -# Molecule managed - -{% if item.registry is defined %} -FROM {{ item.registry.url }}/{{ item.image }} -{% else %} -FROM {{ item.image }} -{% endif %} - -RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ - elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash systemd && dnf clean all; \ - elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ - elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ - elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ - elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi - - -{% if item.image.split(':', 1)[1] in ["bionic", "stretch"] %} -RUN apt-get install -y systemd systemd-cron && apt-get clean -{% endif %} - -{% if item.service_manager == "systemd" %} -RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ - rm -f /lib/systemd/system/multi-user.target.wants/*;\ - rm -f /etc/systemd/system/*.wants/*;\ - rm -f /lib/systemd/system/local-fs.target.wants/*; \ - rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ - rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ - rm -f /lib/systemd/system/basic.target.wants/*;\ - rm -f /lib/systemd/system/anaconda.target.wants/*; -{% endif %} diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml deleted file mode 100644 index 12347eb..0000000 --- a/molecule/default/converge.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Converge - hosts: all - pre_tasks: - - name: upgrade python # noqa 403 - package: - name: python - state: latest - - name: create containerd folder - file: - path: /etc/systemd/system/containerd.service.d - state: directory - when: ansible_service_mgr == "systemd" - - name: override file for containerd - copy: - src: files/override.conf - dest: /etc/systemd/system/containerd.service.d/override.conf - when: ansible_service_mgr == "systemd" - roles: - - role: ericsysmin.docker.docker diff --git a/molecule/default/files/override.conf b/molecule/default/files/override.conf deleted file mode 100644 index 76864e2..0000000 --- a/molecule/default/files/override.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Service] -ExecStartPre= diff --git a/molecule/docker/Dockerfile.j2 b/molecule/docker/Dockerfile.j2 new file mode 100644 index 0000000..28c807f --- /dev/null +++ b/molecule/docker/Dockerfile.j2 @@ -0,0 +1 @@ +{{ lookup('url', 'https://raw.githubusercontent.com/ericsysmin/ansible-molecule-dockerfiles/main/' ~ item.image ~ '/Dockerfile', split_lines=False) }} diff --git a/molecule/docker/converge.yml b/molecule/docker/converge.yml new file mode 100644 index 0000000..6e36e06 --- /dev/null +++ b/molecule/docker/converge.yml @@ -0,0 +1,26 @@ +--- +- name: Converge + hosts: all + pre_tasks: + - name: Wait for systemd to complete initialization. # noqa command-instead-of-module + ansible.builtin.command: systemctl is-system-running + register: systemctl_status + until: >- + "running" in systemctl_status.stdout or "degraded" in + systemctl_status.stdout + retries: 30 + delay: 5 + when: + - ansible_service_mgr == "systemd" + - ansible_distribution == "Fedora" + changed_when: false + - name: Update package cache + ansible.builtin.package: + update_cache: true + changed_when: false + register: task_result + until: task_result is success + retries: 10 + delay: 2 + roles: + - role: ericsysmin.docker.docker diff --git a/molecule/default/molecule.yml b/molecule/docker/molecule.yml similarity index 66% rename from molecule/default/molecule.yml rename to molecule/docker/molecule.yml index b891dc6..2780dfc 100644 --- a/molecule/default/molecule.yml +++ b/molecule/docker/molecule.yml @@ -9,12 +9,12 @@ lint: | ansible-lint platforms: - name: instance - image: ${MOLECULE_DISTRO:-ubuntu:xenial} + image: ${MOLECULE_DISTRO:-ubuntu-xenial} privileged: true - service_manager: ${MOLECULE_SERVICE_MANAGER:-systemd} - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro command: ${MOLECULE_COMMAND:-""} + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host provisioner: name: ansible playbooks: diff --git a/molecule/default/tests/test_default.py b/molecule/docker/tests/test_default.py similarity index 100% rename from molecule/default/tests/test_default.py rename to molecule/docker/tests/test_default.py diff --git a/molecule/default/verify.yml b/molecule/docker/verify.yml similarity index 55% rename from molecule/default/verify.yml rename to molecule/docker/verify.yml index a82dd6f..6e148b1 100644 --- a/molecule/default/verify.yml +++ b/molecule/docker/verify.yml @@ -4,6 +4,6 @@ - name: Verify hosts: all tasks: - - name: Example assertion - assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index dd7a14b..e2aa1a2 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -1,4 +1,5 @@ --- +# code: language=ansible # defaults file for docker docker_service_enabled: true docker_config: {} diff --git a/roles/docker/handlers/main.yml b/roles/docker/handlers/main.yml index 74d2198..c5e4240 100644 --- a/roles/docker/handlers/main.yml +++ b/roles/docker/handlers/main.yml @@ -1,6 +1,9 @@ --- - name: Docker | Daemon-reload - systemd: daemon_reload=yes + ansible.builtin.systemd: + daemon_reload: "yes" - name: Docker | Restart Docker - service: name=docker state=restarted + ansible.builtin.service: + name: docker + state: restarted diff --git a/roles/docker/meta/argument_specs.yml b/roles/docker/meta/argument_specs.yml new file mode 100644 index 0000000..9514e14 --- /dev/null +++ b/roles/docker/meta/argument_specs.yml @@ -0,0 +1,149 @@ +--- +# code: language=ansible +argument_specs: + main: + short_description: Ansible role to install and configure Docker + description: + - Installation of Docker following Docker-Engine install procedures as documented by Docker. + - It will manage kernel versions as well, verifying the that the correct kernel for Docker support is installed. + author: + - Eric Anderson + options: + docker_edition: + description: Specifies either ce, or ee edition of Docker. + default: ce + docker_ee_url: + description: Docker EE URL from the Docker Store + docker_repo: + description: + - Defines how Ansible manages the repository + - Options are C(other) and C(docker) + default: docker + docker_channel: + description: What release channel of Docker to install. + default: stable + docker_ee_version: + description: Docker EE version for EE repository + default: 17.03 + docker_storage_driver: + description: Storage driver to use + docker_block_device: + description: The device name used for the storage driver. + docker_mount_opts: + description: The mount options when mounting filesystems + docker_storage_opts: + description: Storage driver options + docker_api_cors_header: + description: Set CORS headers in the remote API + docker_authorization_plugins: + description: Authorization plugins to load + docker_bip: + description: Specify network bridge IP + docker_bridge: + description: Attach containers to a network bridge + docker_cgroup_parent: + description: Set parent cgroup for all containers + docker_cluster_store: + description: Set cluster store options + docker_cluster_store_opts: + description: Please see dockerd manual for info + docker_cluster_advertise: + description: Address or interface name to advertise + docker_debug: + description: Enable debug mode + docker_default_gateway: + description: Container default gateway IPv4 address + docker_default_gateway_v6: + description: Container default gateway IPv6 address + docker_default_runtime: + description: Default OCI runtime for containers + docker_default_ulimits: + description: Default ulimits for containers + docker_disable_legacy_registry: + description: Disable contacting legacy registries + docker_dns: + description: DNS server to use + docker_dns_opts: + description: DNS options to use + docker_dns_search: + description: DNS search domains to use + docker_exec_opts: + description: Runtime execution options + docker_exec_root: + description: Root directory for execution state files + docker_fixed_cidr: + description: IPv4 subnet for fixed IPs + docker_fixed_cidr_v6: + description: IPv6 subnet for fixed IPs + docker_graph: + description: Root of the Docker runtime + docker_group: + description: Group for the unix socket + docker_hosts: + description: Daemon socket(s) to connect to + docker_icc: + description: Enable inter-container communication + docker_insecure_registries: + description: Enable insecure registry communication + docker_ip: + description: Default IP when binding container ports + docker_iptables: + description: Enable addition of iptables rules + docker_ipv6: + description: Enable IPv6 networking + docker_ip_forward: + description: Enable net.ipv4.ip_forward + docker_ip_masq: + description: Enable IP masquerading + docker_labels: + description: Set key=value labels to the daemon + docker_live_restore: + description: Enables keeping containers alive during daemon downtime + docker_log_driver: + description: Default driver for container logs + docker_log_level: + description: Set the logging level + docker_log_opts: + description: Default log driver options for containers + docker_max_concurrent_downloads: + description: Set the max concurrent downloads for each pull + docker_max_concurrent_uploads: + description: Set the max concurrent uploads for each push + docker_mtu: + description: Set the containers network MTU + docker_oom_score_adjust: + description: Set the oom_score_adj for the daemon + docker_pidfile: + description: Path to use for daemon PID file + docker_raw_logs: + description: Full timestamps without ANSI coloring + docker_registry_mirrors: + description: Preferred Docker registry mirror + docker_runtimes: + description: Register an additional OCI compatible runtime + docker_selinux_enabled: + description: Enable selinux support + docker_swarm_default_advertise_addr: + description: Set default address or interface for swarm advertised address + docker_tls: + description: Use TLS; implied by –tlsverify + docker_tlscacert: + description: Trust certs signed only by this CA + docker_tlscert: + description: Path to TLS certificate file + docker_tlskey: + description: Path to TLS key file + docker_tlsverify: + description: Use TLS and verify the remote + docker_userland_proxy: + description: Use userland proxy for loopback traffic + docker_userns_remap: + description: User/Group setting for user namespaces + docker_users: + description: A list of system users to be added to the docker group (so they can use Docker on the server) + docker_http_proxy: + description: Set the Docker service to use HTTP_PROXY + docker_https_proxy: + description: Set the Docker service to use HTTPS_PROXY + docker_no_proxy_params: + description: Do not proxy for Docker service params diff --git a/roles/docker/meta/main.yml b/roles/docker/meta/main.yml index 3ba54fc..a7bccaf 100644 --- a/roles/docker/meta/main.yml +++ b/roles/docker/meta/main.yml @@ -1,32 +1,12 @@ --- +# code: language=ansible galaxy_info: role_name: docker author: ericsymsin - description: Ansible role that installs Docker - company: Avi Networks + description: Ansible role that installs and configures Docker issue_tracker_url: https://github.com/ericsysmin/ansible-collection-docker/issues - license: Apache-2.0 - min_ansible_version: 2.4.0 - github_branch: master - platforms: - - name: EL - versions: - - 7 - - 8 - - name: Fedora - versions: - - 27 - - 28 - - name: Ubuntu - versions: - - trusty - - xenial - - bionic - - name: Debian - versions: - - jessie - - stretch - - wheezy + license: MIT + min_ansible_version: "2.9.0" galaxy_tags: - docker - ubuntu diff --git a/roles/docker/tasks/ce/apt.yml b/roles/docker/tasks/ce/apt.yml index 09bc2cd..09aa5c0 100644 --- a/roles/docker/tasks/ce/apt.yml +++ b/roles/docker/tasks/ce/apt.yml @@ -1,18 +1,7 @@ --- -- name: Docker | CE | APT | Remove old repo lxc-docker - apt: - name: - - docker - - docker-engine - - docker-io - state: absent - register: task_result - until: task_result is success - retries: 10 - delay: 2 - +# code: language=ansible - name: Docker | CE | APT | Install Prerequisits for APT - apt: + ansible.builtin.apt: name: - apt-transport-https - ca-certificates @@ -28,33 +17,40 @@ - name: Docker | CE | APT | Add repository key block: - name: Docker | CE | APT | Add Docker GPG Key - apt_key: + ansible.builtin.apt_key: id: "{{ docker_ce_gpg_key_id }}" url: "{{ docker_ce_gpg_key }}" validate_certs: "{{ docker_ce_gpg_key_validate_certs }}" rescue: - name: Docker | CE | APT | Ensure curl is present (systems without SNI). - package: name=curl - - name: Docker | CE | APT | Download GPG key (systems without SNI). # noqa 303 - shell: "curl -sSL {{ docker_ce_gpg_key }} | sudo apt-key add -" - + ansible.builtin.package: + name: curl + - name: Docker | CE | APT | Download GPG key (systems without SNI). # noqa command-instead-of-module no-changed-when + ansible.builtin.command: curl -sSL {{ docker_ce_gpg_key }} | sudo apt-key add - - name: Docker | CE | APT | Configure Docker repository - apt_repository: + ansible.builtin.apt_repository: repo: "{{ docker_apt_repo_url }}" - name: Docker | CE | APT | Enable Edge repository - apt_repository: + ansible.builtin.apt_repository: repo: "{{ docker_apt_repo_url_edge }}" when: docker_channel == "edge" - name: Docker | CE | APT | Perform specific os tasks - include_tasks: "{{ item }}" + ansible.builtin.include_tasks: "{{ item }}" with_first_found: - - os/{{ ansible_distribution.split(' ', 1)[0]|lower }}.yml - - os/default.yml + - ce/os/{{ ansible_distribution.split(' ', 1)[0] | lower }}.yml + - ce/os/default.yml - name: Docker | CE | APT | Install docker-ce - apt: name=docker-ce state=present + ansible.builtin.apt: + name: + - docker-ce + - docker-ce-cli + - containerd.io + - docker-buildx-plugin + - docker-compose-plugin + state: present notify: Docker | Restart Docker register: task_result until: task_result is success diff --git a/roles/docker/tasks/ce/dnf.yml b/roles/docker/tasks/ce/dnf.yml index d97c247..5dd5f0f 100644 --- a/roles/docker/tasks/ce/dnf.yml +++ b/roles/docker/tasks/ce/dnf.yml @@ -1,55 +1,54 @@ --- -# - name: Docker | CE | DNF | Remove older Docker installations -# dnf: name={{ item }} state=absent -# with_items: -# - docker -# - docker-common -# - docker-engine +# code: language=ansible - name: Docker | CE | DNF | Add repository key block: - name: Docker | CE | DNF | Add repository key - rpm_key: + ansible.builtin.rpm_key: key: "{{ docker_ce_gpg_key }}" rescue: - name: Docker | CE | DNF | Ensure curl is present (systems without SNI). - package: name=curl + ansible.builtin.package: + name: curl register: task_result until: task_result is success retries: 10 delay: 2 - - name: Docker | CE | DNF | Download GPG key (systems without SNI). # noqa 303 305 - shell: "curl -sSL {{ docker_ce_gpg_key }} -o /tmp/docker-gpg" - - name: Docker | CE | DNF | Add Docker GPG key (systems without SNI). # noqa 303 305 - shell: rpm --import /tmp/docker-gpg + - name: Docker | CE | DNF | Download GPG key (systems without SNI). # noqa command-instead-of-module no-changed-when + ansible.builtin.command: curl -sSL {{ docker_ce_gpg_key }} -o /tmp/docker-gpg + - name: Docker | CE | DNF | Add Docker GPG key (systems without SNI). # noqa command-instead-of-module no-changed-when + ansible.builtin.command: rpm --import /tmp/docker-gpg - name: Docker | CE | DNF | Remove docker-gpg from tmp folder - file: path=/tmp/docker-gpg state=absent + ansible.builtin.file: + path: /tmp/docker-gpg + state: absent - name: Docker | CE | DNF | Deploy repository block: - name: Docker | CE | DNF | Deploy repository - get_url: + ansible.builtin.get_url: url: "{{ docker_ce_repo_file_url }}" dest: /etc/yum.repos.d/docker-ce.repo owner: root group: root - mode: 0644 + mode: "0644" rescue: - name: Docker | CE | DNF | Install dnf-utils (systems without SNI) - dnf: name=dnf-plugins-core + ansible.builtin.dnf: + name: dnf-plugins-core register: task_result until: task_result is success retries: 10 delay: 2 - - name: Docker | CE | DNF | Deploy repository (systems without SNI) # noqa 305 - shell: "dnf config-manager --add-repo {{ docker_ce_repo_file_url }}" + - name: Docker | CE | DNF | Deploy repository (systems without SNI) # noqa command-instead-of-module + ansible.builtin.command: dnf config-manager --add-repo {{ docker_ce_repo_file_url }} args: creates: /etc/yum.repos.d/docker-ce.repo - name: Docker | CE | DNF | Enable edge repository - yum_repository: + ansible.builtin.yum_repository: name: docker-ce-edge - description: "Docker CE Edge - $basearch" + description: Docker CE Edge - $basearch baseurl: "{{ docker_ce_edge_repo_url }}" gpgcheck: true gpgkey: "{{ docker_ce_gpg_key }}" @@ -58,13 +57,13 @@ when: docker_channel == "edge" - name: Docker | CE | DNF | Perform specific os tasks - include_tasks: "{{ item }}" + ansible.builtin.include_tasks: "{{ item }}" with_first_found: - - os/{{ ansible_distribution.split(' ', 1)[0]|lower }}.yml - - os/default.yml + - ce/os/{{ ansible_distribution.split(' ', 1)[0] | lower }}.yml + - ce/os/default.yml - name: Docker | CE | DNF | Install docker-ce - dnf: + ansible.builtin.dnf: name: docker-ce state: present notify: Docker | Restart Docker diff --git a/roles/docker/tasks/ce/os/debian.yml b/roles/docker/tasks/ce/os/debian.yml index 68e0732..daecc4f 100644 --- a/roles/docker/tasks/ce/os/debian.yml +++ b/roles/docker/tasks/ce/os/debian.yml @@ -1,4 +1,5 @@ --- +# code: language=ansible - name: Docker | CE | Debian | Install the Debian Backports repository - apt_repository: - repo: "deb http://ftp.debian.org/debian {{ ansible_distribution_release }}-backports main" + ansible.builtin.apt_repository: + repo: deb http://ftp.debian.org/debian {{ ansible_distribution_release }}-backports main diff --git a/roles/docker/tasks/ce/os/default.yml b/roles/docker/tasks/ce/os/default.yml index ed97d53..c6e72ab 100644 --- a/roles/docker/tasks/ce/os/default.yml +++ b/roles/docker/tasks/ce/os/default.yml @@ -1 +1,2 @@ --- +# code: language=ansible diff --git a/roles/docker/tasks/ce/os/ubuntu.yml b/roles/docker/tasks/ce/os/ubuntu.yml index 31c5fa1..14cefc0 100644 --- a/roles/docker/tasks/ce/os/ubuntu.yml +++ b/roles/docker/tasks/ce/os/ubuntu.yml @@ -1,8 +1,10 @@ --- +# code: language=ansible # For Ubuntu Trusty, Wily, and Xenial, it’s recommended to install the linux-image-extra kernel package. # The linux-image-extra package allows you use the aufs storage driver. - name: Docker | CE | Ubuntu | Install the linux-image-extra kernal package - apt: name="linux-image-extra-{{ ansible_kernel }}" state=present + ansible.builtin.apt: + name: "linux-image-extra-{{ ansible_kernel }}" when: ansible_distribution_version in ['14.04','15.10'] register: task_result until: task_result is success @@ -11,7 +13,9 @@ # If you are installing on Ubuntu 14.04, apparmor is required. - name: Docker | CE | Ubuntu | Install AppArmor Dependency - apt: name=apparmor state=present + ansible.builtin.apt: + name: apparmor + state: present when: ansible_distribution_version in "14.04" register: task_result until: task_result is success diff --git a/roles/docker/tasks/ce/yum.yml b/roles/docker/tasks/ce/yum.yml index c0abaea..b30fece 100644 --- a/roles/docker/tasks/ce/yum.yml +++ b/roles/docker/tasks/ce/yum.yml @@ -1,51 +1,49 @@ --- -# - name: Docker | CE | YUM | Remove older Docker installations -# yum: name={{ item }} state=absent -# with_items: -# - docker -# - docker-common -# - docker-engine +# code: language=ansible - name: Docker | CE | YUM | Add repository key block: - name: Docker | CE | YUM | Add repository key - rpm_key: + ansible.builtin.rpm_key: key: "{{ docker_ce_gpg_key }}" rescue: - name: Docker | CE | YUM | Ensure curl is present (systems without SNI). - package: name=curl - - name: Docker | CE | YUM | Download GPG key (systems without SNI). # noqa 303 305 - shell: "curl -sSL {{ docker_ce_gpg_key }} -o /tmp/docker-gpg" - - name: Docker | CE | YUM | Add Docker GPG key (systems without SNI). # noqa 303 305 - shell: rpm --import /tmp/docker-gpg + ansible.builtin.package: + name: curl + - name: Docker | CE | YUM | Download GPG key (systems without SNI). # noqa no-changed-when command-instead-of-module + ansible.builtin.command: curl -sSL {{ docker_ce_gpg_key }} -o /tmp/docker-gpg + - name: Docker | CE | YUM | Add Docker GPG key (systems without SNI). # noqa no-changed-when command-instead-of-module + ansible.builtin.command: rpm --import /tmp/docker-gpg - name: Docker | CE | YUM | Remove docker-gpg from tmp folder - file: path=/tmp/docker-gpg state=absent - + ansible.builtin.file: + path: /tmp/docker-gpg + state: absent - name: Docker | CE | YUM | Deploy repository block: - name: Docker | CE | YUM | Deploy repository - get_url: + ansible.builtin.get_url: url: "{{ docker_ce_repo_file_url }}" dest: /etc/yum.repos.d/docker-ce.repo owner: root group: root - mode: 0644 + mode: "0644" rescue: - name: Docker | CE | YUM | Install yum-utils (systems without SNI) - yum: name=yum-utils + ansible.builtin.yum: + name: yum-utils register: task_result until: task_result is success retries: 10 delay: 2 - - name: Docker | CE | YUM | Deploy repository (systems without SNI) # noqa 305 - shell: "yum-config-manager --add-repo {{ docker_ce_repo_file_url }}" + - name: Docker | CE | YUM | Deploy repository (systems without SNI) + ansible.builtin.command: yum-config-manager --add-repo {{ docker_ce_repo_file_url }} args: creates: /etc/yum.repos.d/docker-ce.repo - name: Docker | CE | YUM | Enable edge repository - yum_repository: + ansible.builtin.yum_repository: name: docker-ce-edge - description: "Docker CE Edge - $basearch" + description: Docker CE Edge - $basearch baseurl: "{{ docker_ce_edge_repo_url }}" gpgcheck: true gpgkey: "{{ docker_ce_gpg_key }}" @@ -54,13 +52,13 @@ when: docker_channel == "edge" - name: Docker | CE | YUM | Perform specific os tasks - include_tasks: "{{ item }}" + ansible.builtin.include_tasks: "{{ item }}" with_first_found: - - os/{{ ansible_distribution.split(' ', 1)[0]|lower }}.yml + - os/{{ ansible_distribution.split(' ', 1)[0] | lower }}.yml - os/default.yml - name: Docker | CE | YUM | Install docker-ce - yum: + ansible.builtin.yum: name: docker-ce state: present notify: Docker | Restart Docker diff --git a/roles/docker/tasks/deploy_config.yml b/roles/docker/tasks/deploy_config.yml index 421fbc6..168bb2a 100644 --- a/roles/docker/tasks/deploy_config.yml +++ b/roles/docker/tasks/deploy_config.yml @@ -1,19 +1,21 @@ --- +# code: language=ansible - name: Docker | Deploy Config | Make sure /etc/docker exists - file: path=/etc/docker state=directory + ansible.builtin.file: + path: /etc/docker + state: directory + mode: "0755" -# - name: Docker | Deploy Config | Deploy /etc/docker/daemon.json -# template: src=docker_config.j2 dest=/etc/docker/daemon.json -# notify: Docker | Restart Docker - -#### THESE ALLOW NOT USING TEMPLATE FILE ### - name: Docker | Deploy Config | Set the Docker configuration - set_fact: - docker_config: "{{ docker_config|combine({ item.key: item.value }) }}" + ansible.builtin.set_fact: + docker_config: "{{ docker_config | combine({item.key: item.value}) }}" when: item.value | string | length > 0 with_dict: "{{ docker_options }}" - name: Docker | Deploy Config | Deploy /etc/docker/daemon.json - copy: content="{{ docker_config | to_nice_json }}\n" dest=/etc/docker/daemon.json + ansible.builtin.copy: + content: "{{ docker_config | to_nice_json }}" + dest: /etc/docker/daemon.json + mode: "0644" when: docker_config != {} notify: Docker | Restart Docker diff --git a/roles/docker/tasks/docker_users.yml b/roles/docker/tasks/docker_users.yml index 45d082e..6675526 100644 --- a/roles/docker/tasks/docker_users.yml +++ b/roles/docker/tasks/docker_users.yml @@ -1,6 +1,7 @@ --- +# code: language=ansible - name: Ensure docker users are added to the docker group. - user: + ansible.builtin.user: name: "{{ item }}" groups: docker append: true diff --git a/roles/docker/tasks/ee/apt.yml b/roles/docker/tasks/ee/apt.yml index 33682ae..db182d8 100644 --- a/roles/docker/tasks/ee/apt.yml +++ b/roles/docker/tasks/ee/apt.yml @@ -1,33 +1,38 @@ --- +# code: language=ansible - name: Docker | EE | APT | Install Prerequisits for APT - apt: name="{{ item }}" state=present - with_items: - - apt-transport-https - - ca-certificates - - curl - - software-properties-common + ansible.builtin.apt: + name: + - apt-transport-https + - ca-certificates + - curl + - software-properties-common + state: present register: task_result until: task_result is success retries: 10 delay: 2 - name: Docker | EE | APT | Perform specific os tasks - include: os/{{ ansible_distribution|lower }}.yml + ansible.builtin.include_tasks: os/{{ ansible_distribution | lower }}.yml - name: Docker | EE | APT | Remove old repo lxc-docker - apt: name={{ item }} state=absent - with_items: - - lxc-docker - - docker - - docker-engine - - docker-ce + ansible.builtin.apt: + name: + - lxc-docker + - docker + - docker-engine + - docker-ce + state: absent register: task_result until: task_result is success retries: 10 delay: 2 - name: Docker | EE | APT | Install Docker Engine - apt: name=docker-ee state=present + ansible.builtin.apt: + name: docker-ee + state: present notify: Docker | Restart Docker register: task_result until: task_result is success diff --git a/roles/docker/tasks/ee/os/centos.yml b/roles/docker/tasks/ee/os/centos.yml index ed97d53..c6e72ab 100644 --- a/roles/docker/tasks/ee/os/centos.yml +++ b/roles/docker/tasks/ee/os/centos.yml @@ -1 +1,2 @@ --- +# code: language=ansible diff --git a/roles/docker/tasks/ee/os/debian.yml b/roles/docker/tasks/ee/os/debian.yml index ed97d53..c6e72ab 100644 --- a/roles/docker/tasks/ee/os/debian.yml +++ b/roles/docker/tasks/ee/os/debian.yml @@ -1 +1,2 @@ --- +# code: language=ansible diff --git a/roles/docker/tasks/ee/os/fedora.yml b/roles/docker/tasks/ee/os/fedora.yml index ed97d53..c6e72ab 100644 --- a/roles/docker/tasks/ee/os/fedora.yml +++ b/roles/docker/tasks/ee/os/fedora.yml @@ -1 +1,2 @@ --- +# code: language=ansible diff --git a/roles/docker/tasks/ee/os/oraclelinux.yml b/roles/docker/tasks/ee/os/oraclelinux.yml index 0be40b2..e3a5260 100644 --- a/roles/docker/tasks/ee/os/oraclelinux.yml +++ b/roles/docker/tasks/ee/os/oraclelinux.yml @@ -1,9 +1,10 @@ --- +# code: language=ansible - name: Docker | EE | YUM | Oracle Linux | Disable UEK R3 - yum_repository: + ansible.builtin.yum_repository: name: ol7_UEKR3 description: Latest Unbreakable Enterprise Kernel Release 3 for Oracle Linux $releasever ($basearch) - baseurl: "http://yum.oracle.com/repo/OracleLinux/OL7/UEKR3/$basearch/" + baseurl: http://yum.oracle.com/repo/OracleLinux/OL7/UEKR3/$basearch/ enabled: 0 gpgcheck: 1 gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle @@ -14,10 +15,10 @@ delay: 2 - name: Docker | EE | YUM | Oracle Linux | Enable UEK R4 - yum_repository: + ansible.builtin.yum_repository: name: ol7_UEKR4 description: Latest Unbreakable Enterprise Kernel Release 4 for Oracle Linux $releasever ($basearch) - baseurl: "http://yum.oracle.com/repo/OracleLinux/OL7/UEKR4/$basearch/" + baseurl: http://yum.oracle.com/repo/OracleLinux/OL7/UEKR4/$basearch/ enabled: 1 gpgcheck: 1 gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle diff --git a/roles/docker/tasks/ee/os/redhat.yml b/roles/docker/tasks/ee/os/redhat.yml index ed97d53..c6e72ab 100644 --- a/roles/docker/tasks/ee/os/redhat.yml +++ b/roles/docker/tasks/ee/os/redhat.yml @@ -1 +1,2 @@ --- +# code: language=ansible diff --git a/roles/docker/tasks/ee/os/ubuntu.yml b/roles/docker/tasks/ee/os/ubuntu.yml index ca66fc6..e541dbd 100644 --- a/roles/docker/tasks/ee/os/ubuntu.yml +++ b/roles/docker/tasks/ee/os/ubuntu.yml @@ -1,8 +1,11 @@ --- +# code: language=ansible # For Ubuntu Trusty, Wily, and Xenial, it’s recommended to install the linux-image-extra kernel package. # The linux-image-extra package allows you use the aufs storage driver. - name: Docker | EE | Ubuntu | Install the linux-image-extra kernal package - apt: name="linux-image-extra-{{ ansible_kernel }}" state=present + ansible.builtin.apt: + name: "linux-image-extra-{{ ansible_kernel }}" + state: present when: ansible_distribution_version in ['14.04','15.10'] register: task_result until: task_result is success @@ -11,7 +14,9 @@ # If you are installing on Ubuntu 14.04 or 12.04, apparmor is required. - name: Docker | EE | Ubuntu | Install AppArmor Dependency - apt: name=apparmor state=present + ansible.builtin.apt: + name: apparmor + state: present when: ansible_distribution_version in "14.04" register: task_result until: task_result is success @@ -19,21 +24,21 @@ delay: 2 # Check and see if the GPG key already exists on the host -- name: Docker | CE | APT | Check GPG Key # noqa 305 - shell: gpg -k {{ docker_apt_key_id }} +- name: Docker | CE | APT | Check GPG Key + ansible.builtin.command: gpg -k {{ docker_apt_key_id }} failed_when: false changed_when: false register: docker_gpg_exists # If the GPG key doesn't exist, then add the new GPG key -- name: Docker | CE | APT | Add Docker GPG Key # noqa 303 306 - shell: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +- name: Docker | CE | APT | Add Docker GPG Key # noqa command-instead-of-module + ansible.builtin.command: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - failed_when: false changed_when: false when: docker_gpg_exists.rc != 0 # Docker’s APT repository contains Docker 1.7.1 and higher. - name: Docker | EE | APT | Configure Docker repository - apt_repository: - repo: "deb [arch=amd64] {{ docker_ee_url }} {{ ansible_distribution_release }} stable-{{ docker_ee_version }}" + ansible.builtin.apt_repository: + repo: deb [arch={{ docker_architecture }}] {{ docker_ee_url }} {{ ansible_distribution_release }} stable-{{ docker_ee_version }} state: present diff --git a/roles/docker/tasks/ee/yum.yml b/roles/docker/tasks/ee/yum.yml index 36a02e4..3b45e7d 100644 --- a/roles/docker/tasks/ee/yum.yml +++ b/roles/docker/tasks/ee/yum.yml @@ -1,41 +1,31 @@ --- +# code: language=ansible - name: Docker | EE | Store Docker EE repository URL - copy: + ansible.builtin.copy: content: "{{ docker_ee_url }}" dest: /etc/yum/vars/dockerurl + mode: "0644" - name: Docker | EE | YUM | Install yum-utils - yum: name=yum-utils + ansible.builtin.yum: + name: yum-utils register: task_result until: task_result is success retries: 10 delay: 2 -- name: Docker | EE | YUM | Deploy repository # noqa 305 - shell: "yum-config-manager --add-repo {{ docker_ee_url }}/docker-ee.repo" +- name: Docker | EE | YUM | Deploy repository + ansible.builtin.command: yum-config-manager --add-repo {{ docker_ee_url }}/docker-ee.repo args: creates: /etc/yum.repos.d/docker-ee.repo - name: Docker | EE | YUM | Perform specific os tasks - include: os/{{ ansible_distribution|lower }}.yml - -- name: Docker | EE | YUM | Remove older Docker installations - yum: name={{ item }} state=absent - with_items: - - docker - - docker-common - - docker-selinux - - container-selinux - - docker-engine-selinux - - docker-engine - - docker-ce - register: task_result - until: task_result is success - retries: 10 - delay: 2 + ansible.builtin.include_tasks: os/{{ ansible_distribution | lower }}.yml - name: Docker | EE | YUM | Install Docker Application - yum: name=docker-ee state=present + ansible.builtin.yum: + name: docker-ee + state: present notify: Docker | Restart Docker register: task_result until: task_result is success diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index d700127..6d4e8f6 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -1,64 +1,63 @@ --- +# code: language=ansible # tasks file for docker - name: Check ansible version when: - ansible_version.full is version('2.4', '<') - debug: + ansible.builtin.debug: msg: >- "This role works best with ansible version 2.4 or greater. It is recommended to use the latest ansible version for the best experience." - name: Docker | Manage OS not supported by docker-ce - fail: - msg: "This OS is not supported by Docker-CE, and therefor not supported by this role." - when: - - docker_edition == "ce" - - (ansible_distribution|lower == "centos" and ansible_distribution_major_version == "6") or - ansible_distribution|lower == "redhat" or - ansible_distribution|lower == "oraclelinux" + ansible.builtin.fail: + msg: This OS is not supported by Docker-CE, and therefor not supported by this role. + when: docker_edition == "ce" and + (ansible_distribution | lower == "centos" and ansible_distribution_major_version == "6") or + ansible_distribution | lower == "redhat" or + ansible_distribution | lower == "oraclelinux" -- name: Docker | Include {{ ansible_distribution }} specific variables - include_vars: "ansible_distribution/{{ ansible_distribution.split(' ', 1)[0]|lower }}.yml" +- name: Docker | Include distribution specific variables | {{ ansible_distribution }} + ansible.builtin.include_vars: ansible_distribution/{{ ansible_distribution.split(' ', 1)[0] | lower }}.yml -- name: Docker | Include {{ ansible_os_family }} Family specific variables - include_vars: "ansible_os_family/{{ ansible_os_family.split(' ', 1)[0]|lower }}.yml" +- name: Docker | Include OS Family specific variables | {{ ansible_os_family }} + ansible.builtin.include_vars: ansible_os_family/{{ ansible_os_family.split(' ', 1)[0] | lower }}.yml - name: Docker | EE | Check Requirements - fail: - msg: "Variable docker_ee_url is required and is not defined." + ansible.builtin.fail: + msg: Variable docker_ee_url is required and is not defined. when: - docker_ee_url is not defined - docker_edition == "ee" - name: Docker | Storage Driver - include_tasks: "storage_drivers/{{ docker_storage_driver }}.yml" + ansible.builtin.include_tasks: storage_drivers/{{ docker_storage_driver }}.yml when: docker_storage_driver is defined - name: Docker | Start Installation - include_tasks: "{{ docker_edition }}/{{ ansible_pkg_mgr }}.yml" + ansible.builtin.include_tasks: "{{ docker_edition }}/{{ ansible_pkg_mgr }}.yml" when: docker_repo == "docker" - name: Docker | Start Installation | Other repo - include_tasks: other_repo.yml + ansible.builtin.include_tasks: other_repo.yml when: docker_repo == "other" - name: Docker | Ensure service starts at boot - service: + ansible.builtin.service: name: docker enabled: "{{ docker_service_enabled }}" - name: Docker | Deploy Config - include_tasks: deploy_config.yml - + ansible.builtin.include_tasks: deploy_config.yml - name: Docker | Proxy configuration - include_tasks: proxy.yml - when: docker_http_proxy is defined or - docker_https_proxy is defined or - docker_no_proxy_params is defined + ansible.builtin.include_tasks: proxy.yml + when: docker_http_proxy is defined or docker_https_proxy is defined or docker_no_proxy_params is defined - name: Docker | Add users to docker group - include_tasks: docker_users.yml + ansible.builtin.include_tasks: docker_users.yml when: docker_users is defined - name: Docker | Ensure service started - service: name=docker state=started + ansible.builtin.service: + name: docker + state: started diff --git a/roles/docker/tasks/other_repo.yml b/roles/docker/tasks/other_repo.yml index 9d38ce3..c1aa3d5 100644 --- a/roles/docker/tasks/other_repo.yml +++ b/roles/docker/tasks/other_repo.yml @@ -1,7 +1,8 @@ --- +# code: language=ansible - name: Docker | Start Installation | Other repo - package: - name: "docker-{{ docker_edition }}" + ansible.builtin.package: + name: docker-{{ docker_edition }} when: - docker_repo == "other" register: task_result diff --git a/roles/docker/tasks/proxy.yml b/roles/docker/tasks/proxy.yml index f7b0df6..be3420a 100644 --- a/roles/docker/tasks/proxy.yml +++ b/roles/docker/tasks/proxy.yml @@ -1,9 +1,16 @@ --- +# code: language=ansible - name: Docker | Proxy | Create docker.service.d folder - file: path=/etc/systemd/system/docker.service.d state=directory mode=0755 + ansible.builtin.file: + path: /etc/systemd/system/docker.service.d + state: directory + mode: "0755" - name: Docker | Proxy | Docker service params - template: src=http-proxy.conf.j2 dest=/etc/systemd/system/docker.service.d/http-proxy.conf + ansible.builtin.template: + src: http-proxy.conf.j2 + dest: /etc/systemd/system/docker.service.d/http-proxy.conf + mode: "0644" notify: - Docker | Daemon-reload - Docker | Restart Docker diff --git a/roles/docker/tasks/storage_drivers/aufs.yml b/roles/docker/tasks/storage_drivers/aufs.yml index 305f011..a9ad4a6 100644 --- a/roles/docker/tasks/storage_drivers/aufs.yml +++ b/roles/docker/tasks/storage_drivers/aufs.yml @@ -1,6 +1,7 @@ --- +# code: language=ansible - name: Docker | Storage Driver | AUFS | Install dependencies for Ubuntu/Debian - apt: + ansible.builtin.apt: name: - linux-image-extra-{{ ansible_kernel }} - linux-image-extra-virtual @@ -14,6 +15,6 @@ delay: 2 - name: Docker | Storage Driver | AUFS | Enable AUFS driver - modprobe: + community.general.modprobe: name: aufs state: present diff --git a/roles/docker/tasks/storage_drivers/btrfs.yml b/roles/docker/tasks/storage_drivers/btrfs.yml index 6a5005a..35ea821 100644 --- a/roles/docker/tasks/storage_drivers/btrfs.yml +++ b/roles/docker/tasks/storage_drivers/btrfs.yml @@ -1,6 +1,9 @@ --- +# code: language=ansible - name: Docker | Storage Driver | Btrfs | Install Btrfs package - package: name={{ docker_btrfs_package }} state=present + ansible.builtin.package: + name: "{{ docker_btrfs_package }}" + state: present when: ansible_os_family == "Debian" register: task_result until: task_result is success @@ -8,25 +11,26 @@ delay: 2 - name: Docker | Storage Driver | Btrfs | Enable btrfs driver - modprobe: + community.general.modprobe: name: btrfs state: present - name: Docker | Storage Driver | Btrfs | Create Btfs storage filesystem - filesystem: + community.general.filesystem: dev: "{{ docker_block_device }}" fstype: btrfs - name: Docker | Storage Driver | Btrfs | Create the /var/lib/docker folder - file: + ansible.builtin.file: dest: /var/lib/docker state: directory + mode: "0755" - name: Docker | Storage Driver | Btrfs | Mount the filesystem - mount: - dest: /var/lib/docker + ansible.posix.mount: + path: /var/lib/docker src: "{{ docker_block_device }}" fstype: btrfs - passno: '0' + passno: "0" opts: "{{ docker_mount_opts | default(omit) }}" state: mounted diff --git a/roles/docker/tasks/storage_drivers/devicemapper.yml b/roles/docker/tasks/storage_drivers/devicemapper.yml index f1da84e..159c679 100644 --- a/roles/docker/tasks/storage_drivers/devicemapper.yml +++ b/roles/docker/tasks/storage_drivers/devicemapper.yml @@ -1,57 +1,64 @@ --- +# code: language=ansible - name: Docker | Storage Driver | devicemapper | Install LVM2 - package: name=lvm2 state=present + ansible.builtin.package: + name: lvm2 + state: present register: task_result until: task_result is success retries: 10 delay: 2 - name: Docker | Storage Driver | devicemapper | Configure logical volume group - lvg: + community.general.lvg: vg: docker pvs: "{{ docker_block_device }}" when: docker_block_device is defined - name: Docker | Storage Driver | devicemapper | Create thinpool volume - lvol: + community.general.lvol: vg: docker lv: thinpool size: 95%VG - opts: "--wipesignatures y" + opts: --wipesignatures y register: thinpool when: docker_block_device is defined - name: Docker | Storage Driver | devicemapper | Create thinpoolmeta volume - lvol: + community.general.lvol: vg: docker lv: thinpoolmeta size: 1%VG - opts: "--wipesignatures y" + opts: --wipesignatures y when: docker_block_device is defined -- name: Docker | Storage Driver | devicemapper | Convert volumes to thinpool # noqa 305 503 - shell: lvconvert -y --zero n -c 512K --thinpool docker/thinpool --poolmetadata docker/thinpoolmeta +- name: Docker | Storage Driver | devicemapper | Convert volumes to thinpool # noqa no-handler no-changed-when + ansible.builtin.command: lvconvert -y --zero n -c 512K --thinpool docker/thinpool --poolmetadata docker/thinpoolmeta when: thinpool.changed - name: Docker | Storage Driver | devicemapper | Configure autoextension of thin pools via 'lvm' profile - copy: + ansible.builtin.copy: src: docker-thinpool.profile dest: /etc/lvm/profile/docker-thinpool.profile + mode: "0644" register: docker_thinpool_profile notify: Docker | Restart Docker when: docker_block_device is defined -- name: Docker | Storage Driver | devicemapper | Apply 'lvm' profile # noqa 305 503 - shell: lvchange --metadataprofile docker-thinpool docker/thinpool +- name: Docker | Storage Driver | devicemapper | Apply 'lvm' profile # noqa no-handler no-changed-when + ansible.builtin.command: lvchange --metadataprofile docker-thinpool docker/thinpool when: docker_thinpool_profile.changed - name: Docker | Storage Driver | devicemapper | Make sure /var/lib/docker is Created - file: path=/var/lib/docker state=directory + ansible.builtin.file: + path: /var/lib/docker + state: directory + mode: "0755" - name: Docker | STorage Driver | devicemapper | Set the docker_storage_opts - set_fact: + ansible.builtin.set_fact: docker_storage_opts: - - "dm.thinpooldev=/dev/mapper/docker-thinpool" - - "dm.use_deferred_removal=true" - - "dm.use_deferred_deletion=true" + - dm.thinpooldev=/dev/mapper/docker-thinpool + - dm.use_deferred_removal=true + - dm.use_deferred_deletion=true when: docker_storage_opts is undefined diff --git a/roles/docker/tasks/storage_drivers/overlay.yml b/roles/docker/tasks/storage_drivers/overlay.yml index 91d1ac1..100173b 100644 --- a/roles/docker/tasks/storage_drivers/overlay.yml +++ b/roles/docker/tasks/storage_drivers/overlay.yml @@ -1,5 +1,6 @@ --- +# code: language=ansible - name: Docker | Storage Driver | overlay | Enable overlay driver - modprobe: + community.general.modprobe: name: overlay state: present diff --git a/roles/docker/tasks/storage_drivers/overlay2.yml b/roles/docker/tasks/storage_drivers/overlay2.yml index a53e62b..2d69bcf 100644 --- a/roles/docker/tasks/storage_drivers/overlay2.yml +++ b/roles/docker/tasks/storage_drivers/overlay2.yml @@ -1,17 +1,18 @@ --- +# code: language=ansible - name: Docker | Storage Driver | overlay2 | Check kernel version for 4.0.0 - assert: + ansible.builtin.assert: that: "{{ ansible_kernel is version('4.0.0', '>=') }}" - msg: "Please upgrade to kernel 4.0.0 or higher." + msg: Please upgrade to kernel 4.0.0 or higher. when: ansible_os_family|lower != "redhat" - name: Docker | Storage Driver | overlay2 | Check kernel version for 3.10.0-514 - assert: + ansible.builtin.assert: that: "{{ ansible_kernel is version('3.10.0-514', '>=') }}" - msg: "Please upgrade to kernel 3.10.0-514 or higher." + msg: Please upgrade to kernel 3.10.0-514 or higher. when: ansible_os_family|lower == "redhat" - name: Docker | Storage Driver | overlay2 | Enable overlay driver - modprobe: + community.general.modprobe: name: overlay state: present diff --git a/roles/docker/tasks/storage_drivers/zfs.yml b/roles/docker/tasks/storage_drivers/zfs.yml index 668ff97..9b4f5c8 100644 --- a/roles/docker/tasks/storage_drivers/zfs.yml +++ b/roles/docker/tasks/storage_drivers/zfs.yml @@ -1,2 +1,3 @@ --- +# code: language=ansible # Needs build from https://docs.docker.com/engine/userguide/storagedriver/zfs-driver/ diff --git a/roles/docker/vars/ansible_distribution/centos.yml b/roles/docker/vars/ansible_distribution/centos.yml index fe47536..78accfc 100644 --- a/roles/docker/vars/ansible_distribution/centos.yml +++ b/roles/docker/vars/ansible_distribution/centos.yml @@ -1,4 +1,5 @@ --- +# code: language=ansible # CentOS vars file for docker docker_ce_repo_url: https://download.docker.com/linux/centos diff --git a/roles/docker/vars/ansible_distribution/debian.yml b/roles/docker/vars/ansible_distribution/debian.yml index 9972201..026bf5a 100644 --- a/roles/docker/vars/ansible_distribution/debian.yml +++ b/roles/docker/vars/ansible_distribution/debian.yml @@ -1,9 +1,10 @@ --- +# code: language=ansible # Debian vars file for docker docker_ce_repo_url: https://download.docker.com/linux/debian docker_ce_gpg_key: "{{ docker_ce_repo_url }}/gpg" docker_ce_gpg_key_id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 docker_ce_gpg_key_validate_certs: true -docker_apt_repo_url: "deb [arch=amd64] {{ docker_ce_repo_url }} {{ ansible_distribution_release }} stable" -docker_apt_repo_url_edge: "deb [arch=amd64] {{ docker_ce_repo_url }} {{ ansible_distribution_release }} edge" +docker_apt_repo_url: deb [arch={{ docker_architecture }}] {{ docker_ce_repo_url }} {{ ansible_distribution_release }} stable +docker_apt_repo_url_edge: deb [arch={{ docker_architecture }}] {{ docker_ce_repo_url }} {{ ansible_distribution_release }} edge diff --git a/roles/docker/vars/ansible_distribution/fedora.yml b/roles/docker/vars/ansible_distribution/fedora.yml index c9fc63b..ba5fad4 100644 --- a/roles/docker/vars/ansible_distribution/fedora.yml +++ b/roles/docker/vars/ansible_distribution/fedora.yml @@ -1,4 +1,5 @@ --- +# code: language=ansible # Fedora vars file for docker docker_ce_repo_url: https://download.docker.com/linux/fedora diff --git a/roles/docker/vars/ansible_distribution/main.yml b/roles/docker/vars/ansible_distribution/main.yml deleted file mode 100644 index 3806b4c..0000000 --- a/roles/docker/vars/ansible_distribution/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for docker diff --git a/roles/docker/vars/ansible_distribution/opensuse.yml b/roles/docker/vars/ansible_distribution/opensuse.yml index fe26b18..cb44736 100644 --- a/roles/docker/vars/ansible_distribution/opensuse.yml +++ b/roles/docker/vars/ansible_distribution/opensuse.yml @@ -1,4 +1,5 @@ --- +# code: language=ansible # OpenSUSE vars file for docker docker_ce_repo_url: https://download.docker.com/linux/opensuse diff --git a/roles/docker/vars/ansible_distribution/oraclelinux.yml b/roles/docker/vars/ansible_distribution/oraclelinux.yml index 4e55b00..99a6ed4 100644 --- a/roles/docker/vars/ansible_distribution/oraclelinux.yml +++ b/roles/docker/vars/ansible_distribution/oraclelinux.yml @@ -1,4 +1,5 @@ --- +# code: language=ansible # OracleLinux vars file for docker -docker_package_directory: "oraclelinux" +docker_package_directory: oraclelinux diff --git a/roles/docker/vars/ansible_distribution/redhat.yml b/roles/docker/vars/ansible_distribution/redhat.yml index 48c797c..b1d5fff 100644 --- a/roles/docker/vars/ansible_distribution/redhat.yml +++ b/roles/docker/vars/ansible_distribution/redhat.yml @@ -1,4 +1,5 @@ --- +# code: language=ansible # RedHat vars file for docker docker_ce_repo_url: https://download.docker.com/linux/centos diff --git a/roles/docker/vars/ansible_distribution/ubuntu.yml b/roles/docker/vars/ansible_distribution/ubuntu.yml index 1cb31db..604d4bb 100644 --- a/roles/docker/vars/ansible_distribution/ubuntu.yml +++ b/roles/docker/vars/ansible_distribution/ubuntu.yml @@ -1,9 +1,10 @@ --- +# code: language=ansible # Ubuntu vars file for docker docker_ce_repo_url: https://download.docker.com/linux/ubuntu docker_ce_gpg_key: "{{ docker_ce_repo_url }}/gpg" docker_ce_gpg_key_id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 docker_ce_gpg_key_validate_certs: true -docker_apt_repo_url: "deb [arch=amd64] {{ docker_ce_repo_url }} {{ ansible_distribution_release }} stable" -docker_apt_repo_url_edge: "deb [arch=amd64] {{ docker_ce_repo_url }} {{ ansible_distribution_release }} edge" +docker_apt_repo_url: deb [arch={{ docker_architecture }}] {{ docker_ce_repo_url }} {{ ansible_distribution_release }} stable +docker_apt_repo_url_edge: deb [arch={{ docker_architecture }}] {{ docker_ce_repo_url }} {{ ansible_distribution_release }} edge diff --git a/roles/docker/vars/ansible_os_family/debian.yml b/roles/docker/vars/ansible_os_family/debian.yml index cccb4e0..700f21d 100644 --- a/roles/docker/vars/ansible_os_family/debian.yml +++ b/roles/docker/vars/ansible_os_family/debian.yml @@ -1,2 +1,3 @@ --- +# code: language=ansible docker_btrfs_package: btrfs-tools diff --git a/roles/docker/vars/ansible_os_family/redhat.yml b/roles/docker/vars/ansible_os_family/redhat.yml index 3caddfe..560399a 100644 --- a/roles/docker/vars/ansible_os_family/redhat.yml +++ b/roles/docker/vars/ansible_os_family/redhat.yml @@ -1,2 +1,3 @@ --- +# code: language=ansible docker_btrfs_package: btrfs-progs diff --git a/roles/docker/vars/ansible_os_family/suse.yml b/roles/docker/vars/ansible_os_family/suse.yml index 3caddfe..560399a 100644 --- a/roles/docker/vars/ansible_os_family/suse.yml +++ b/roles/docker/vars/ansible_os_family/suse.yml @@ -1,2 +1,3 @@ --- +# code: language=ansible docker_btrfs_package: btrfs-progs diff --git a/roles/docker/vars/main.yml b/roles/docker/vars/main.yml new file mode 100644 index 0000000..4baab3e --- /dev/null +++ b/roles/docker/vars/main.yml @@ -0,0 +1,11 @@ +--- +# code: language=ansible + +docker_architecture_mapping: + x86_64: amd64 + ppc64le: ppc64el + s390x: s390x + armv7l: armhf + aarch64: arm64 + +docker_architecture: "{{ docker_architecture_mapping[ansible_architecture] }}"