Ansible create vs. update

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

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.