feat(tests): add testing for the default values on both docker and vagrant
All checks were successful
test / Linting (push) Successful in 34s
All checks were successful
test / Linting (push) Successful in 34s
This commit is contained in:
parent
d15bce04de
commit
f813944d74
@ -6,24 +6,7 @@ docker_systemd_service_container_env: {}
|
|||||||
docker_systemd_service_container_pull_image: true
|
docker_systemd_service_container_pull_image: true
|
||||||
docker_systemd_service_container_pull_force_source: true
|
docker_systemd_service_container_pull_force_source: true
|
||||||
docker_systemd_service_flags: []
|
docker_systemd_service_flags: []
|
||||||
#! TO REPLACE
|
|
||||||
docker_systemd_service_container_labels: []
|
|
||||||
docker_systemd_service_container_cmd: []
|
docker_systemd_service_container_cmd: []
|
||||||
docker_systemd_service_container_host_network: false
|
|
||||||
docker_systemd_service_container_network: ""
|
|
||||||
docker_systemd_service_container_user: ""
|
|
||||||
docker_systemd_service_container_hostname: ""
|
|
||||||
docker_systemd_service_container_links: []
|
|
||||||
docker_systemd_service_container_ports: []
|
|
||||||
docker_systemd_service_container_hosts: []
|
|
||||||
docker_systemd_service_container_volumes: []
|
|
||||||
docker_systemd_service_container_cap_add: []
|
|
||||||
docker_systemd_service_container_cap_drop: []
|
|
||||||
docker_systemd_service_container_devices: []
|
|
||||||
docker_systemd_service_container_privileged: false
|
|
||||||
docker_systemd_service_container_args: ""
|
|
||||||
#! END TO REPLACE
|
|
||||||
|
|
||||||
docker_systemd_service_name: "{{ docker_systemd_service_container_name }}_container"
|
docker_systemd_service_name: "{{ docker_systemd_service_container_name }}_container"
|
||||||
docker_systemd_service_systemd_options: []
|
docker_systemd_service_systemd_options: []
|
||||||
docker_systemd_service_enabled: true
|
docker_systemd_service_enabled: true
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
|
|
||||||
def create_docker_flags(flags):
|
def create_docker_flags(flags):
|
||||||
return "\n".join([create_docker_flag(item) for item in flags])
|
if flags:
|
||||||
|
return "\n".join([create_docker_flag(item) for item in flags])
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def create_docker_flag(item):
|
def create_docker_flag(item):
|
||||||
|
@ -1,24 +1,11 @@
|
|||||||
---
|
---
|
||||||
docker_systemd_service_container_name: "nginx"
|
docker_systemd_service_container_name: "nginx"
|
||||||
docker_systemd_service_image: "nginx"
|
docker_systemd_service_image: nginx
|
||||||
docker_systemd_service_container_env: {}
|
docker_systemd_service_container_env: {}
|
||||||
docker_systemd_service_container_pull_image: false
|
docker_systemd_service_container_pull_image: false
|
||||||
docker_systemd_service_container_pull_force_source: false
|
docker_systemd_service_container_pull_force_source: false
|
||||||
docker_systemd_service_container_labels: []
|
docker_systemd_service_flags: []
|
||||||
docker_systemd_service_container_cmd: []
|
docker_systemd_service_container_cmd: []
|
||||||
docker_systemd_service_container_host_network: false
|
|
||||||
docker_systemd_service_container_network: ""
|
|
||||||
docker_systemd_service_container_user: ""
|
|
||||||
docker_systemd_service_container_hostname: ""
|
|
||||||
docker_systemd_service_container_links: []
|
|
||||||
docker_systemd_service_container_ports: []
|
|
||||||
docker_systemd_service_container_hosts: []
|
|
||||||
docker_systemd_service_container_volumes: []
|
|
||||||
docker_systemd_service_container_cap_add: []
|
|
||||||
docker_systemd_service_container_cap_drop: []
|
|
||||||
docker_systemd_service_container_devices: []
|
|
||||||
docker_systemd_service_container_privileged: false
|
|
||||||
docker_systemd_service_container_args: ""
|
|
||||||
docker_systemd_service_name: "{{ docker_systemd_service_container_name }}_container"
|
docker_systemd_service_name: "{{ docker_systemd_service_container_name }}_container"
|
||||||
docker_systemd_service_systemd_options: []
|
docker_systemd_service_systemd_options: []
|
||||||
docker_systemd_service_enabled: true
|
docker_systemd_service_enabled: true
|
||||||
|
@ -53,20 +53,9 @@
|
|||||||
[Service]
|
[Service]
|
||||||
EnvironmentFile=/etc/default/nginx
|
EnvironmentFile=/etc/default/nginx
|
||||||
ExecStartPre=-/usr/bin/docker rm -f nginx
|
ExecStartPre=-/usr/bin/docker rm -f nginx
|
||||||
ExecStart=/usr/bin/docker run --name nginx --rm --env-file /etc/default/nginx \
|
ExecStart=/usr/bin/docker run --name nginx \
|
||||||
\
|
--rm \
|
||||||
\
|
--env-file /etc/default/nginx \
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
nginx
|
nginx
|
||||||
ExecStop=/usr/bin/docker stop nginx
|
ExecStop=/usr/bin/docker stop nginx
|
||||||
SyslogIdentifier=nginx
|
SyslogIdentifier=nginx
|
||||||
|
@ -1,35 +1,11 @@
|
|||||||
---
|
---
|
||||||
docker_systemd_service_container_name: "ninx"
|
docker_systemd_service_container_name: "nginx"
|
||||||
docker_systemd_service_image: nginx
|
docker_systemd_service_image: nginx
|
||||||
docker_systemd_service_container_env: {}
|
docker_systemd_service_container_env: {}
|
||||||
docker_systemd_service_container_pull_image: true
|
docker_systemd_service_container_pull_image: true
|
||||||
docker_systemd_service_container_pull_force_source: false
|
docker_systemd_service_container_pull_force_source: true
|
||||||
docker_systemd_service_flags:
|
docker_systemd_service_flags: []
|
||||||
- health-cmd: curl localhost:80
|
|
||||||
- health-retries: 10
|
|
||||||
- privileged
|
|
||||||
- network: host
|
|
||||||
- volume:
|
|
||||||
- /root:/mnt/volume
|
|
||||||
- /var:/test:ro
|
|
||||||
|
|
||||||
docker_systemd_service_container_cmd: []
|
docker_systemd_service_container_cmd: []
|
||||||
#! TO REPLACE
|
|
||||||
docker_systemd_service_container_labels: []
|
|
||||||
docker_systemd_service_container_host_network: false
|
|
||||||
docker_systemd_service_container_network: ""
|
|
||||||
docker_systemd_service_container_user: ""
|
|
||||||
docker_systemd_service_container_hostname: ""
|
|
||||||
docker_systemd_service_container_links: []
|
|
||||||
docker_systemd_service_container_ports: []
|
|
||||||
docker_systemd_service_container_hosts: []
|
|
||||||
docker_systemd_service_container_volumes: []
|
|
||||||
docker_systemd_service_container_cap_add: []
|
|
||||||
docker_systemd_service_container_cap_drop: []
|
|
||||||
docker_systemd_service_container_devices: []
|
|
||||||
docker_systemd_service_container_privileged: false
|
|
||||||
docker_systemd_service_container_args: ""
|
|
||||||
#! END TO REPLACE
|
|
||||||
docker_systemd_service_name: "{{ docker_systemd_service_container_name }}_container"
|
docker_systemd_service_name: "{{ docker_systemd_service_container_name }}_container"
|
||||||
docker_systemd_service_systemd_options: []
|
docker_systemd_service_systemd_options: []
|
||||||
docker_systemd_service_enabled: true
|
docker_systemd_service_enabled: true
|
||||||
|
@ -53,20 +53,9 @@
|
|||||||
[Service]
|
[Service]
|
||||||
EnvironmentFile=/etc/default/nginx
|
EnvironmentFile=/etc/default/nginx
|
||||||
ExecStartPre=-/usr/bin/docker rm -f nginx
|
ExecStartPre=-/usr/bin/docker rm -f nginx
|
||||||
ExecStart=/usr/bin/docker run --name nginx --rm --env-file /etc/default/nginx \
|
ExecStart=/usr/bin/docker run --name nginx \
|
||||||
\
|
--rm \
|
||||||
\
|
--env-file /etc/default/nginx \
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
nginx
|
nginx
|
||||||
ExecStop=/usr/bin/docker stop nginx
|
ExecStop=/usr/bin/docker stop nginx
|
||||||
SyslogIdentifier=nginx
|
SyslogIdentifier=nginx
|
||||||
|
@ -16,11 +16,12 @@ EnvironmentFile={{ docker_systemd_service_sysconf_dir }}/{{ docker_systemd_servi
|
|||||||
ExecStartPre=-{{ docker_systemd_service_docker_path }} rm -f {{ docker_systemd_service_container_name }}
|
ExecStartPre=-{{ docker_systemd_service_docker_path }} rm -f {{ docker_systemd_service_container_name }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not 'ExecStart' in service_systemd_options_keys %}
|
{% if not 'ExecStart' in service_systemd_options_keys %}
|
||||||
|
{% set docker_flags = docker_systemd_service_flags | create_docker_flags %}
|
||||||
ExecStart={{ docker_systemd_service_docker_path }} run --name {{ docker_systemd_service_container_name }} \
|
ExecStart={{ docker_systemd_service_docker_path }} run --name {{ docker_systemd_service_container_name }} \
|
||||||
--rm \
|
--rm \
|
||||||
--env-file {{ docker_systemd_service_sysconf_dir }}/{{ docker_systemd_service_container_name }} \
|
--env-file {{ docker_systemd_service_sysconf_dir }}/{{ docker_systemd_service_container_name }} \
|
||||||
{{ docker_systemd_service_flags|create_docker_flags }}
|
{{ docker_flags -}}{% if docker_flags +%}
|
||||||
{{ docker_systemd_service_image -}}{{ ' ' if docker_systemd_service_container_cmd else '' }}{% if docker_systemd_service_container_cmd is string %}{{ docker_systemd_service_container_cmd | trim }}{% else %}{{ docker_systemd_service_container_cmd | join(' ') | trim }}{% endif %}
|
{% endif %}{{ docker_systemd_service_image -}}{{ ' ' if docker_systemd_service_container_cmd else '' }}{% if docker_systemd_service_container_cmd is string %}{{ docker_systemd_service_container_cmd | trim }}{% else %}{{ docker_systemd_service_container_cmd | join(' ') | trim }}{% endif %}
|
||||||
{% endif +%}
|
{% endif +%}
|
||||||
{% if not 'ExecStop' in service_systemd_options_keys %}
|
{% if not 'ExecStop' in service_systemd_options_keys %}
|
||||||
ExecStop={{ docker_systemd_service_docker_path }} stop {{ docker_systemd_service_container_name }}
|
ExecStop={{ docker_systemd_service_docker_path }} stop {{ docker_systemd_service_container_name }}
|
||||||
|
Loading…
Reference in New Issue
Block a user