service: Support setting templated file mode
This commit is contained in:
@@ -150,6 +150,11 @@ argument_specs:
|
|||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
|
mode:
|
||||||
|
description: Templated file permissions
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
default: "0644"
|
||||||
volume_device:
|
volume_device:
|
||||||
description: >-
|
description: >-
|
||||||
The path of a device which is mounted for the volume.
|
The path of a device which is mounted for the volume.
|
||||||
|
|||||||
@@ -22,6 +22,6 @@
|
|||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "{{ item[0].source }}"
|
src: "{{ item[0].source }}"
|
||||||
dest: "{{ item[1] }}"
|
dest: "{{ item[1] }}"
|
||||||
mode: "0644"
|
mode: "{{ item[0].mode | default('0644') }}"
|
||||||
notify: Restart container service {{ service_name }}
|
notify: Restart container service {{ service_name }}
|
||||||
loop: "{{ _service_all_template_mounts | zip(_service_all_template_mount_host_files) }}"
|
loop: "{{ _service_all_template_mounts | zip(_service_all_template_mount_host_files) }}"
|
||||||
|
|||||||
@@ -39,12 +39,13 @@ _service_additional_container_template_mounts: >-
|
|||||||
{{
|
{{
|
||||||
([{'readonly': true}] * _service_additional_template_mounts | length) |
|
([{'readonly': true}] * _service_additional_template_mounts | length) |
|
||||||
zip(
|
zip(
|
||||||
_service_additional_template_mounts,
|
|
||||||
_service_additional_template_mounts |
|
_service_additional_template_mounts |
|
||||||
map(attribute='source') |
|
community.general.remove_keys(['mode']),
|
||||||
map('regex_replace', '\.j2$', '') |
|
_service_additional_template_mounts |
|
||||||
map('regex_replace', '^', _service_host_directory ~ '/mounts/') |
|
map(attribute='source') |
|
||||||
map('community.general.dict_kv', 'source'),
|
map('regex_replace', '\.j2$', '') |
|
||||||
|
map('regex_replace', '^', _service_host_directory ~ '/mounts/') |
|
||||||
|
map('community.general.dict_kv', 'source'),
|
||||||
([{'type': 'bind'}] * _service_additional_template_mounts | length)
|
([{'type': 'bind'}] * _service_additional_template_mounts | length)
|
||||||
) |
|
) |
|
||||||
map('combine')
|
map('combine')
|
||||||
|
|||||||
@@ -19,12 +19,13 @@ _service_container_template_mounts: >-
|
|||||||
{{
|
{{
|
||||||
([{'readonly': true}] * _service_template_mounts | length) |
|
([{'readonly': true}] * _service_template_mounts | length) |
|
||||||
zip(
|
zip(
|
||||||
_service_template_mounts,
|
|
||||||
_service_template_mounts |
|
_service_template_mounts |
|
||||||
map(attribute='source') |
|
community.general.remove_keys(['mode']),
|
||||||
map('regex_replace', '\.j2$', '') |
|
_service_template_mounts |
|
||||||
map('regex_replace', '^', _service_host_directory ~ '/mounts/') |
|
map(attribute='source') |
|
||||||
map('community.general.dict_kv', 'source'),
|
map('regex_replace', '\.j2$', '') |
|
||||||
|
map('regex_replace', '^', _service_host_directory ~ '/mounts/') |
|
||||||
|
map('community.general.dict_kv', 'source'),
|
||||||
([{'type': 'bind'}] * _service_template_mounts | length)
|
([{'type': 'bind'}] * _service_template_mounts | length)
|
||||||
) |
|
) |
|
||||||
map('combine')
|
map('combine')
|
||||||
|
|||||||
Reference in New Issue
Block a user