community.digitalocean
community.digitalocean copied to clipboard
Droplet `project_name` not working
@mamercad Thank you for your quick response! When using
project_name
as documented in https://docs.ansible.com/ansible/latest/collections/community/digitalocean/digital_ocean_droplet_module.html#parameter-project_name - my droplets wind up in my default project, not the specified project. But if I use theproject
alias like in your example, then it works! The droplets wind up in the specified project.(sorry for deleting and reposting this comment - I thought I had gotten things mixed up, misinterpreting the results. But looks like it really is working)
@dschilling No problem; though, I'm perplexed on why this doesn't work. I'll have to dig into that a bit at some point.
Originally posted by @mamercad in https://github.com/ansible-collections/community.digitalocean/issues/201#issuecomment-1124360015
I've reproduced this; using project
works, using project_name
does not (Droplet ended up in the default project).
I bumped into this issue, but I noticed that the problem for me was with project names containing underscores: in that case the droplet would be created in the default project.
Here's a small reproducible code, that also creates the project defined in the variable.
---
- hosts: localhost
connection: local
gather_facts: false
vars:
# project_name: test-project
project_name: test_project
tasks:
- name: Create a new separate project from the default
community.digitalocean.digital_ocean_project:
name: "{{ project_name }}"
state: present
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
description: "This project is a test"
purpose: "Operational/Developer tooling"
environment: "Production"
- name: 'Create a DigitalOcean Droplet'
community.digitalocean.digital_ocean_droplet:
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
name: nodename
project_name: "{{ project_name }}"
state: present
size: s-1vcpu-1gb
image: ubuntu-22-04-x64
region: sfo3