# Ansible create vs. update

**URL:** <https://forum.ansible.com/t/ansible-create-vs-update/28040>\
**Category:** Ansible Developer\
**Created:** [July 12, 2018, 8:50pm UTC](https://forum.ansible.com/t/ansible-create-vs-update/28040 "2018-07-12T20:50:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ying](https://avatars.discourse-cdn.com/v4/letter/y/fbc32d/32.png) [@Ying](https://forum.ansible.com/u/Ying)\
**Post date:** [July 12, 2018, 8:50pm UTC](https://forum.ansible.com/t/ansible-create-vs-update/28040/1 "2018-07-12T20:50:20Z")

</div>

Hi,

I’m writing a custom Ansible module to mange configuration on remote servers. The actions include: create, update and delete.

[playbook]  
port table:  
parameter1:  
parameter2:  
parameter3:

As the playbook above, ‘create’ means removing port table if it exist before adding new port table with parameters1-3. ‘update’ means only update the given parameters 1-3 in port table, while keep other parameters in port table. ‘delete’ means remove the port table.

1. What is the ansible tradition way of handling configuration if it exists? Does it do ‘update’ or ‘create’?
2. How can I present create/update/delete all three actions in the playbook? Ansible “state” parameter has ‘present’ and ‘absent’ choices, where ‘present’ captures both ‘create’ and ‘update’ actions. How do I determine the way of merging new configuration and existing configuration?

Thanks,  
Ying

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [July 12, 2018, 8:58pm UTC](https://forum.ansible.com/t/ansible-create-vs-update/28040/2 "2018-07-12T20:58:08Z")

</div>

1. both  
2. you check if the current is different than expected

In any case, before creating a specific module to handle  
configurations, i recommend using the template module to maintain  
them.
