Skip to content

Commit

Permalink
add ability to set security options in the readme (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
thelamer authored Sep 21, 2021
1 parent 9e28b15 commit 85b3178
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 1 deletion.
4 changes: 4 additions & 0 deletions roles/generate-jenkins/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ cap_add_param: false
cap_add_param_vars: []
opt_cap_add_param: false
opt_cap_add_param_vars: []
security_opt_param: false
security_opt_param_vars: []
opt_security_opt_param: false
opt_security_opt_param_vars: []
param_usage_include_hostname: false
param_hostname: ""
param_usage_include_env: false
Expand Down
35 changes: 34 additions & 1 deletion roles/generate-jenkins/templates/DOCUMENTATION.j2
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,19 @@ services:
- {{ item.cap_add_var }} #optional
{% endfor %}
{% endif %}
{% if security_opt_param or opt_security_opt_param %}
security_opt:
{% endif %}
{% if security_opt_param %}
{% for item in security_opt_param_vars %}
- {{ item.compose_var }}
{% endfor %}
{% endif %}
{% if opt_security_opt_param %}
{% for item in opt_security_opt_param_vars %}
- {{ item.compose_var }} #optional
{% endfor %}
{% endif %}
{% if param_usage_include_net is sameas true %}
network_mode: {{ param_net }}
{% elif param_usage_include_net == 'optional' %}
Expand Down Expand Up @@ -226,6 +239,16 @@ docker run -d \
--cap-add={{ item.cap_add_var }} `#optional` \
{% endfor %}
{% endif %}
{% if security_opt_param %}
{% for item in security_opt_param_vars %}
--security-opt={{ item.run_var }} \
{% endfor %}
{% endif %}
{% if opt_security_opt_param %}
{% for item in opt_security_opt_param_vars %}
--security-opt {{ item.run_var }} `#optional` \
{% endfor %}
{% endif %}
{% if common_param_env_vars_enabled is sameas true %}
{% for item in common_param_env_vars %}
-e {{ item.env_var }}={{ item.env_value }} \
Expand Down Expand Up @@ -384,7 +407,7 @@ Docker images are configured using parameters passed at runtime (such as those a
{% endfor %}
{% endif %}
{% endif %}
{% if custom_params is defined or opt_custom_params is defined or param_usage_include_hostname %}
{% if custom_params is defined or opt_custom_params is defined or param_usage_include_hostname or security_opt_param is defined or opt_security_opt_param is defined %}

#### Miscellaneous Options

Expand All @@ -403,6 +426,16 @@ Docker images are configured using parameters passed at runtime (such as those a
| `--{{ item.name }}=` | {{ item.desc }} |
{% endfor %}
{% endif %}
{% if security_opt_param %}
{% for item in security_opt_param_vars %}
| `--security-opt {{ item.run_security_opt_var }}` | {{ item.desc }} |
{% endfor %}
{% endif %}
{% if opt_security_opt_param %}
{% for item in opt_security_opt_param_vars %}
| `--security-opt {{ item.run_var }}` | {{ item.desc }} |
{% endfor %}
{% endif %}
{% endif %}

## Environment variables from files (Docker secrets)
Expand Down
33 changes: 33 additions & 0 deletions roles/generate-jenkins/templates/README.j2
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,19 @@ services:
- {{ item.cap_add_var }} #optional
{% endfor %}
{% endif %}
{% if security_opt_param or opt_security_opt_param %}
security_opt:
{% endif %}
{% if security_opt_param %}
{% for item in security_opt_param_vars %}
- {{ item.compose_var }}
{% endfor %}
{% endif %}
{% if opt_security_opt_param %}
{% for item in opt_security_opt_param_vars %}
- {{ item.compose_var }} #optional
{% endfor %}
{% endif %}
{% if param_usage_include_net is sameas true %}
network_mode: {{ param_net }}
{% elif param_usage_include_net == 'optional' %}
Expand Down Expand Up @@ -250,6 +263,16 @@ docker run -d \
--cap-add={{ item.cap_add_var }} `#optional` \
{% endfor %}
{% endif %}
{% if security_opt_param %}
{% for item in security_opt_param_vars %}
--security-opt={{ item.run_var }} \
{% endfor %}
{% endif %}
{% if opt_security_opt_param %}
{% for item in opt_security_opt_param_vars %}
--security-opt {{ item.run_var }} `#optional` \
{% endfor %}
{% endif %}
{% if common_param_env_vars_enabled is sameas true %}
{% for item in common_param_env_vars %}
-e {{ item.env_var }}={{ item.env_value }} \
Expand Down Expand Up @@ -397,6 +420,16 @@ Container images are configured using parameters passed at runtime (such as thos
| `--{{ item.name }}=` | {{ item.desc }} |
{% endfor %}
{% endif %}
{% if security_opt_param %}
{% for item in security_opt_param_vars %}
| `--security-opt {{ item.run_security_opt_var }}` | {{ item.desc }} |
{% endfor %}
{% endif %}
{% if opt_security_opt_param %}
{% for item in opt_security_opt_param_vars %}
| `--security-opt {{ item.run_var }}` | {{ item.desc }} |
{% endfor %}
{% endif %}

## Environment variables from files (Docker secrets)

Expand Down
10 changes: 10 additions & 0 deletions roles/generate-jenkins/templates/lite.j2
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ docker run -d \
--cap-add={{ item.cap_add_var }} `#optional` \
{% endfor %}
{% endif %}
{% if security_opt_param %}
{% for item in security_opt_param_vars %}
--security-opt={{ item.run_var }} \
{% endfor %}
{% endif %}
{% if opt_security_opt_param %}
{% for item in opt_security_opt_param_vars %}
--security-opt {{ item.run_var }} `#optional` \
{% endfor %}
{% endif %}
{% if common_param_env_vars_enabled is sameas true %}
{% for item in common_param_env_vars %}
-e {{ item.env_var }}={{ item.env_value }} \
Expand Down
6 changes: 6 additions & 0 deletions vars/_container-vars-blank
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ param_devices:
cap_add_param: false
cap_add_param_vars:
- { cap_add_var: "NET_ADMIN" }
security_opt_param: false
security_opt_param_vars:
- { run_var: "seccomp=unconfined", compose_var: "seccomp:unconfined", desc: "Disabled syscall filtering" }

# optional container parameters
opt_param_usage_include_env: false
Expand All @@ -77,6 +80,9 @@ opt_param_devices:
opt_cap_add_param: false
opt_cap_add_param_vars:
- { cap_add_var: "NET_ADMIN" }
security_opt_param: false
security_opt_param_vars:
- { run_var: "seccomp=unconfined", compose_var: "seccomp:unconfined", desc: "Disabled syscall filtering" }

# Unraid templating
# Disables the sync function on unraids side. On by default
Expand Down

0 comments on commit 85b3178

Please sign in to comment.