I am playing with digital_ocean_droplet
and can manage to create one, but fail doing this into any but the default project.
There is a default project named devops_bootcamp
, but I want, for testing purposes, create the droplet into the initial first-project
(which still exists, but is not the default any longer)
---
- hosts: localhost
connection: local
become: false
vars_files:
- ./do_api_token.yml
tasks:
- name: show variable values
ansible.builtin.debug:
msg: |
"drop_name: {{ drop_name }}
project_name: {{ project }}"
- name: Create a new Droplet
community.digitalocean.digital_ocean_droplet:
state: "{{ state }}"
oauth_token: "{{ DO_API_TOKEN }}"
name: "{{ drop_name }}"
size: s-1vcpu-512mb-10gb
region: fra1
image: "{{ distro_image | default('debian-12-x64') }}"
wait_timeout: 500
project_name: "{{ project }}"
ssh_keys: [ 'a5:a3:b9:50:e6:c1:a8:0f:b9:70:6a:d9:56:78:91:d4' ]
register: drop_var
when: state == 'present'
- name: Show Droplet info
ansible.builtin.debug:
var: drop_var
… which I run like
ansible-playbook do_droplet.yml \
-e '{ "state":"present" , "drop_name":"drop-40" , "project":"first-project" }' \
--ask-vault-pass
so, the droplet gets created, but inside the default project "devops-bootcamp"
, not "first-project"
, as intended.
any idea what is wrong here?
I am getting confirmation the variable value is passed into the run correctly by that show variable values
TASK
2023-12-01 13:51:57,618 p=116936 u=dulhaver n=ansible | ok: [127.0.0.1] =>
msg: |-
"drop_name: drop-40
project_name: first-project"