--- - name: Get Share List uri: url: https://{{ ansible_fqdn }}:{{ configs.mft_services.transfer_job_manager.proxy_port }}/transfer-job-manager/v1/admin/shares status_code: 200 user: "{{ configs.mft_services.transfer_job_manager.api_user }}" password: "{{ configs.mft_services.transfer_job_manager.api_pass }}" force_basic_auth: yes client_cert: "{{ cert_cert_path.remote }}" client_key: "{{ cert_key_path.remote }}" validate_certs: false register: shares_response - name: Create Local Shares uri: url: https://{{ ansible_fqdn }}:{{ configs.mft_services.transfer_job_manager.proxy_port }}/transfer-job-manager/v1/admin/shares method: POST status_code: 201 user: "{{ configs.mft_services.transfer_job_manager.api_user }}" password: "{{ configs.mft_services.transfer_job_manager.api_pass }}" force_basic_auth: yes client_cert: "{{ cert_cert_path.remote }}" client_key: "{{ cert_key_path.remote }}" validate_certs: false body: "name": "{{ item.value.name }}" "local_path": "{{ item.value.local_path }}" "public_uri": "{{ item.value.public_uri }}" "description": "{{ item.value.description }}" "permissions": "{{ item.value.permissions }}" "user_id": "{{ item.value.user_id }}" "public": "{{ item.value.public }}" "file_io_type": "{{ item.value.file_io_type }}" body_format: json vars: existing: "{{ shares_response|json_query('json[*].name') }}" when: item.value.name not in existing with_dict: "{{ local_shares }}" # vim:ft=ansible