Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add suport to create volumes #449

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# and is only necessary until Docker officially supports them.
docker_apt_ansible_distribution: "{{ 'ubuntu' if ansible_distribution in ['Pop!_OS', 'Linux Mint'] else ansible_distribution }}"
docker_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
docker_apt_repository: "deb [arch={{ docker_apt_arch }} signed-by=/etc/apt/trusted.gpg.d/docker.asc] {{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}"

Check warning on line 42 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint

42:201 [line-length] line too long (237 > 200 characters)
docker_apt_ignore_key_error: true
docker_apt_gpg_key: "{{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }}/gpg"
docker_apt_gpg_key_checksum: "sha256:1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570"
Expand All @@ -56,3 +56,16 @@

# Docker daemon options as a dict
docker_daemon_options: {}

# A list of docker volumes that will be created
docker_volumes: []

# Example:

# ---
# docker_volumes:
# - name: data
# driver_options:
# type: nfs
# o: addr=10.0.2.2,rw,nfsvers=4
# device: ":/data/"
9 changes: 9 additions & 0 deletions tasks/docker-volumes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Create volumes with options
docker_volume:
name: "{{ item.name }}"
driver_options:
type: "{{ item.driver_options.type }}"
o: "{{ item.driver_options.o | default(omit) }}"
device: "{{ item.driver_options.device }}"
with_items: "{{ docker_volumes }}"
3 changes: 3 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,6 @@

- include_tasks: docker-users.yml
when: at_least_one_user_to_modify is defined

- include_tasks: docker-volumes.yml
when: docker_volumes | length > 0