Skip to content

Tasks that use synchronize do not respect global SSH options #249

@m5lapp

Description

@m5lapp

Hi there,

When deploying configuration using configure_apps.yml, the Synchronize {{ item.name }} repo from local Ansible host to {{ splunk_home }}/{{ app_dest }}/{{ item.name }} on remote host task, it does not respect globally configured Ansible SSH options. For instance, we have to deploy our Ansible through a jumphost and do this by setting the following variable:

ansible_ssh_common_args: '-J my.jumphost.example.com -o ConnectTimeout=30'

This means that the task fails as it cannot access the remote host directly without using the jumphost. I was able to resolve this issue by simply adding the use_ssh_args parameter in the task as follows:

- name: "Synchronize {{ item.name }} repo from local Ansible host to {{ splunk_home }}/{{ app_dest }}/{{ item.name }} on remote host"
  ansible.posix.synchronize:
    src: "{{ app_src }}"
    dest: "{{ splunk_home }}/{{ app_dest }}/"
    recursive: true
    delete: true
    checksum: true
    private_key: "{{ rsync_private_key|default(omit) }}"
    use_ssh_args: true
    rsync_opts:
      - "--prune-empty-dirs"
      - "--itemize-changes"
      - "--no-owner"
      - "--no-group"
      - "--no-times"
  become: true
  become_user: "{{ splunk_nix_user }}"
  notify: "{{ handler }}"

it would be great if this could be configured by a single global variable, this will keep the old behaviour as standard but allow for people to easily change the behaviour when needed.

use_ssh_args: "{{ splunk_synchronize_use_ssh_args }}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions