Add support for binary content to matrix-aux

This commit is contained in:
Slavi Pantaleev 2022-10-20 16:05:55 +03:00
parent af3a32cf6a
commit b8097b0bd6
2 changed files with 11 additions and 1 deletions

View File

@ -50,6 +50,9 @@ matrix_aux_file_default_mode: '0640'
# then you likely need to add `/matrix/some/path` to `matrix_aux_directory_definitions` as well. # then you likely need to add `/matrix/some/path` to `matrix_aux_directory_definitions` as well.
# You don't need to do this for directories that the playbook already creates for you. # You don't need to do this for directories that the playbook already creates for you.
# #
# Use a `content` key for text content and `src` with a location to a file for binary content.
# The `content` key does not support binary content (see https://github.com/ansible/ansible/issues/11594).
#
# Example: # Example:
# #
# matrix_aux_file_definitions: # matrix_aux_file_definitions:
@ -69,4 +72,10 @@ matrix_aux_file_default_mode: '0640'
# mode: '0600' # mode: '0600'
# owner: 'some-user' # owner: 'some-user'
# group: 'some-group' # group: 'some-group'
#
# - dest: /matrix/aux/binary-file.dat
# src: "/path/to/binary.dat"
# mode: '0600'
# owner: 'some-user'
# group: 'some-group'
matrix_aux_file_definitions: [] matrix_aux_file_definitions: []

View File

@ -11,8 +11,9 @@
- name: Ensure AUX files are created - name: Ensure AUX files are created
ansible.builtin.copy: ansible.builtin.copy:
src: "{{ item.src if 'src' in item else omit }}"
content: "{{ item.content if 'content' in item else omit }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
content: "{{ item.content }}"
owner: "{{ item.owner | default(matrix_user_username) }}" owner: "{{ item.owner | default(matrix_user_username) }}"
group: "{{ item.group | default(matrix_user_groupname) }}" group: "{{ item.group | default(matrix_user_groupname) }}"
mode: "{{ item.mode | default(matrix_aux_file_default_mode) }}" mode: "{{ item.mode | default(matrix_aux_file_default_mode) }}"