title: Ansible Run Task Without Killing The Process
body: <p>I'm trying to automate the joining to our local domain over a VPN connection with Ansible.
  For some reasons it seems that it do not matter what I'm trying, the process is getting killed by the automation at the end of the task.</p>
  <p>First option, with poll:0.</p>
  <pre><code>    - name: OpenConnect | Join The Home Domain
        become: true
        poll: 0
        ansible.builtin.shell: &quot;openconnect --background --protocol=gp join.&lt;Our Domain&gt; -u rmt-{{ group_names[0] }} --passwd-on-stdin&quot;
        args:
          stdin: &quot;{{ customers.vpn_password | string }}&quot;
  </code></pre>
  <p>Option 2, with expect:</p>
  <pre><code>      ansible.builtin.expect:
          command: &quot;nohup openconnect --background --protocol=gp join.&lt;Our Domain&gt; -u rmt-{{ group_names[0] }}&quot;
          responses:
            Password: &quot;{{ customers.vpn_password }}&quot;
  </code></pre>