<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto">modules-extra / cloud / openstack / os_recordset</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible --version
ansible 2.2.0.0
  config file = /home/ubuntu/work/playbooks/ansible.cfg
  configured module search path = Default w/o overrides
"><pre class="notranslate"><code class="notranslate">$ ansible --version
ansible 2.2.0.0
  config file = /home/ubuntu/work/playbooks/ansible.cfg
  configured module search path = Default w/o overrides

</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[defaults]
inventory=inventory/openstack.py

[ssh_connection]
pipelining=False"><pre class="notranslate"><code class="notranslate">[defaults]
inventory=inventory/openstack.py

[ssh_connection]
pipelining=False
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">Ubuntu 16.04.  The task uses delegate_to: localhost</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">It seems the os_recordset module is unable to create domain records with both A and  AAAA records if they both have the same name. This isn't uncommon in IPv4 and IPv6 deployments.  I should be able to create both A and AAAA records for the same name.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>


<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- hosts: testhost
  tasks:
    - name: Setting up testhost IPv4
      delegate_to: localhost
      os_recordset:
        cloud: dev
        state: present
        zone: &quot;example.com.&quot;
        name: &quot;www&quot;
        recordset_type: A
        records: &quot;{{ openstack.accessIPv4 }}&quot;
        ttl: 3600
    - name: Setting up testhost IPv6
      delegate_to: localhost
      os_recordset:
        cloud: dev
        state: present
        zone: &quot;example.com.&quot;
        name: &quot;www&quot;
        recordset_type: AAAA
        records: &quot;{{ openstack.accessIPv6 }}&quot;
        ttl: 3600
"><pre class="notranslate">- <span class="pl-ent">hosts</span>: <span class="pl-s">testhost</span>
  <span class="pl-ent">tasks</span>:
    - <span class="pl-ent">name</span>: <span class="pl-s">Setting up testhost IPv4</span>
      <span class="pl-ent">delegate_to</span>: <span class="pl-s">localhost</span>
      <span class="pl-ent">os_recordset</span>:
        <span class="pl-ent">cloud</span>: <span class="pl-s">dev</span>
        <span class="pl-ent">state</span>: <span class="pl-s">present</span>
        <span class="pl-ent">zone</span>: <span class="pl-s"><span class="pl-pds">"</span>example.com.<span class="pl-pds">"</span></span>
        <span class="pl-ent">name</span>: <span class="pl-s"><span class="pl-pds">"</span>www<span class="pl-pds">"</span></span>
        <span class="pl-ent">recordset_type</span>: <span class="pl-s">A</span>
        <span class="pl-ent">records</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ openstack.accessIPv4 }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">ttl</span>: <span class="pl-c1">3600</span>
    - <span class="pl-ent">name</span>: <span class="pl-s">Setting up testhost IPv6</span>
      <span class="pl-ent">delegate_to</span>: <span class="pl-s">localhost</span>
      <span class="pl-ent">os_recordset</span>:
        <span class="pl-ent">cloud</span>: <span class="pl-s">dev</span>
        <span class="pl-ent">state</span>: <span class="pl-s">present</span>
        <span class="pl-ent">zone</span>: <span class="pl-s"><span class="pl-pds">"</span>example.com.<span class="pl-pds">"</span></span>
        <span class="pl-ent">name</span>: <span class="pl-s"><span class="pl-pds">"</span>www<span class="pl-pds">"</span></span>
        <span class="pl-ent">recordset_type</span>: <span class="pl-s">AAAA</span>
        <span class="pl-ent">records</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ openstack.accessIPv6 }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">ttl</span>: <span class="pl-c1">3600</span>
</pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">I would expect both A and AAAA records to be created without error.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">Creating A/AAAA record and both an A and AAAA records already exist in OpenStack:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [Setting up testhost IPv4] ************************************************
fatal: [www.example.com -&gt; localhost]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;failed&quot;: true, &quot;msg&quot;: &quot;Unable to create recordset www (Inner Exception: Duplicate RecordSet)&quot;}"><pre class="notranslate"><code class="notranslate">TASK [Setting up testhost IPv4] ************************************************
fatal: [www.example.com -&gt; localhost]: FAILED! =&gt; {"changed": false, "failed": true, "msg": "Unable to create recordset www (Inner Exception: Duplicate RecordSet)"}
</code></pre></div>
<p dir="auto">Creating A record and only an AAAA record already exists in OpenStack:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [Setting up testhost IPv4] ************************************************
fatal: [www.example.com -&gt; localhost]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;failed&quot;: true, &quot;msg&quot;: &quot;Error updating recordset www.example.com. (Inner Exception: u'10.0.0.1' is not a 'ipv6')&quot;}"><pre class="notranslate"><code class="notranslate">TASK [Setting up testhost IPv4] ************************************************
fatal: [www.example.com -&gt; localhost]: FAILED! =&gt; {"changed": false, "failed": true, "msg": "Error updating recordset www.example.com. (Inner Exception: u'10.0.0.1' is not a 'ipv6')"}
</code></pre></div>
<p dir="auto">Verbose on:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="fatal: [www.example.com -&gt; localhost]: FAILED! =&gt; {
    &quot;changed&quot;: false, 
    &quot;failed&quot;: true, 
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;api_timeout&quot;: null, 
            &quot;auth&quot;: null, 
            &quot;auth_type&quot;: null, 
            &quot;availability_zone&quot;: null, 
            &quot;cacert&quot;: null, 
            &quot;cert&quot;: null, 
            &quot;cloud&quot;: &quot;dev&quot;, 
            &quot;description&quot;: null, 
            &quot;endpoint_type&quot;: &quot;public&quot;, 
            &quot;key&quot;: null, 
            &quot;name&quot;: &quot;www&quot;, 
            &quot;records&quot;: [
                &quot;10.0.0.1&quot;
            ], 
            &quot;recordset_type&quot;: &quot;A&quot;, 
            &quot;region_name&quot;: null, 
            &quot;state&quot;: &quot;present&quot;, 
            &quot;timeout&quot;: 180, 
            &quot;ttl&quot;: 3600, 
            &quot;verify&quot;: true, 
            &quot;wait&quot;: true, 
            &quot;zone&quot;: &quot;example.com.&quot;
        }, 
        &quot;module_name&quot;: &quot;os_recordset&quot;
    }, 
    &quot;msg&quot;: &quot;Error updating recordset www.example.com. (Inner Exception: u'10.0.0.1' is not a 'ipv6')&quot;
}
"><pre class="notranslate"><code class="notranslate">fatal: [www.example.com -&gt; localhost]: FAILED! =&gt; {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "api_timeout": null, 
            "auth": null, 
            "auth_type": null, 
            "availability_zone": null, 
            "cacert": null, 
            "cert": null, 
            "cloud": "dev", 
            "description": null, 
            "endpoint_type": "public", 
            "key": null, 
            "name": "www", 
            "records": [
                "10.0.0.1"
            ], 
            "recordset_type": "A", 
            "region_name": null, 
            "state": "present", 
            "timeout": 180, 
            "ttl": 3600, 
            "verify": true, 
            "wait": true, 
            "zone": "example.com."
        }, 
        "module_name": "os_recordset"
    }, 
    "msg": "Error updating recordset www.example.com. (Inner Exception: u'10.0.0.1' is not a 'ipv6')"
}

</code></pre></div>
<p dir="auto">Creating an AAAA record and an A record already exists in OpenStack</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    &quot;msg&quot;: &quot;Error updating recordset www.example.com. (Inner Exception: u'&lt;ipv6 address removed&gt;' is not a 'ipv4')&quot;
"><pre class="notranslate"><code class="notranslate">    "msg": "Error updating recordset www.example.com. (Inner Exception: u'&lt;ipv6 address removed&gt;' is not a 'ipv4')"

</code></pre></div>
<p dir="auto">Ansible URI module remove plus sign when we do a post method call.<br>
Am using credential API to create credentials in Jenkins. My payload has the attribute which carries SSH private key. am using ansible vault to store my key and feeding my vault variable to the payload.<br>
Am getting successful response and even the credentials are created in jenkins.<br>
However it removes the plus (+) sign from the credential.</p>
<p dir="auto">Note: am using header</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    headers:
      Content-Type: &quot;application/x-www-form-urlencoded&quot;"><pre class="notranslate"><code class="notranslate">    headers:
      Content-Type: "application/x-www-form-urlencoded"
</code></pre></div>
<p dir="auto">My Request:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: configure gerrit credential
  uri:
    url: https://ipaddress/credentials/store/system/domain/_/createCredentials
    method: POST
    headers:
       Content-Type: &quot;x-www-form-urlencoded&quot;
    body: 'json={
  &quot;&quot;: &quot;0&quot;,
  &quot;credentials&quot;: {
    &quot;scope&quot;: &quot;GLOBAL&quot;,
    &quot;id&quot;: &quot;AADO-Jenkins-gerrit-ssh-credentials&quot;,
    &quot;username&quot;: &quot;Jenkins-test&quot;,
    &quot;passphrase&quot;: &quot;{{ jenkins_passphrase }}&quot;,
    &quot;privateKeySource&quot;: {
      &quot;stapler-class&quot;: &quot;com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource&quot;,
      &quot;privateKey&quot;: &quot;-----BEGIN RSA PRIVATE KEY-----\nABCCC+cccd+fff\n-----END RSA PRIVATE KEY-----\n&quot;
    },
    &quot;description&quot;: &quot;apicredentials&quot;,
    &quot;stapler-class&quot;: &quot;com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey&quot;
  }
}'
    validate_certs: no
    follow_redirects: yes
    register: login
    return_content: yes"><pre class="notranslate"><code class="notranslate">- name: configure gerrit credential
  uri:
    url: https://ipaddress/credentials/store/system/domain/_/createCredentials
    method: POST
    headers:
       Content-Type: "x-www-form-urlencoded"
    body: 'json={
  "": "0",
  "credentials": {
    "scope": "GLOBAL",
    "id": "AADO-Jenkins-gerrit-ssh-credentials",
    "username": "Jenkins-test",
    "passphrase": "{{ jenkins_passphrase }}",
    "privateKeySource": {
      "stapler-class": "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource",
      "privateKey": "-----BEGIN RSA PRIVATE KEY-----\nABCCC+cccd+fff\n-----END RSA PRIVATE KEY-----\n"
    },
    "description": "apicredentials",
    "stapler-class": "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey"
  }
}'
    validate_certs: no
    follow_redirects: yes
    register: login
    return_content: yes
</code></pre></div>
<p dir="auto">Output:</p>
<p dir="auto">In jenkins the credential are stored as</p>
<p dir="auto">-----BEGIN RSA PRIVATE KEY-----<br>
ABCCC cccd fff<br>
-----END RSA PRIVATE KEY-----<br>
It removes the plus(+) sign and added spaces</p>