Shared folder already exists

Hi, i have symlinked uploads folder with mounted folder, and when i want to deploy, it gives me this error

TASK [deploy : Ensure shared sources are present] ******************************
failed: [production_hostname] (item={u’path’: u’web/app/uploads’, u’src’: u’uploads’}) => {“failed”: true, “gid”: 0, “group”: “root”, “item”: {“path”: “web/app/uploads”, “src”: “uploads”}, “mode”: “0777”, “msg”: “/srv/www/example.com/shared/uploads already exists as a link”, “owner”: “root”, “path”: “/srv/www/example.com/shared/uploads”, “size”: 12, “state”: “link”, “uid”: 0}
to retry, use: --limit @deploy.retry

i could find this code in share.yml

  • name: Ensure shared sources are present
    file:
    path: "{{ deploy_helper.shared_path }}/{{ item.src }}"
    state: "{{ item.type | default(‘directory’) }}"
    mode: "{{ item.mode | default(‘0755’) }}"
    with_items: “{{ project_shared_children }}”

but i want it on staging server so deleting is no option. Is there some way how to write there condition DO NOT DO THIS WHEN ENV == PRODUCTION? thank you

1 Like

Just re-define project_shared_children in group_vars/production/main.yml.

Default is here: https://github.com/roots/trellis/blob/d08dc996ac2d692235607a314fff3c95e10a0b8f/roles/deploy/defaults/main.yml#L33-L35

This is just Ansible basics which can be learned from their docs.

2 Likes