summaryrefslogtreecommitdiff
path: root/docs/proposals/docker/docker_files_module.md
blob: 4a9d5e47a81193ac2f6ee593c3a0632f621d02fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Docker_Volume Modules Proposal

## Purpose and Scope

The purpose of docker_volume is to manage volumes.
 
Docker_volume will manage volumes using docker-py to communicate with either a local or remote API. It will
support API versions >= 1.14. API connection details will be handled externally in a shared utility module similar 
to how other cloud modules operate.
 
## Parameters

Docker_volume accepts the parameters listed below. Parameters for connecting to the API are not listed here, as they
will be part of the shared module mentioned above.

```
driver:
  description:
    - Volume driver.
  default: local
  
force:
  description:
    - Use with state 'present' to force removal and re-creation of an existing volume. This will not remove and
      re-create the volume if it is already in use.

name:
  description:
    - Name of the volume.
  required: true
  default: null

options:
  description:
    - Dictionary of driver specific options. The local driver does not currently support
      any options.
  default: null

state:
  description:
    - "absent" removes a volume. A volume cannot be removed if it is in use.
    - "present" create a volume with the specified name, if the volume does not already exist. Use the force
      option to remove and re-create a volume. Even with the force option a volume cannot be removed and re-created if
      it is in use.
  default: present
  choices:
    - absent
    - present  
```

## Examples

```
- name: Create a volume
  docker_volume:
    name: data

- name: Remove a volume
  docker_volume:
    name: data
    state: absent

- name: Re-create an existing volume
  docker_volume:
    name: data
    state: present
    force: yes
```

## Returns

```
{
    changed: true,
    failed: false,
    rc: 0,
    action: removed | created | none
    results: {
        < show the result of docker inspect of an affected volume >
    }
}
```