# K8s module with Custom Resource Definition always changed

**URL:** <https://forum.ansible.com/t/k8s-module-with-custom-resource-definition-always-changed/29969>\
**Category:** Ansible Project\
**Tags:** kubernetes\
**Created:** [March 24, 2019, 10:14pm UTC](https://forum.ansible.com/t/k8s-module-with-custom-resource-definition-always-changed/29969 "2019-03-24T22:14:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thms\_Hmm](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Thms\_Hmm](https://forum.ansible.com/u/Thms_Hmm)\
**Post date:** [March 24, 2019, 10:14pm UTC](https://forum.ansible.com/t/k8s-module-with-custom-resource-definition-always-changed/29969/1 "2019-03-24T22:14:24Z")

</div>

Hi,

when I use the k8s module to patch a CRD object the task is always marked as “changed: true” even if there are no changes to the object.

`ok: [localhost] => { "msg": { "changed": true, "diff": [[ "change", "metadata.resourceVersion", [ "124413", "124360"] ] ], "failed": false, "method": "patch", "result": { ... } ...`

From the output you can see that the resourceVersion is responsible for the change.

Any other non CRD objects work just fine. Did anyone experience the same?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Kylix\_Kumar](https://avatars.discourse-cdn.com/v4/letter/k/c37758/32.png) [@Kylix\_Kumar](https://forum.ansible.com/u/Kylix_Kumar)\
**Post date:** [March 24, 2019, 10:52pm UTC](https://forum.ansible.com/t/k8s-module-with-custom-resource-definition-always-changed/29969/2 "2019-03-24T22:52:11Z")

</div>

Hi Chris,

I think, I seen this error. How is your play looks like ? Paste the play or playbook … I will review it and let me know.

Thanks.

Regards,  
kylix3511

[Email : kylix3511@gmail.com](mailto:kylix3511@gmail.com)

---

<div class="post-metadata">

**Author:** ![Thms\_Hmm](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Thms\_Hmm](https://forum.ansible.com/u/Thms_Hmm)\
**Post date:** [March 25, 2019, 6:09pm UTC](https://forum.ansible.com/t/k8s-module-with-custom-resource-definition-always-changed/29969/3 "2019-03-25T18:09:20Z")

</div>

Hi, not Chris but Thomas, anyway, some more information

ansible 2.7.9

openshift-0.8.6

The task:

`

- name: create resource  
k8s:  
host: “{{ k8s\_url }}”  
api\_key: “{{ k8s\_token }}”  
verify\_ssl: no  
definition: “{{ lookup(‘template’, ‘my-cr.yaml’) }}”  
`

The Template:

`apiVersion: someapi.org/v1alpha1 kind: MyCrd metadata: name: example-obj namespace: "myproject" spec: parallelity: 2`

Thanks
