From d526011521ea8f3433d8e940d2a1839474b1c1f4 Mon Sep 17 00:00:00 2001 From: Florian Beer Date: Sun, 9 May 2021 16:23:09 +0200 Subject: [PATCH] Add Ansible SSH pipelining option (#66) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pipelining, if supported by the connection plugin, reduces the number of network operations required to execute a module on the remote server, by executing many Ansible modules without actual file transfer. This can result in a very significant performance improvement when enabled. However this conflicts with privilege escalation (become). For example, when using ‘sudo:’ operations you must first disable ‘requiretty’ in /etc/sudoers on all managed hosts, which is why it is disabled by default. - https://docs.ansible.com/ansible/latest/reference_appendices/config.html#ansible-pipelining --- Asm/Ansible/Command/AnsiblePlaybook.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Asm/Ansible/Command/AnsiblePlaybook.php b/Asm/Ansible/Command/AnsiblePlaybook.php index a9c0e46..d67d664 100644 --- a/Asm/Ansible/Command/AnsiblePlaybook.php +++ b/Asm/Ansible/Command/AnsiblePlaybook.php @@ -716,6 +716,22 @@ public function hostKeyChecking(bool $enable = true): AnsiblePlaybookInterface $this->processBuilder->setEnv('ANSIBLE_HOST_KEY_CHECKING', $flag); return $this; } + + /** + * Ansible SSH pipelining option + * https://docs.ansible.com/ansible/latest/reference_appendices/config.html#ansible-pipelining + * + * @param bool $enable + **/ + public function sshPipelining(bool $enable = false): AnsiblePlaybookInterface + { + $enable ? + $flag = 'True' : + $flag = 'False'; + + $this->processBuilder->setEnv('ANSIBLE_SSH_PIPELINING', $flag); + return $this; + } /** * If no inventory file is given, assume