From 8d7ea840ae4543213971e62c140943b4779d6d90 Mon Sep 17 00:00:00 2001 From: t2d Date: Sat, 4 Nov 2023 08:51:34 +0100 Subject: [PATCH] Dump userli_extra_reserved_names to file to avoid "Filename to long" error (#56) --- tasks/deployment.yml | 12 +++++++++++- templates/reserved_names.j2 | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 templates/reserved_names.j2 diff --git a/tasks/deployment.yml b/tasks/deployment.yml index 2609350..b8a6136 100644 --- a/tasks/deployment.yml +++ b/tasks/deployment.yml @@ -71,15 +71,25 @@ changed_when: __userli_reserved_names.rc != 0 failed_when: __userli_reserved_names.rc != 0 +- name: Dump custom reservedNames into file + ansible.builtin.template: + src: reserved_names.j2 + dest: "{{ userli_home }}/reserved_names" + owner: "{{ userli_user }}" + group: "{{ userli_group }}" + mode: "0660" + when: userli_extra_reserved_names.length > 0 + - name: Load custom reservedNames into database ansible.builtin.command: | - 'echo "{{ userli_extra_reserved_names | join("\n") }}" | bin/console app:reservednames:import --file=-' + "bin/console app:reservednames:import --file={{ userli_home }}/reserved_names" args: chdir: "{{ userli_symfony_path }}" environment: APP_ENV: "prod" become: true become_user: "{{ userli_user }}" + when: userli_extra_reserved_names.length > 0 register: __userli_reserved_names changed_when: __userli_reserved_names.rc != 0 failed_when: __userli_reserved_names.rc != 0 diff --git a/templates/reserved_names.j2 b/templates/reserved_names.j2 new file mode 100644 index 0000000..7785716 --- /dev/null +++ b/templates/reserved_names.j2 @@ -0,0 +1,3 @@ +{% for name in userli_extra_reserved_names %} +{{ name }} +{% endfor %}