mirror of
https://github.com/geerlingguy/ansible-role-docker.git
synced 2025-08-06 13:47:47 +02:00
Update role to allow docker volumes creation
This commit is contained in:
parent
dc1c9a1606
commit
4e899dac5d
@ -1,5 +1,7 @@
|
|||||||
# Ansible Role: Docker
|
# Ansible Role: Docker
|
||||||
|
|
||||||
|
Forked by Catalina Sindrilaru (Eau de Web) to allow the creation of volumes using the docker_volumes variable (see defaults/main.yml for an example).
|
||||||
|
|
||||||
[](https://github.com/geerlingguy/ansible-role-docker/actions?query=workflow%3ACI)
|
[](https://github.com/geerlingguy/ansible-role-docker/actions?query=workflow%3ACI)
|
||||||
|
|
||||||
An Ansible Role that installs [Docker](https://www.docker.com) on Linux.
|
An Ansible Role that installs [Docker](https://www.docker.com) on Linux.
|
||||||
|
@ -56,3 +56,16 @@ docker_users: []
|
|||||||
|
|
||||||
# Docker daemon options as a dict
|
# Docker daemon options as a dict
|
||||||
docker_daemon_options: {}
|
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
tasks/docker-volumes.yml
Normal file
9
tasks/docker-volumes.yml
Normal file
@ -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 }}"
|
@ -96,3 +96,6 @@
|
|||||||
|
|
||||||
- include_tasks: docker-users.yml
|
- include_tasks: docker-users.yml
|
||||||
when: at_least_one_user_to_modify is defined
|
when: at_least_one_user_to_modify is defined
|
||||||
|
|
||||||
|
- include_tasks: docker-volumes.yml
|
||||||
|
when: docker_volumes | length > 0
|
Loading…
Reference in New Issue
Block a user