From 236ae4236098bd0995070c3a6f750de0e69472e0 Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 5 Aug 2024 11:34:09 +0300 Subject: [PATCH 1/5] additional_symlink_task_fix_for_squashfs --- docs/roles/composer.md | 2 +- docs/roles/config_generate.md | 2 +- docs/roles/deploy_code.md | 2 +- docs/roles/npm.md | 2 +- roles/composer/README.md | 2 +- roles/composer/defaults/main.yml | 2 +- roles/config_generate/README.md | 2 +- roles/config_generate/defaults/main.yml | 2 +- roles/deploy_code/README.md | 2 +- roles/deploy_code/defaults/main.yml | 2 +- roles/deploy_code/tasks/deploy.yml | 15 ++++++++++++++- roles/live_symlink/defaults/main.yml | 2 +- roles/npm/README.md | 2 +- roles/npm/defaults/main.yml | 2 +- 14 files changed, 27 insertions(+), 14 deletions(-) diff --git a/docs/roles/composer.md b/docs/roles/composer.md index 74765170..c2fd2b1d 100644 --- a/docs/roles/composer.md +++ b/docs/roles/composer.md @@ -14,7 +14,7 @@ composer: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # create: whether to create the target if it does not exists. + # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' # - src: '/var/simplesaml/etc' diff --git a/docs/roles/config_generate.md b/docs/roles/config_generate.md index fe7aecfe..941b0680 100644 --- a/docs/roles/config_generate.md +++ b/docs/roles/config_generate.md @@ -11,7 +11,7 @@ config_generate: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # create: whether to create the target if it does not exists. + # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' # - src: '/var/simplesaml/etc' diff --git a/docs/roles/deploy_code.md b/docs/roles/deploy_code.md index 5d4cc722..fa1fec71 100644 --- a/docs/roles/deploy_code.md +++ b/docs/roles/deploy_code.md @@ -89,7 +89,7 @@ deploy_code: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # create: whether to create the target if it does not exists. + # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' # - src: '/var/simplesaml/etc' diff --git a/docs/roles/npm.md b/docs/roles/npm.md index 97f06cdc..45b401b0 100644 --- a/docs/roles/npm.md +++ b/docs/roles/npm.md @@ -18,7 +18,7 @@ npm: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # create: whether to create the target if it does not exists. + # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' # - src: '/var/simplesaml/etc' diff --git a/roles/composer/README.md b/roles/composer/README.md index 74765170..c2fd2b1d 100644 --- a/roles/composer/README.md +++ b/roles/composer/README.md @@ -14,7 +14,7 @@ composer: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # create: whether to create the target if it does not exists. + # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' # - src: '/var/simplesaml/etc' diff --git a/roles/composer/defaults/main.yml b/roles/composer/defaults/main.yml index d0dfbd1d..78876efc 100644 --- a/roles/composer/defaults/main.yml +++ b/roles/composer/defaults/main.yml @@ -7,7 +7,7 @@ composer: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # create: whether to create the target if it does not exists. + # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' # - src: '/var/simplesaml/etc' diff --git a/roles/config_generate/README.md b/roles/config_generate/README.md index fe7aecfe..941b0680 100644 --- a/roles/config_generate/README.md +++ b/roles/config_generate/README.md @@ -11,7 +11,7 @@ config_generate: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # create: whether to create the target if it does not exists. + # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' # - src: '/var/simplesaml/etc' diff --git a/roles/config_generate/defaults/main.yml b/roles/config_generate/defaults/main.yml index 8f1987eb..e9eb308a 100644 --- a/roles/config_generate/defaults/main.yml +++ b/roles/config_generate/defaults/main.yml @@ -3,7 +3,7 @@ config_generate: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # create: whether to create the target if it does not exists. + # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' # - src: '/var/simplesaml/etc' diff --git a/roles/deploy_code/README.md b/roles/deploy_code/README.md index 5d4cc722..fa1fec71 100644 --- a/roles/deploy_code/README.md +++ b/roles/deploy_code/README.md @@ -89,7 +89,7 @@ deploy_code: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # create: whether to create the target if it does not exists. + # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' # - src: '/var/simplesaml/etc' diff --git a/roles/deploy_code/defaults/main.yml b/roles/deploy_code/defaults/main.yml index b8220475..b28b479d 100644 --- a/roles/deploy_code/defaults/main.yml +++ b/roles/deploy_code/defaults/main.yml @@ -11,7 +11,7 @@ deploy_code: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # create: whether to create the target if it does not exists. + # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' # - src: '/var/simplesaml/etc' diff --git a/roles/deploy_code/tasks/deploy.yml b/roles/deploy_code/tasks/deploy.yml index 032e1577..307a480c 100644 --- a/roles/deploy_code/tasks/deploy.yml +++ b/roles/deploy_code/tasks/deploy.yml @@ -28,7 +28,7 @@ - deploy_code.templates | length - deploy_operation == 'deploy' -- name: Create additional symlinks. +- name: Create additional symlinks in build dir. ansible.builtin.file: src: "{{ link.src }}" dest: "{{ deploy_path }}/{{ link.dest }}" @@ -38,6 +38,19 @@ loop_var: link when: - deploy_code.symlinks | length + - deploy_code.mount_type != "squashfs" + +- name: Create additional symlinks in deploy dir. + ansible.builtin.file: + src: "{{ link.src }}" + dest: "{{ live_symlink_dest }}/{{ link.dest }}" + state: link + with_items: "{{ deploy_code.symlinks }}" + loop_control: + loop_var: link + when: + - deploy_code.symlinks | length + - deploy_code.mount_type == "squashfs" # Additional vhost handling for feature branch builds. diff --git a/roles/live_symlink/defaults/main.yml b/roles/live_symlink/defaults/main.yml index eca23ad6..0a1aac69 100644 --- a/roles/live_symlink/defaults/main.yml +++ b/roles/live_symlink/defaults/main.yml @@ -6,7 +6,7 @@ live_symlink: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # create: whether to create the target if it does not exists. + # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' # - src: '/var/simplesaml/etc' diff --git a/roles/npm/README.md b/roles/npm/README.md index 97f06cdc..45b401b0 100644 --- a/roles/npm/README.md +++ b/roles/npm/README.md @@ -18,7 +18,7 @@ npm: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # create: whether to create the target if it does not exists. + # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' # - src: '/var/simplesaml/etc' diff --git a/roles/npm/defaults/main.yml b/roles/npm/defaults/main.yml index a29fcac7..57e45056 100644 --- a/roles/npm/defaults/main.yml +++ b/roles/npm/defaults/main.yml @@ -11,7 +11,7 @@ npm: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # create: whether to create the target if it does not exists. + # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' # - src: '/var/simplesaml/etc' From 1667379f42d530cc5cd363aafa260a51acd23bd0 Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 5 Aug 2024 12:00:35 +0300 Subject: [PATCH 2/5] additional_symlink_task_fix_for_squashfs --- roles/deploy_code/defaults/main.yml | 4 +++- roles/deploy_code/tasks/deploy.yml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/deploy_code/defaults/main.yml b/roles/deploy_code/defaults/main.yml index b28b479d..62e50b00 100644 --- a/roles/deploy_code/defaults/main.yml +++ b/roles/deploy_code/defaults/main.yml @@ -11,11 +11,13 @@ deploy_code: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. + # force: set to true to create the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: true # - src: '/var/simplesaml/etc' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: false symlinks: [] # Specify any additional templates to generate, with src (template) and dest (file). # src: name of a template, in the "templates" dir relative to your playbook. diff --git a/roles/deploy_code/tasks/deploy.yml b/roles/deploy_code/tasks/deploy.yml index 307a480c..ef38f63a 100644 --- a/roles/deploy_code/tasks/deploy.yml +++ b/roles/deploy_code/tasks/deploy.yml @@ -45,6 +45,7 @@ src: "{{ link.src }}" dest: "{{ live_symlink_dest }}/{{ link.dest }}" state: link + force: "{{ link.force }}" with_items: "{{ deploy_code.symlinks }}" loop_control: loop_var: link From 71e16c645fc62d0402131f37e16e398eeb624371 Mon Sep 17 00:00:00 2001 From: tim Date: Tue, 6 Aug 2024 01:45:15 +0300 Subject: [PATCH 3/5] additional_symlink_task_fix_for_squashfs --- roles/deploy_code/tasks/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/deploy_code/tasks/deploy.yml b/roles/deploy_code/tasks/deploy.yml index ef38f63a..68d40d4a 100644 --- a/roles/deploy_code/tasks/deploy.yml +++ b/roles/deploy_code/tasks/deploy.yml @@ -52,6 +52,7 @@ when: - deploy_code.symlinks | length - deploy_code.mount_type == "squashfs" + - deploy_operation == 'deploy' # Additional vhost handling for feature branch builds. From 33e6e6e8c8b48c25bc0668d3fa72611a24828266 Mon Sep 17 00:00:00 2001 From: tim Date: Tue, 6 Aug 2024 02:36:58 +0300 Subject: [PATCH 4/5] additional_symlink_task_fixes --- docs/roles/composer.md | 4 +++- docs/roles/config_generate.md | 4 +++- docs/roles/deploy_code.md | 4 +++- docs/roles/npm.md | 4 +++- roles/composer/README.md | 4 +++- roles/composer/defaults/main.yml | 4 +++- roles/composer/tasks/main.yml | 1 + roles/config_generate/README.md | 4 +++- roles/config_generate/defaults/main.yml | 4 +++- roles/config_generate/tasks/main.yml | 1 + roles/deploy_code/README.md | 4 +++- roles/deploy_code/tasks/deploy.yml | 4 +++- roles/live_symlink/defaults/main.yml | 4 +++- roles/live_symlink/tasks/main.yml | 2 +- roles/npm/README.md | 4 +++- roles/npm/defaults/main.yml | 4 +++- roles/npm/tasks/main.yml | 1 + 17 files changed, 43 insertions(+), 14 deletions(-) diff --git a/docs/roles/composer.md b/docs/roles/composer.md index c2fd2b1d..47e40b29 100644 --- a/docs/roles/composer.md +++ b/docs/roles/composer.md @@ -14,11 +14,13 @@ composer: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. + # force: set to true to create the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: true # - src: '/var/simplesaml/etc' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: false symlinks: [] # Specify any additional templates to generate, with src (template) and dest (file). # src: name of a template, in the "templates" dir relative to your playbook. diff --git a/docs/roles/config_generate.md b/docs/roles/config_generate.md index 941b0680..b6b46aba 100644 --- a/docs/roles/config_generate.md +++ b/docs/roles/config_generate.md @@ -11,11 +11,13 @@ config_generate: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. + # force: set to true to create the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: true # - src: '/var/simplesaml/etc' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: false symlinks: [] # Specify any additional templates to generate, with src (template) and dest (file). # src: name of a template, in the "templates" dir relative to your playbook. diff --git a/docs/roles/deploy_code.md b/docs/roles/deploy_code.md index fa1fec71..634dbbe5 100644 --- a/docs/roles/deploy_code.md +++ b/docs/roles/deploy_code.md @@ -89,11 +89,13 @@ deploy_code: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. + # force: set to true to create the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: true # - src: '/var/simplesaml/etc' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: false symlinks: [] # Specify any additional templates to generate, with src (template) and dest (file). # src: name of a template, in the "templates" dir relative to your playbook. diff --git a/docs/roles/npm.md b/docs/roles/npm.md index 45b401b0..5a17e577 100644 --- a/docs/roles/npm.md +++ b/docs/roles/npm.md @@ -18,11 +18,13 @@ npm: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. + # force: set to true to create the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: true # - src: '/var/simplesaml/etc' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: false symlinks: [] # Specify any additional templates to generate, with src (template) and dest (file). # src: name of a template, in the "templates" dir relative to your playbook. diff --git a/roles/composer/README.md b/roles/composer/README.md index c2fd2b1d..47e40b29 100644 --- a/roles/composer/README.md +++ b/roles/composer/README.md @@ -14,11 +14,13 @@ composer: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. + # force: set to true to create the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: true # - src: '/var/simplesaml/etc' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: false symlinks: [] # Specify any additional templates to generate, with src (template) and dest (file). # src: name of a template, in the "templates" dir relative to your playbook. diff --git a/roles/composer/defaults/main.yml b/roles/composer/defaults/main.yml index 78876efc..314f8bd0 100644 --- a/roles/composer/defaults/main.yml +++ b/roles/composer/defaults/main.yml @@ -7,11 +7,13 @@ composer: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. + # force: set to true to create the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: true # - src: '/var/simplesaml/etc' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: false symlinks: [] # Specify any additional templates to generate, with src (template) and dest (file). # src: name of a template, in the "templates" dir relative to your playbook. diff --git a/roles/composer/tasks/main.yml b/roles/composer/tasks/main.yml index bba5e02a..5bf70693 100644 --- a/roles/composer/tasks/main.yml +++ b/roles/composer/tasks/main.yml @@ -25,6 +25,7 @@ src: "{{ link.src }}" dest: "{{ deploy_path }}/{{ link.dest }}" state: link + force: "{{ link.force | default(false) }}" with_items: "{{ composer.symlinks }}" loop_control: loop_var: link diff --git a/roles/config_generate/README.md b/roles/config_generate/README.md index 941b0680..b6b46aba 100644 --- a/roles/config_generate/README.md +++ b/roles/config_generate/README.md @@ -11,11 +11,13 @@ config_generate: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. + # force: set to true to create the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: true # - src: '/var/simplesaml/etc' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: false symlinks: [] # Specify any additional templates to generate, with src (template) and dest (file). # src: name of a template, in the "templates" dir relative to your playbook. diff --git a/roles/config_generate/defaults/main.yml b/roles/config_generate/defaults/main.yml index e9eb308a..5b4f50cf 100644 --- a/roles/config_generate/defaults/main.yml +++ b/roles/config_generate/defaults/main.yml @@ -3,11 +3,13 @@ config_generate: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. + # force: set to true to create the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: true # - src: '/var/simplesaml/etc' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: false symlinks: [] # Specify any additional templates to generate, with src (template) and dest (file). # src: name of a template, in the "templates" dir relative to your playbook. diff --git a/roles/config_generate/tasks/main.yml b/roles/config_generate/tasks/main.yml index adc35b06..dacf9615 100644 --- a/roles/config_generate/tasks/main.yml +++ b/roles/config_generate/tasks/main.yml @@ -20,6 +20,7 @@ src: "{{ link.src }}" dest: "{{ deploy_path }}/{{ link.dest }}" state: link + force: "{{ link.force | default(false) }}" with_items: "{{ config_generate.symlinks }}" loop_control: loop_var: link diff --git a/roles/deploy_code/README.md b/roles/deploy_code/README.md index fa1fec71..634dbbe5 100644 --- a/roles/deploy_code/README.md +++ b/roles/deploy_code/README.md @@ -89,11 +89,13 @@ deploy_code: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. + # force: set to true to create the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: true # - src: '/var/simplesaml/etc' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: false symlinks: [] # Specify any additional templates to generate, with src (template) and dest (file). # src: name of a template, in the "templates" dir relative to your playbook. diff --git a/roles/deploy_code/tasks/deploy.yml b/roles/deploy_code/tasks/deploy.yml index 68d40d4a..95315038 100644 --- a/roles/deploy_code/tasks/deploy.yml +++ b/roles/deploy_code/tasks/deploy.yml @@ -33,6 +33,7 @@ src: "{{ link.src }}" dest: "{{ deploy_path }}/{{ link.dest }}" state: link + force: "{{ link.force | default(false) }}" with_items: "{{ deploy_code.symlinks }}" loop_control: loop_var: link @@ -45,7 +46,8 @@ src: "{{ link.src }}" dest: "{{ live_symlink_dest }}/{{ link.dest }}" state: link - force: "{{ link.force }}" + force: "{{ link.force | default(false) }}" + follow: false with_items: "{{ deploy_code.symlinks }}" loop_control: loop_var: link diff --git a/roles/live_symlink/defaults/main.yml b/roles/live_symlink/defaults/main.yml index 0a1aac69..51618671 100644 --- a/roles/live_symlink/defaults/main.yml +++ b/roles/live_symlink/defaults/main.yml @@ -6,11 +6,13 @@ live_symlink: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. + # force: set to true to create the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: true # - src: '/var/simplesaml/etc' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: false symlinks: [] # Specify any additional templates to generate, with src (template) and dest (file). # src: name of a template, in the "templates" dir relative to your playbook. diff --git a/roles/live_symlink/tasks/main.yml b/roles/live_symlink/tasks/main.yml index fa1d9e97..d85e4e7f 100644 --- a/roles/live_symlink/tasks/main.yml +++ b/roles/live_symlink/tasks/main.yml @@ -38,7 +38,7 @@ dest: "{{ deploy_path }}/{{ link.dest }}" state: link follow: false - force: true + force: "{{ link.force | default(true) }}" with_items: "{{ live_symlink.symlinks }}" loop_control: loop_var: link diff --git a/roles/npm/README.md b/roles/npm/README.md index 45b401b0..5a17e577 100644 --- a/roles/npm/README.md +++ b/roles/npm/README.md @@ -18,11 +18,13 @@ npm: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. + # force: set to true to create the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: true # - src: '/var/simplesaml/etc' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: false symlinks: [] # Specify any additional templates to generate, with src (template) and dest (file). # src: name of a template, in the "templates" dir relative to your playbook. diff --git a/roles/npm/defaults/main.yml b/roles/npm/defaults/main.yml index 57e45056..49321d19 100644 --- a/roles/npm/defaults/main.yml +++ b/roles/npm/defaults/main.yml @@ -11,11 +11,13 @@ npm: # Specify any additional symlink to create, with src (target) and dest (link). # src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig') # dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache') - # force: false # Set to true for the creation of the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. + # force: set to true to create the symlinks in two cases: the source file does not exist but will appear later; the destination exists and is a file. # - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: true # - src: '/var/simplesaml/etc' # dest: 'vendor/simplesamlphp/simplesamlphp/config' + # force: false symlinks: [] # Specify any additional templates to generate, with src (template) and dest (file). # src: name of a template, in the "templates" dir relative to your playbook. diff --git a/roles/npm/tasks/main.yml b/roles/npm/tasks/main.yml index f5372b0f..09487313 100644 --- a/roles/npm/tasks/main.yml +++ b/roles/npm/tasks/main.yml @@ -24,6 +24,7 @@ src: "{{ link.src }}" dest: "{{ deploy_path }}/{{ link.dest }}" state: link + force: "{{ link.force | default(false) }}" with_items: "{{ npm.symlinks }}" loop_control: loop_var: link From e717624e4975bc9dc0ccbdc7fc0356e3208ff450 Mon Sep 17 00:00:00 2001 From: tim Date: Tue, 6 Aug 2024 03:28:12 +0300 Subject: [PATCH 5/5] additional_symlink_task_fixes --- roles/deploy_code/tasks/deploy.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/roles/deploy_code/tasks/deploy.yml b/roles/deploy_code/tasks/deploy.yml index 95315038..a9d74d2e 100644 --- a/roles/deploy_code/tasks/deploy.yml +++ b/roles/deploy_code/tasks/deploy.yml @@ -39,22 +39,6 @@ loop_var: link when: - deploy_code.symlinks | length - - deploy_code.mount_type != "squashfs" - -- name: Create additional symlinks in deploy dir. - ansible.builtin.file: - src: "{{ link.src }}" - dest: "{{ live_symlink_dest }}/{{ link.dest }}" - state: link - force: "{{ link.force | default(false) }}" - follow: false - with_items: "{{ deploy_code.symlinks }}" - loop_control: - loop_var: link - when: - - deploy_code.symlinks | length - - deploy_code.mount_type == "squashfs" - - deploy_operation == 'deploy' # Additional vhost handling for feature branch builds.