Skip to content

Commit 2014a18

Browse files
committed
chore: Remove Travis build status from README
Signed-off-by: Manuel Hutter <[email protected]>
1 parent c032511 commit 2014a18

File tree

1 file changed

+38
-45
lines changed

1 file changed

+38
-45
lines changed

README.md

Lines changed: 38 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# Docker role `mhutter.docker-systemd-service`
2-
[![Build Status](https://travis-ci.com/mhutter/ansible-docker-systemd-service.svg?branch=master)](https://travis-ci.com/mhutter/ansible-docker-systemd-service)
32

43
Generic role for creating systemd services to manage docker containers.
54

6-
75
## Example
86

97
Example of a Systemd unit for your app "myapp" that links to an already existing container "mysql":
@@ -15,65 +13,61 @@ Example of a Systemd unit for your app "myapp" that links to an already existing
1513
vars:
1614
container_name: myapp
1715
container_image: myapp:latest
18-
container_links: [ 'mysql' ]
16+
container_links: ["mysql"]
1917
container_volumes:
20-
- '/data/uploads:/data/uploads'
18+
- "/data/uploads:/data/uploads"
2119
container_ports:
22-
- '3000:3000'
20+
- "3000:3000"
2321
container_hosts:
24-
- 'host.docker.internal:host-gateway'
22+
- "host.docker.internal:host-gateway"
2523
container_env:
2624
MYSQL_ROOT_PASSWORD: "{{ mysql_root_pw }}"
2725
container_labels:
28-
- 'traefik.enable=true'
26+
- "traefik.enable=true"
2927
```
3028
3129
This will create:
3230
33-
* A file containing the env vars (either `/etc/sysconfig/myapp` or `/etc/default/myapp`).
34-
* A systemd unit which starts and stops the container. The unit will be called `<name>_container.service` to avoid name clashes.
35-
31+
- A file containing the env vars (either `/etc/sysconfig/myapp` or `/etc/default/myapp`).
32+
- A systemd unit which starts and stops the container. The unit will be called `<name>_container.service` to avoid name clashes.
3633

3734
### Role variables
3835

39-
* `container_name` (**required**) - name of the container
40-
36+
- `container_name` (**required**) - name of the container
4137

4238
#### Docker container specifics
4339

44-
* `container_image` (**required**) - Docker image the service uses
45-
* `container_args` - arbitrary list of arguments to the `docker run` command as a string
46-
* `container_cmd` (default: _[]_) - optional list of commands to the container run command (the part after the image name)
47-
* `container_env` - key/value pairs of ENV vars that need to be present
48-
* `container_volumes` (default: _[]_) - List of `-v` arguments
49-
* `container_host_network` (default: _false_) - Whether the host network should be used
50-
* `container_ports` (default: _[]_) - List of `-p` arguments
51-
* `container_hosts` (default: _[]_) - List of `--add-host` arguments
52-
* `container_links` (default: _[]_) - List of `--link` arguments
53-
* `container_labels` (default: _[]_) - List of `-l` arguments
54-
* `container_docker_pull` (default: _yes_) - whether the docker image should be pulled
55-
* `container_docker_pull_force_source` (default: _yes_) - whether the docker image pull should be executed at every time (see [`docker_image.force_source`](https://docs.ansible.com/ansible/latest/collections/community/docker/docker_image_module.html#parameter-force_source))
56-
* `container_cap_add` (default _[]_) - List of capabilities to add
57-
* `container_cap_drop` (default _{}_) - List of capabilities to drop
58-
* `container_network` (default _""_) - [Network settings](https://docs.docker.com/engine/reference/run/#network-settings)
59-
* `container_user` (default _""_) - [User settings](https://docs.docker.com/engine/reference/run/#user)
60-
* `container_hostname` (default _""_) - Container host name: `--hostname` flag
61-
* `container_devices` (default _[]_) - List of devices to add
62-
* `container_privileged` (default _false_) - Whether the container should be privileged
63-
* `container_start_post` - Optional command to be run by systemd after the container has started
64-
40+
- `container_image` (**required**) - Docker image the service uses
41+
- `container_args` - arbitrary list of arguments to the `docker run` command as a string
42+
- `container_cmd` (default: _[]_) - optional list of commands to the container run command (the part after the image name)
43+
- `container_env` - key/value pairs of ENV vars that need to be present
44+
- `container_volumes` (default: _[]_) - List of `-v` arguments
45+
- `container_host_network` (default: _false_) - Whether the host network should be used
46+
- `container_ports` (default: _[]_) - List of `-p` arguments
47+
- `container_hosts` (default: _[]_) - List of `--add-host` arguments
48+
- `container_links` (default: _[]_) - List of `--link` arguments
49+
- `container_labels` (default: _[]_) - List of `-l` arguments
50+
- `container_docker_pull` (default: _yes_) - whether the docker image should be pulled
51+
- `container_docker_pull_force_source` (default: _yes_) - whether the docker image pull should be executed at every time (see [`docker_image.force_source`](https://docs.ansible.com/ansible/latest/collections/community/docker/docker_image_module.html#parameter-force_source))
52+
- `container_cap_add` (default _[]_) - List of capabilities to add
53+
- `container_cap_drop` (default _{}_) - List of capabilities to drop
54+
- `container_network` (default _""_) - [Network settings](https://docs.docker.com/engine/reference/run/#network-settings)
55+
- `container_user` (default _""_) - [User settings](https://docs.docker.com/engine/reference/run/#user)
56+
- `container_hostname` (default _""_) - Container host name: `--hostname` flag
57+
- `container_devices` (default _[]_) - List of devices to add
58+
- `container_privileged` (default _false_) - Whether the container should be privileged
59+
- `container_start_post` - Optional command to be run by systemd after the container has started
6560

6661
#### Systemd service specifics
6762

68-
* `service_enabled` (default: _yes_) - whether the service should be enabled
69-
* `service_masked` (default: _no_) - whether the service should be masked
70-
* `service_state` (default: _started_) - state the service should be in - set to
63+
- `service_enabled` (default: _yes_) - whether the service should be enabled
64+
- `service_masked` (default: _no_) - whether the service should be masked
65+
- `service_state` (default: _started_) - state the service should be in - set to
7166
`absent` to remove the service.
72-
* `service_restart` (default: _yes_) - whether the service should be restarted on changes
73-
* `service_name` (default: `<container_name>_container`) - name of the systemd service
74-
* `service_systemd_options` (default: _[]_) - Extra options to include in systemd service file
75-
* `service_systemd_unit_options`: (default `{"After": "docker.service", "PartOf": "docker.service", "Requires": "docker.service"}`), key/value defining the content of the `[Unit]` service section.
76-
67+
- `service_restart` (default: _yes_) - whether the service should be restarted on changes
68+
- `service_name` (default: `<container_name>_container`) - name of the systemd service
69+
- `service_systemd_options` (default: _[]_) - Extra options to include in systemd service file
70+
- `service_systemd_unit_options`: (default `{"After": "docker.service", "PartOf": "docker.service", "Requires": "docker.service"}`), key/value defining the content of the `[Unit]` service section.
7771

7872
## Installation
7973

@@ -87,16 +81,15 @@ Put this in your `requirements.yml`:
8781

8882
and run `ansible-galaxy install -r requirements.yml`.
8983

90-
9184
## Gotchas
9285

93-
* When the unit or env file is changed, systemd gets reloaded but existing containers are NOT restarted.
94-
* Make sure to quote values for `container_ports`, `container_hosts`, `container_volumes` and so on, especially if they contain colons (`:`). Otherwise YAML will interpret them as hashes/maps and ansible will throw up.
95-
86+
- When the unit or env file is changed, systemd gets reloaded but existing containers are NOT restarted.
87+
- Make sure to quote values for `container_ports`, `container_hosts`, `container_volumes` and so on, especially if they contain colons (`:`). Otherwise YAML will interpret them as hashes/maps and ansible will throw up.
9688

9789
## About orchestrating Docker containers using systemd.
9890

9991
The concept behind this is to define `systemd` units for every docker container. This has some benefits:
92+
10093
- `systemd` is a well-known interface
10194
- all services are controllable via the same tool (`systemctl`)
10295
- all logs are accessible via the same tool (`journalctl`)

0 commit comments

Comments
 (0)