diff --git a/changelogs/fragments/61655-fix-digital-ocean-droplet-create.yaml b/changelogs/fragments/61655-fix-digital-ocean-droplet-create.yaml new file mode 100644 index 0000000000..d1043be8fe --- /dev/null +++ b/changelogs/fragments/61655-fix-digital-ocean-droplet-create.yaml @@ -0,0 +1,2 @@ +bugfixes: + - digital_ocean_droplet - Fix creation of DigitalOcean droplets using digital_ocean_droplet module (https://github.com/ansible/ansible/pull/61655) diff --git a/lib/ansible/modules/cloud/digital_ocean/digital_ocean_droplet.py b/lib/ansible/modules/cloud/digital_ocean/digital_ocean_droplet.py index 743cb4ecda..01c583e3c1 100644 --- a/lib/ansible/modules/cloud/digital_ocean/digital_ocean_droplet.py +++ b/lib/ansible/modules/cloud/digital_ocean/digital_ocean_droplet.py @@ -252,7 +252,9 @@ class DODroplet(object): self.module.exit_json(changed=False, data=droplet_data) if self.module.check_mode: self.module.exit_json(changed=True) - response = self.rest.post('droplets', data=self.module.params) + request_params = dict(self.module.params) + del request_params['id'] + response = self.rest.post('droplets', data=request_params) json_data = response.json if response.status_code >= 400: self.module.fail_json(changed=False, msg=json_data['message'])