title: Make a line in an Ansible playbook optional
body: <p>I have built a playbook to build a virtual server in F5. I want to make a line only execute if someone enters the variable. In this case the default_persistence_profile: line has a variable &quot;{{ persistenceProfile }}&quot;. Sometimes the developers don't want persistence applied to their app but sometimes they do. I have found when I make the variable optional in the run task and don't select a persistence profile the task errors out. See playbook below:</p>
  <pre><code>    - name: Build the Virtual Server
        bigip_virtual_server:
          state: present
          partition: Common
          name: &quot;{{ vsName  }}&quot; 
          destination: &quot;{{ vsIpAddress }}&quot;
          port: &quot;{{ vsPort }}&quot;
          pool: &quot;{{ poolName }}&quot;
          default_persistence_profile: &quot;{{ persistenceProfile }}&quot;
          ip_protocol: tcp 
          snat: automap
          description: &quot;{{ vsDescription }}&quot;
          profiles:
             - tcp
             - http
             - name: &quot;{{ clientsslName }}&quot; 
               context: client-side
             - name: default-server-ssl
               context: server-side
  </code></pre>