Coder Social home page Coder Social logo

ansible-collections / community.digitalocean Goto Github PK

View Code? Open in Web Editor NEW
139.0 11.0 57.0 1.49 MB

This Ansible collection contains modules for assisting in the automation of the DigitalOcean cloud.

Home Page: https://galaxy.ansible.com/community/digitalocean/

License: GNU General Public License v3.0

Python 99.93% Shell 0.07%
hacktoberfest digitalocean ansible-collection

community.digitalocean's Introduction

DigitalOcean Community Collection

coverage black integration sanity unit

This collection contains modules and plugins to assist in automating DigitalOcean infrastructure and API interactions with Ansible.

Included content

Installation and Usage

Requirements

The collection is tested and supported with:

  • ansible-core >= 2.14 (including devel)
  • python >= 3.9

Installing the Collection from Ansible Galaxy

Before using the DigitalOcean collection, you need to install it with the Ansible Galaxy CLI:

ansible-galaxy collection install community.digitalocean

You can also include it in a requirements.yml file and install it via ansible-galaxy collection install -r requirements.yml, using the format:

---
collections:
  - name: community.digitalocean

Using modules from the DigitalOcean Collection in your playbooks

It's preferable to use content in this collection using their Fully Qualified Collection Namespace (FQCN), for example community.digitalocean.digital_ocean_droplet:

---
- hosts: localhost
  gather_facts: false
  connection: local

  vars:
    oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"

  # You can also default the value of a variable for every DO module using module_defaults
  # module_defaults:
  #   group/community.digitalocean.all:
  #     oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"

  tasks:
    - name: Create SSH key
      community.digitalocean.digital_ocean_sshkey:
        oauth_token: "{{ oauth_token }}"
        name: mykey
        ssh_pub_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example"
        state: present
      register: my_ssh_key

    - name: Create a new Droplet
      community.digitalocean.digital_ocean_droplet:
        oauth_token: "{{ oauth_token }}"
        state: present
        name: mydroplet
        unique_name: true
        size: s-1vcpu-1gb
        region: sfo3
        image: ubuntu-20-04-x64
        wait_timeout: 500
        ssh_keys:
          - "{{ my_ssh_key.data.ssh_key.id }}"
      register: my_droplet

    - name: Show Droplet info
      ansible.builtin.debug:
        msg: |
          Droplet ID is {{ my_droplet.data.droplet.id }}
          First Public IPv4 is {{ (my_droplet.data.droplet.networks.v4 | selectattr('type', 'equalto', 'public')).0.ip_address | default('<none>', true) }}
          First Private IPv4 is {{ (my_droplet.data.droplet.networks.v4 | selectattr('type', 'equalto', 'private')).0.ip_address | default('<none>', true) }}

    - name: Tag a resource; creating the tag if it does not exist
      community.digitalocean.digital_ocean_tag:
        oauth_token: "{{ oauth_token }}"
        name: "{{ item }}"
        resource_id: "{{ my_droplet.data.droplet.id }}"
        state: present
      loop:
        - staging
        - dbserver

If upgrading older playbooks which were built prior to Ansible 2.10 and this collection's existence, you can also define collections in your play and refer to this collection's modules as you did in Ansible 2.9 and below, as in this example:

---
- hosts: localhost
  gather_facts: false
  connection: local

  collections:
    - community.digitalocean

  tasks:
    - name: Create ssh key
      digital_ocean_sshkey:
        oauth_token: "{{ oauth_token }}"
        ...

Testing and Development

If you want to develop new content for this collection or improve what's already here, the easiest way to work on the collection is to clone it into one of the configured COLLECTIONS_PATHS, and work on it there.

Alternatively, to develop completely out of ~/src/ansible-dev, one could:

mkdir -p ~/src/ansible-dev
cd ~/src/ansible-dev
python3 -m venv venv
source venv/bin/activate
git clone https://github.com/ansible/ansible.git
pip install --requirement ansible/requirements.txt
pip install kubernetes
source ansible/hacking/env-setup
export ANSIBLE_COLLECTIONS_PATHS="~/src/ansible-dev/ansible_collections"
ansible-galaxy collection install community.digitalocean community.general

This gives us a self-contained environment in ~/src/ansible-dev consisting of Python, Ansible, and this collection (located in ~/src/ansible-dev/ansible_collections/community/digitalocean). This collection requires functionality from community.general, and as such, we install it as well.

If you would like to contribute any changes which you have made to the collection, you will have to push them to your fork. If you do not have a fork yet, you can create one here. Once you have a fork:

cd ~/src/ansible-dev/ansible_collections/community/digitalocean
git remote add origin [email protected]:{your fork organization}/community.digitalocean.git
git checkout -b my-awesome-fixes
git commit -am "My awesome fixes"
git push -u origin my-awesome-fixes

Now, you should be ready to create a Pull Request.

Testing with ansible-test

The tests directory inside the collection root contains configuration for running unit, sanity, and integration tests using ansible-test.

You can run the collection's test suites with the commands:

ansible-test units --venv --python 3.9
ansible-test sanity --venv --python 3.9
ansible-test integration --venv --python 3.9

Replace --venv with --docker if you'd like to use Docker for the testing runtime environment.

Note: To run integration tests, you must add an tests/integration/integration_config.yml file with a valid DigitalOcean API Key (variable do_api_key), AWS Access ID and Secret Key (variables aws_access_key_id and aws_secret_access_key, respectively). The AWS variables are used for the DigitalOcean Spaces and CDN Endpoints integration tests.

Release notes

See the changelog.

Release process

Releases are automatically built and pushed to Ansible Galaxy for any new tag. Before tagging a release, make sure to do the following:

  1. Update galaxy.yml and this README's requirements.yml example with the new version for the collection. Make sure all new modules have references above.
  2. Update the CHANGELOG:
    1. Make sure you have antsibull-changelog installed.
    2. Make sure there are fragments for all known changes in changelogs/fragments.
    3. Run antsibull-changelog release.
    4. Don't forget to add new folks to galaxy.yml.
  3. Commit the changes and create a PR with the changes. Wait for tests to pass, then merge it once they have.
  4. Tag the version in Git and push to GitHub.
    1. Determine the next version (collections follow semver semantics) by listing tags or looking at the releases.
    2. List tags with git tag --list
    3. Create a new tag with git tag 1.2.3
    4. Push tags upstream with git push upstream --tags

After the version is published, verify it exists on the DigitalOcean Collection Galaxy page.

More information

Licensing

GNU General Public License v3.0 or later.

See COPYING to see the full text.

community.digitalocean's People

Contributors

andersson007 avatar coreywright avatar danxg87 avatar dependabot[bot] avatar dmsimard avatar elcfd avatar felixfontein avatar gailane avatar geerlingguy avatar grzs avatar gundalow avatar jdrowell avatar lalvarezguillen avatar lucasbasquerotto avatar magicrobotmonkey avatar mamercad avatar maxtruxa avatar mpontillo avatar mscherer avatar onurguzel avatar port19x avatar radioactive73 avatar raman-babich avatar roaldnefs avatar sgpinkus avatar shuaibmunshi avatar tadeboro avatar tylerauerbeck avatar vitkhab avatar webknjaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

community.digitalocean's Issues

RFE: Snapshot Module

SUMMARY

Currently there is a module to get information about a snapshot, but not to take a snapshot itself. There currently isn't an individual endpoint (at least that I'm aware of) that allows you to create a snapshot. But this functionality does exist on both the block storage and droplet endpoints. It would nice to be able to control/interact with this just like the rest of the modules in this collection

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

digital_ocean_snapshot

ADDITIONAL INFORMATION

N/A

find_matches() got an unexpected keyword argument 'identifier'

SUMMARY

Cannot install collection. find_matches() got an unexpected keyword argument 'identifier'.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.digitalocean

ANSIBLE VERSION
ansible [core 2.11.1] 
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/lousyd/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/lousyd/.local/lib/python3.9/site-packages/ansible
  ansible collection location = /etc/ansible/collections:/home/lousyd/.local/share/ansible/collections:/usr/share/ansible/collections
  executable location = /home/lousyd/.local/bin/ansible
  python version = 3.9.6 (default, Jul 16 2021, 00:00:00) [GCC 11.1.1 20210531 (Red Hat 11.1.1-3)]
  jinja version = 3.0.1
  libyaml = True
COLLECTION VERSION
# /home/lousyd/.local/lib/python3.9/site-packages/ansible_collections
Collection             Version
---------------------- -------
community.digitalocean 1.1.1
CONFIGURATION
ANSIBLE_NOCOWS(/etc/ansible/ansible.cfg) = True
COLLECTIONS_PATHS(/etc/ansible/ansible.cfg) = ['/etc/ansible/collections', '/home/lousyd/.local/share/ansible/collections', '/usr/share/ansible/collections']
DEFAULT_GATHERING(/etc/ansible/ansible.cfg) = implicit
DEFAULT_GATHER_SUBSET(/etc/ansible/ansible.cfg) = ['all', 'network', 'hardware', 'virtual', '!facter', '!ohai']
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/hosts']
DEFAULT_LOAD_CALLBACK_PLUGINS(/etc/ansible/ansible.cfg) = True
DEFAULT_LOG_PATH(/etc/ansible/ansible.cfg) = /var/log/ansible.log
DEFAULT_PRIVATE_KEY_FILE(/etc/ansible/ansible.cfg) = /etc/ansible/CB-Prod.pem
DEFAULT_REMOTE_USER(/etc/ansible/ansible.cfg) = ansible
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = ['/etc/ansible/roles', '/usr/share/ansible/roles']
DEFAULT_SELINUX_SPECIAL_FS(/etc/ansible/ansible.cfg) = ['nfs', 'vboxsf', 'fuse', 'ramfs', '9p', 'vfat']
DEFAULT_STDOUT_CALLBACK(/etc/ansible/ansible.cfg) = default
DEFAULT_VAULT_PASSWORD_FILE(/etc/ansible/ansible.cfg) = /usr/bin/pass
INJECT_FACTS_AS_VARS(/etc/ansible/ansible.cfg) = True
INTERPRETER_PYTHON(/etc/ansible/ansible.cfg) = auto_silent
INVENTORY_ENABLED(/etc/ansible/ansible.cfg) = ['host_list', 'yaml', 'script', 'gcp_compute']
LOCALHOST_WARNING(/etc/ansible/ansible.cfg) = False
RETRY_FILES_ENABLED(/etc/ansible/ansible.cfg) = False
SHOW_CUSTOM_STATS(/etc/ansible/ansible.cfg) = True
TRANSFORM_INVALID_GROUP_CHARS(/etc/ansible/ansible.cfg) = silently

OS / ENVIRONMENT

Fedora Linux 34

STEPS TO REPRODUCE
ansible-galaxy collection install community.digitalocean -vvvv
EXPECTED RESULTS

Expected success.

ACTUAL RESULTS
❯ ansible-galaxy collection install community.digitalocean -vvvv
ansible-galaxy [core 2.11.1] 
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/lousyd/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/lousyd/.local/lib/python3.9/site-packages/ansible
  ansible collection location = /etc/ansible/collections:/home/lousyd/.local/share/ansible/collections:/usr/share/ansible/collections
  executable location = /home/lousyd/.local/bin/ansible-galaxy
  python version = 3.9.6 (default, Jul 16 2021, 00:00:00) [GCC 11.1.1 20210531 (Red Hat 11.1.1-3)]
  jinja version = 3.0.1
  libyaml = True
Using /etc/ansible/ansible.cfg as config file
Starting galaxy collection install process
Process install dependency map
ERROR! Unexpected Exception, this is probably a bug: find_matches() got an unexpected keyword argument 'identifier'
the full traceback was:

Traceback (most recent call last):
  File "/home/lousyd/.local/bin/ansible-galaxy", line 135, in <module>
    exit_code = cli.run()
  File "/home/lousyd/.local/lib/python3.9/site-packages/ansible/cli/galaxy.py", line 552, in run
    return context.CLIARGS['func']()
  File "/home/lousyd/.local/lib/python3.9/site-packages/ansible/cli/galaxy.py", line 75, in method_wrapper
    return wrapped_method(*args, **kwargs)
  File "/home/lousyd/.local/lib/python3.9/site-packages/ansible/cli/galaxy.py", line 1186, in execute_install
    self._execute_install_collection(
  File "/home/lousyd/.local/lib/python3.9/site-packages/ansible/cli/galaxy.py", line 1213, in _execute_install_collection
    install_collections(
  File "/home/lousyd/.local/lib/python3.9/site-packages/ansible/galaxy/collection/__init__.py", line 511, in install_collections
    dependency_map = _resolve_depenency_map(
  File "/home/lousyd/.local/lib/python3.9/site-packages/ansible/galaxy/collection/__init__.py", line 1328, in _resolve_depenency_map
    return collection_dep_resolver.resolve(
  File "/home/lousyd/.local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 473, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/lousyd/.local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 341, in resolve
    name, crit = self._merge_into_criterion(r, parent=None)
  File "/home/lousyd/.local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 147, in _merge_into_criterion
    matches = self._p.find_matches(
TypeError: find_matches() got an unexpected keyword argument 'identifier'

Droplet "wait" enhancements

This line could lead to a ValueError in the event of clock skew. (admittedly somewhat unlikely, but you never know on a busy machine.) For example:

>>> time.sleep(-1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: sleep length must be non-negative

I think you should just remove the subtraction here to keep it simple. It doesn't have to be exact. (maybe document that it isn't exact if you're concerned.)
Also maybe increase the sleep to 10 seconds; hitting the API every two seconds for two minutes seems a little excessive.

Originally posted by @mpontillo in #32 (comment)

Setup community.digitalocean

After the collection is live, we can add integration tests (via ansible-core-ci) with Shippable once we have credentials

Integration Tests: Floating IP tracebacks

SUMMARY

Floating IP integration tests are failing; example traceback below.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • digital_ocean_floating_ip
COLLECTION VERSION
1.8.0
EXPECTED RESULTS

Passing integration tests.

ACTUAL RESULTS
TASK [digital_ocean_floating_ip : Create a Floating IP] ************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'message'
fatal: [testhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1626245512.3870752-2039-239766022150563/AnsiballZ_digital_ocean_floating_ip.py\", line 141, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1626245512.3870752-2039-239766022150563/AnsiballZ_digital_ocean_floating_ip.py\", line 133, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1626245512.3870752-2039-239766022150563/AnsiballZ_digital_ocean_floating_ip.py\", line 81, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.community.digitalocean.plugins.modules.digital_ocean_floating_ip', init_globals=dict(_module_fqn='ansible_collections.community.digitalocean.plugins.modules.digital_ocean_floating_ip', _modlib_path=modlib_path),\n  File \"/usr/lib/python3.8/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 95, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_community.digitalocean.digital_ocean_floating_ip_payload_zqv6ebwl/ansible_community.digitalocean.digital_ocean_floating_ip_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_floating_ip.py\", line 349, in <module>\n  File \"/tmp/ansible_community.digitalocean.digital_ocean_floating_ip_payload_zqv6ebwl/ansible_community.digitalocean.digital_ocean_floating_ip_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_floating_ip.py\", line 345, in main\n  File \"/tmp/ansible_community.digitalocean.digital_ocean_floating_ip_payload_zqv6ebwl/ansible_community.digitalocean.digital_ocean_floating_ip_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_floating_ip.py\", line 223, in core\n  File \"/tmp/ansible_community.digitalocean.digital_ocean_floating_ip_payload_zqv6ebwl/ansible_community.digitalocean.digital_ocean_floating_ip_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_floating_ip.py\", line 318, in create_floating_ips\nKeyError: 'message'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

TASK [digital_ocean_floating_ip : Delete the Floating IP] **********************
fatal: [testhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'data'\n\nThe error appears to be in '/root/ansible_collections/community/digitalocean/tests/output/.tmp/integration/digital_ocean_floating_ip-cafxvo5y-ÅÑŚÌβŁÈ/tests/integration/targets/digital_ocean_floating_ip/tasks/main.yml': line 61, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: \"Delete the Floating IP\"\n      ^ here\n"}

PLAY RECAP *********************************************************************
testhost                   : ok=3    changed=0    unreachable=0    failed=2    skipped=1    rescued=0    ignored=0 

digital_ocean_domain is not idempotent

SUMMARY

digital_ocean_domain is not idempotent. I created the domain fine, but on a 2nd run, it fail with a error message, and from a quick code reading, seems to be caused by the fact I added a domain without adding a IP or anything.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

digital_ocean_domain

ANSIBLE VERSION
 $ ansible --version
ansible 2.9.9
  config file = /home/misc/.ansible.cfg
  configured module search path = [u'/home/misc/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Sep 26 2019, 13:23:47) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
---
- name: Add the domain in DO
  digital_ocean_domain:
    state: present
    name: do.example.org
    oauth_token: "{{ digital_ocean_token }}"
EXPECTED RESULTS

Not fail

ACTUAL RESULTS

Fail with a traceback:

The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_digital_ocean_domain_payload_998_9rik/ansible_digital_ocean_domain_payload.zip/ansible/modules/cloud/digital_ocean/digital_ocean_domain.py", line 214, in main
  File "/tmp/ansible_digital_ocean_domain_payload_998_9rik/ansible_digital_ocean_domain_payload.zip/ansible/modules/cloud/digital_ocean/digital_ocean_domain.py", line 176, in core
  File "/tmp/ansible_digital_ocean_domain_payload_998_9rik/ansible_digital_ocean_domain_payload.zip/ansible/modules/cloud/digital_ocean/digital_ocean_domain.py", line 153, in create_domain_record
KeyError: 'domain_record'
fatal: [bastion.example.org]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "id": null,
            "ip": null,
            "name": "do.example.org",
            "oauth_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "state": "present",
            "timeout": 30,
            "validate_certs": true
        }
    },
    "msg": "'domain_record'"
}

Update README.md to include tagging command

SUMMARY

README doesn't specify the tagging command -- having that would make the release process a little more clear/less prone to running a diff command/tag format.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION

CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS

Integration tests are failing

SUMMARY

Multiple integration tests are failing, investigate and fix them.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • digital_ocean_certificate
  • digital_ocean_firewall
  • digital_ocean_tag
  • digital_ocean_kubernetes

Wrong version in README.md

SUMMARY

The README.md for 1.1.0 (and main) shows 1.0.0, which is wrong.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • digitalocean
EXPECTED RESULTS

The current version should be shown.

ACTUAL RESULTS

The previous version is shown.

Floating IP failing with KeyError

I have simplified my playbook down to one task with hardcoded params:

- name: DO VM Setup
  hosts: localhost
  connection: local
  vars_files:
    - ../environment/group_vars/all/all.yml

  tasks:
    - name: Create a new floating IP for this domain if there is not one already
      digital_ocean_floating_ip:
        droplet_id: "254918204"
        state: present
        oauth_token: "{{ do_oauth_token }}"

This playbook fails with the following error:

MSG:

MODULE FAILURE
See stdout/stderr for the exact error


MODULE_STDERR:

Traceback (most recent call last):
  File "/home/rundeck/.ansible/tmp/ansible-tmp-1626321992.102645-25158-220044443395692/AnsiballZ_digital_ocean_floating_ip.py", line 102, in <module>
    _ansiballz_main()
  File "/home/rundeck/.ansible/tmp/ansible-tmp-1626321992.102645-25158-220044443395692/AnsiballZ_digital_ocean_floating_ip.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/rundeck/.ansible/tmp/ansible-tmp-1626321992.102645-25158-220044443395692/AnsiballZ_digital_ocean_floating_ip.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.community.digitalocean.plugins.modules.digital_ocean_floating_ip', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.6/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_digital_ocean_floating_ip_payload_4fdpcyul/ansible_digital_ocean_floating_ip_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_floating_ip.py", line 311, in <module>
  File "/tmp/ansible_digital_ocean_floating_ip_payload_4fdpcyul/ansible_digital_ocean_floating_ip_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_floating_ip.py", line 307, in main
  File "/tmp/ansible_digital_ocean_floating_ip_payload_4fdpcyul/ansible_digital_ocean_floating_ip_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_floating_ip.py", line 206, in core
  File "/tmp/ansible_digital_ocean_floating_ip_payload_4fdpcyul/ansible_digital_ocean_floating_ip_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_floating_ip.py", line 280, in create_floating_ips
KeyError: 'message'

After running into this error, I checked the DO dashboard, and the floating IP is in fact created.

This was in US-East-3 at this time of day. There are no active issues at https://status.digitalocean.com.

rundeck@2acb524ea9be:~/5c94c046-61d4-4351-96dc-e253db2fe138-84732$ ansible --version
ansible 2.10.10
  config file = /home/rundeck/5c94c046-61d4-4351-96dc-e253db2fe138-84732/ansible.cfg
  configured module search path = ['/home/rundeck/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]

I exploded the module and printed the:

  1. status_code: 200
  2. json_data:
{'floating_ip': {'ip': '45.55.99.174', 'droplet': None, 'region': {'name': 'New York 3', 'slug': 'nyc3', 'features': ['backups', 'ipv6', 'metadata', 'install_agent', 'storage', 'image_transfer'], 'available': True, 'sizes': ['s-1vcpu-1gb', 's-1vcpu-1gb-amd', 's-1vcpu-1gb-intel', 's-1vcpu-2gb', 's-1vcpu-2gb-amd', 's-1vcpu-2gb-intel', 's-2vcpu-2gb', 's-2vcpu-2gb-amd', 's-2vcpu-2gb-intel', 's-2vcpu-4gb', 's-2vcpu-4gb-amd', 's-2vcpu-4gb-intel', 's-4vcpu-8gb', 'c-2', 'c2-2vcpu-4gb', 's-4vcpu-8gb-amd', 's-4vcpu-8gb-intel', 'g-2vcpu-8gb', 'gd-2vcpu-8gb', 's-8vcpu-16gb', 'm-2vcpu-16gb', 'c-4', 'c2-4vcpu-8gb', 's-8vcpu-16gb-amd', 's-8vcpu-16gb-intel', 'm3-2vcpu-16gb', 'g-4vcpu-16gb', 'so-2vcpu-16gb', 'm6-2vcpu-16gb', 'gd-4vcpu-16gb', 'so1_5-2vcpu-16gb', 'm-4vcpu-32gb', 'c-8', 'c2-8vcpu-16gb', 'm3-4vcpu-32gb', 'g-8vcpu-32gb', 'so-4vcpu-32gb', 'm6-4vcpu-32gb', 'gd-8vcpu-32gb', 'so1_5-4vcpu-32gb', 'm-8vcpu-64gb', 'c-16', 'c2-16vcpu-32gb', 'm3-8vcpu-64gb', 'g-16vcpu-64gb', 'so-8vcpu-64gb', 'm6-8vcpu-64gb', 'gd-16vcpu-64gb', 'so1_5-8vcpu-64gb', 'm-16vcpu-128gb', 'c-32', 'c2-32vcpu-64gb', 'm3-16vcpu-128gb', 'm-24vcpu-192gb', 'g-32vcpu-128gb', 'so-16vcpu-128gb', 'm6-16vcpu-128gb', 'gd-32vcpu-128gb', 'm3-24vcpu-192gb', 'g-40vcpu-160gb', 'so1_5-16vcpu-128gb', 'gd-40vcpu-160gb', 'so-24vcpu-192gb', 'm6-24vcpu-192gb', 'so1_5-24vcpu-192gb']}, 'locked': True}, 'links': {}}

So it looks like it's erroring out despite returning a 200. This seems to be because json_data['floating_ip']['droplet'] is returning None. However, it looks like it is getting assigned to the droplet appropriately.

Additionally, when I re-run the playbook, it comes back "OK", with the correct information. Is seems like the API is not returning the droplet info either fast enough, or at all when the floating IP is being created. Therefore, https://github.com/ansible-collections/community.digitalocean/blob/main/plugins/modules/digital_ocean_floating_ip.py#L301 returns false, and continues on to the else: statement in https://github.com/ansible-collections/community.digitalocean/blob/main/plugins/modules/digital_ocean_floating_ip.py#L316-L318.

digital_ocean_droplet state doesn't set state to inactive on initial creation

SUMMARY

The digital_ocean_droplet module does not appropriately set the state to inactive on initial creation (i.e. if you try to create a droplet that doesn't already exist and set state to inactive, you will actually receive a droplet that is powered on)

ISSUE TYPE
  • Bug Report
COMPONENT NAME

digital_ocean_droplet

ANSIBLE VERSION
╰─ ansible --version
ansible 2.9.20
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/tyler/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.9.4 (default, Apr  6 2021, 00:00:00) [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
CONFIGURATION

OS / ENVIRONMENT
NAME=Fedora
VERSION="34 (Workstation Edition)"
ID=fedora
VERSION_ID=34
VERSION_CODENAME=""
PLATFORM_ID="platform:f34"
PRETTY_NAME="Fedora 34 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:34"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/34/system-administrators-guide/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=34
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=34
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Workstation Edition"
VARIANT_ID=workstation
STEPS TO REPRODUCE

Create a droplet that doesn't exist with an initial state of inactive and you will receive a droplet that is actually powered on

---
- hosts: localhost
  tasks:
    - community.digitalocean.digital_ocean_droplet:
        state: inactive
        name: "my-test-1"
        unique_name: true
        size: s-1vcpu-1gb
        region: nyc1
        image: ubuntu-16-04-x64
        wait_timeout: 500
      register: result

    - debug:
        msg: "{{ result }}"
EXPECTED RESULTS

I expect to receive a droplet that is powered off.

ACTUAL RESULTS

I receive a droplet that is powered on.


digital_ocean_firewall - no idempotence

SUMMARY

I have just applied a very simple firewall rule, basically from the sample documentation. When re-executing the playbook I keep getting changed result from the task.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.digitalocean.digital_ocean_firewall

ANSIBLE VERSION
ansible [core 2.11.1] 
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/nickep/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /home/nickep/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.5 (default, May 24 2021, 12:50:35) [GCC 11.1.0]
  jinja version = 3.0.1
  libyaml = True

COLLECTION VERSION
# /home/user/.ansible/collections/ansible_collections
Collection             Version
---------------------- -------
community.digitalocean 1.7.0  


CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
    - name: Create a Firewall named my-firewall
      community.digitalocean.digital_ocean_firewall:
        name: my-firewall
        state: present
        oauth_token: "{{ digital_ocean_token }}"
        inbound_rules:
          - protocol: "tcp"
            ports: "22"
            sources:
              addresses: "my ip in the correct format"

          - protocol: "tcp"
            ports: "80"
            sources:
              addresses: ["0.0.0.0/0", "::/0"]

          - protocol: "tcp"
            ports: "443"
            sources:
              addresses: ["0.0.0.0/0", "::/0"]

        outbound_rules:
          - protocol: "tcp"
            ports: "1-65535"
            destinations:
              addresses: ["0.0.0.0/0", "::/0"]

          - protocol: "udp"
            ports: "1-65535"
            destinations:
              addresses: ["0.0.0.0/0", "::/0"]

          - protocol: "icmp"
            ports: "1-65535"
            destinations:
              addresses: ["0.0.0.0/0", "::/0"]
        droplet_ids: "{{ my_droplet.data.droplet.id }}"


EXPECTED RESULTS

Getting the text "OK" instead of change on consecutive re executing of the task.

ACTUAL RESULTS

TASK [Create a Firewall named my-firewall] ***************************************************************************************************************
changed: [localhost] => {"changed": true, "data": {"created_at": "2021-06-30T20:56:12Z", "droplet_ids": [251993461], "id": "292a359d-303c-49a8-897b-0b4149aa43f6", "inbound_rules": [{"ports": "22", "protocol": "tcp", "sources": {"addresses": ["62.63.220.246"]}}, {"ports": "80", "protocol": "tcp", "sources": {"addresses": ["0.0.0.0/0", "::/0"]}}, {"ports": "443", "protocol": "tcp", "sources": {"addresses": ["0.0.0.0/0", "::/0"]}}], "name": "my-firewall", "outbound_rules": [{"destinations": {"addresses": ["0.0.0.0/0", "::/0"]}, "ports": "1-65535", "protocol": "icmp"}, {"destinations": {"addresses": ["0.0.0.0/0", "::/0"]}, "ports": "1-65535", "protocol": "tcp"}, {"destinations": {"addresses": ["0.0.0.0/0", "::/0"]}, "ports": "1-65535", "protocol": "udp"}], "pending_changes": [], "status": "succeeded", "tags": []}}

hanged: [localhost] => {
"changed": true,
"data": {
"created_at": "2021-06-30T20:34:49Z",
"droplet_ids": [
251993461
],
"id": "ae037cd2-6a64-4138-b902-e567054c8893",
"inbound_rules": [
{
"ports": "22",
"protocol": "tcp",
"sources": {
"addresses": [
"62.63.220.246"
]
}
},
{
"ports": "80",
"protocol": "tcp",
"sources": {
"addresses": [
"0.0.0.0/0",
"::/0"
]
}
},
{
"ports": "443",
"protocol": "tcp",
"sources": {
"addresses": [
"0.0.0.0/0",
"::/0"
]
}
}
],
"name": "my-firewall",
"outbound_rules": [
{
"destinations": {
"addresses": [
"0.0.0.0/0",
"::/0"
]
},
"ports": "1-65535",
"protocol": "icmp"
},
{
"destinations": {
"addresses": [
"0.0.0.0/0",
"::/0"
]
},
"ports": "1-65535",
"protocol": "tcp"
},
{
"destinations": {
"addresses": [
"0.0.0.0/0",
"::/0"
]
},
"ports": "1-65535",
"protocol": "udp"
}
],
"pending_changes": [],
"status": "succeeded",
"tags": []
},
"invocation": {
"module_args": {
"droplet_ids": [
"251993461"
],
"inbound_rules": [
{
"ports": "22",
"protocol": "tcp",
"sources": {
"addresses": [
"62.63.220.246"
],
"droplet_ids": [],
"load_balancer_uids": [],
"tags": []
}
},
{
"ports": "80",
"protocol": "tcp",
"sources": {
"addresses": [
"0.0.0.0/0",
"::/0"
],
"droplet_ids": [],
"load_balancer_uids": [],
"tags": []
}
},
{
"ports": "443",
"protocol": "tcp",
"sources": {
"addresses": [
"0.0.0.0/0",
"::/0"
],
"droplet_ids": [],
"load_balancer_uids": [],
"tags": []
}
}
],
"name": "my-firewall",
"oauth_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"outbound_rules": [
{
"destinations": {
"addresses": [
"0.0.0.0/0",
"::/0"
],
"droplet_ids": [],
"load_balancer_uids": [],
"tags": []
},
"ports": "1-65535",
"protocol": "tcp"
},
{
"destinations": {
"addresses": [
"0.0.0.0/0",
"::/0"
],
"droplet_ids": [],
"load_balancer_uids": [],
"tags": []
},
"ports": "1-65535",
"protocol": "udp"
},
{
"destinations": {
"addresses": [
"0.0.0.0/0",
"::/0"
],
"droplet_ids": [],
"load_balancer_uids": [],
"tags": []
},
"ports": "1-65535",
"protocol": "icmp"
}
],
"state": "present",
"tags": null,
"timeout": 30,
"validate_certs": true
}
}
}


Traceback on invalid SSH key in digital_ocean_sshkey

SUMMARY

In looking through the integration tests, I noticed a traceback when creating an invalid SSH key.

TASK [digital_ocean_sshkey : Create an invalid SSH key] ************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: IndexError: list index out of range
fatal: [testhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1618943706.106942-1819-173224235158984/AnsiballZ_digital_ocean_sshkey.py\", line 143, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1618943706.106942-1819-173224235158984/AnsiballZ_digital_ocean_sshkey.py\", line 135, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1618943706.106942-1819-173224235158984/AnsiballZ_digital_ocean_sshkey.py\", line 81, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.community.digitalocean.plugins.modules.digital_ocean_sshkey', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python3.8/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 95, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_community.digitalocean.digital_ocean_sshkey_payload_rdwn4ua1/ansible_community.digitalocean.digital_ocean_sshkey_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_sshkey.py\", line 273, in <module>\n  File \"/tmp/ansible_community.digitalocean.digital_ocean_sshkey_payload_rdwn4ua1/ansible_community.digitalocean.digital_ocean_sshkey_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_sshkey.py\", line 269, in main\n  File \"/tmp/ansible_community.digitalocean.digital_ocean_sshkey_payload_rdwn4ua1/ansible_community.digitalocean.digital_ocean_sshkey_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_sshkey.py\", line 175, in core\n  File \"/tmp/ansible_community.digitalocean.digital_ocean_sshkey_payload_rdwn4ua1/ansible_community.digitalocean.digital_ocean_sshkey_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_sshkey.py\", line 242, in ssh_key_fingerprint\nIndexError: list index out of range\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
...ignoring
ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • digital_ocean_sshkey
ANSIBLE VERSION
ansible 2.10.6
  config file = /Users/mmercado/.ansible.cfg
  configured module search path = ['/Users/mmercado/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/mmercado/.pyenv/versions/3.8.5/lib/python3.8/site-packages/ansible
  executable location = /Users/mmercado/.pyenv/versions/3.8.5/bin/ansible
  python version = 3.8.5 (default, Sep 29 2020, 11:04:46) [Clang 12.0.0 (clang-1200.0.31.1)]
CONFIGURATION
N/A
STEPS TO REPRODUCE

The traceback is visible in the output of the integration test, I'm sure it could be reproduced locally as well.

EXPECTED RESULTS

It would be nice to let the user know that the SSH key isn't valid, and, not have an exception.

ACTUAL RESULTS

Traceback.

Deleting tags is not idempotent

SUMMARY

Deleting tags is not idempotent, the play shows as "changed" when it does not change anything.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • digital_ocean_tag
ANSIBLE VERSION
ansible 2.10.8
  config file = /Users/mark/.ansible.cfg
  configured module search path = ['/Users/mark/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/mark/.pyenv/versions/3.8.8/lib/python3.8/site-packages/ansible
  executable location = /Users/mark/.pyenv/versions/3.8.8/bin/ansible
  python version = 3.8.8 (default, Apr 12 2021, 20:17:20) [Clang 12.0.0 (clang-1200.0.32.28)]
CONFIGURATION
DEFAULT_CALLBACK_WHITELIST(/Users/mark/.ansible.cfg) = ['timer', 'profile_tasks']
DEFAULT_STDOUT_CALLBACK(/Users/mark/.ansible.cfg) = yaml
DIFF_ALWAYS(/Users/mark/.ansible.cfg) = True
OS / ENVIRONMENT

N/A

STEPS TO REPRODUCE
---
- hosts: localhost
  connection: local
  gather_facts: no
  become: no

  tasks:

    - name: Delete tag
      community.digitalocean.digital_ocean_tag:
        name: my_tag
        state: absent
      register: delete_tag
EXPECTED RESULTS

Since the tag doesn't exist (verified), it should not show "changed" when removing it.

ACTUAL RESULTS
TASK [Delete tag] ***********************************************************************************************************
Saturday 17 April 2021  10:04:28 -0400 (0:00:00.074)       0:00:00.074 ******** 
changed: [localhost] => changed=true

PLAY RECAP ******************************************************************************************************************
localhost                  : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Droplet tags with "dashes" are being replaced by "underscores" in DO ansible dynamic inventory

SUMMARY

Hi,
I am using digitalocean dynamic inventory plugin and I want to split my droplets with tags. These tags are for example "postgres-master" or "postgres-slave", so my ansible playbooks are created with these selectors.

When i am using dynamic inventory and I split my hosts by tags (using this configuration)

---
plugin: community.digitalocean.digitalocean
attributes:
  - name
  - networks
  - tags
  - region
keyed_groups:
  - key: do_tags | lower
    prefix: ''
    separator: ''
replace_dash_in_groups: False
compose:
  ansible_host: do_networks.v4 | selectattr('type','eq','public')
    | map(attribute='ip_address') | first
filters:
  - '"QA" in do_tags'
  - 'do_region.slug == "fra1"'
  - '"es" in do_tags'

i cannot see "postgres-master" tag, it is replaced by "postgres_master". So, dashes are being replaced by "_" when I retrieve my inventory from DO.

I need to use "dashes". Are there any feature to do that?

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.digitalocean.digitalocean – DigitalOcean Inventory Plugin

ANSIBLE VERSION
ansible [core 2.11.0] 
  config file = None
  configured module search path = ['/home/dfradejas/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/dfradejas/.local/lib/python3.9/site-packages/ansible
  ansible collection location = /home/dfradejas/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/dfradejas/.local/bin/ansible
  python version = 3.9.6 (default, Jul 16 2021, 00:00:00) [GCC 11.1.1 20210531 (Red Hat 11.1.1-3)]
  jinja version = 3.0.1
  libyaml = True
COLLECTION VERSION
# /home/dfradejas/.local/lib/python3.9/site-packages/ansible_collections
Collection             Version
---------------------- -------
community.digitalocean 1.1.1  

# /home/dfradejas/.ansible/collections/ansible_collections
Collection             Version
---------------------- -------
community.digitalocean 1.7.0
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
  • Create droplet with "postgres-master" tag.
  • Configure do_hosts.yml file (explained in summary)
  • Retrieve inventory ansible-inventory -i do_hosts.yml --list
EXPECTED RESULTS

I expect to get "postgres-master" host group and not "postgres_master"

ACTUAL RESULTS

Droplet tags:
image
Command results:

$ ansible-inventory -i do_hosts.yml --list
{
    "all": {
        "children": [
            "es",
            "postgres_master",
            "qa",
            "ungrouped"
        ]
    },
    "es": {
        "hosts": [
            "activemq"
        ]
    },
    "postgres_master": {
        "hosts": [
            "activemq"
        ]
    },
    "qa": {
        "hosts": [
            "activemq"
        ]
    }
}

RFE: Add multi-stage (dev/stage/prod) environment support to DigitalOcean dynamic inventory

From @jmooo on Jul 09, 2019 00:09

SUMMARY

Dealing with multi-stage environments is difficult with the digital_ocean.py dynamic inventory since it always returns all droplets on your account. Adding an option to digital_ocean.ini that allows you to specify tags and returns only servers with those tags would alleviate the problem. ie:

required_tags: environment_prod

Then the returned JSON will only include droplets which carry the tag environment_prod

This feature exists in the ec2.py inventory in the form of filters, I believe GCP and Azure have something similar as well

It's something I wouldn't mind working on myself...but the way the DigitalOcean API returns results and tag groups I'm not even entirely sure how to go about it, so ideas would be very welcome.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

DigitalOcean dynamic inventory

Copied from original issue: ansible/ansible#58843

RFE: List current droplets in DO account

SUMMARY

First, thanks for this collection. Trying to get into it a bit :) It does not appear possible to retrieve a list of droplets. I'm wondering if I've missed something, or if this is a feature gap, or something that's in progress. It seems like a fairly basic operation that should be possible, which is why I doubt myself :)

DO API: https://developers.digitalocean.com/documentation/v2/#list-all-droplets

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

digital_ocean_droplet

ADDITIONAL INFORMATION

Essentially, getting a list of droplets would allow operations to be run on all current, or a subset by tag/etc, of droplets, without needing to keep an inventory of droplet IDs.

Forgive me if this isn't a good idea - still getting used to Ansible :)

N/A

Question about community.digitalocean.digital_ocean_droplet and wait (to get IP)

SUMMARY
    - name: Create a new droplets
      register: droplets_data
      community.digitalocean.digital_ocean_droplet:
        state: present
        wait: yes
        name: "{{ item.name }}"
        unique_name: yes # "yes" makes it idempotent
        wait_timeout: 500
        # oauth_token: "{{ do_api_key }}" # use DO_API_TOKEN env var
        size: s-1vcpu-1gb # cheapest
        region: ams3
        image: docker-20-04
        ssh_keys:
          - "{{ do_ssh_key.data.0.id }}"
      with_items:
        - name: as-a-code-homework-01
        - name: as-a-code-homework-02

Hello, i use wait in my tasks to get IP address but it always return response immediately, so registered variable does not have ip of droplet.
How to get ip address from creating droplet tasks?

ISSUE TYPE
  • Documentation Report
COMPONENT NAME

module community.digitalocean.digital_ocean_droplet

ANSIBLE VERSION
ansible --version
ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/feycot/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, May 27 2021, 13:30:53) [GCC 9.3.0]

Digital Ocean Domain Records

From @chrispolley on Feb 02, 2018 19:29

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

digital_ocean_domain

ANSIBLE VERSION

I'm running

ansible 2.4.3.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/admin/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]

but plan to develop against a branch of a fork of ansible/devel

CONFIGURATION

No changes from apt-get install

OS / ENVIRONMENT

N/A

SUMMARY

I'm wondering if anyone is working on support for Digital Ocean Domain Records -- see the v2 API for the spec. The digital_ocean_domain module seems only to be able to add/remove domains, while implementing a workflow that installs and configures droplets to have specific roles in an infrastructure would require also DNS changes (e.g. adding/removing A, AAAA, CNAME, MX, etc records)

The description for digital_ocean_domain states that it will "Create/delete a DNS record in DigitalOcean" however perhaps a more accurate description is that it will "Create/delete a DNS domain in DigitalOcean". It has the edit_domain_record method but it appears that this is used only to insert an initial "A" record into the domain. It is not tooled to add/remove/edit other types of records.

Question: Should this functionality be written in a new module digital_ocean_domain_record or should the digital_ocean_domain module be extended to add this functionality? In my opinion it seems that isolating functionality along the same way the DO API organizes it would be best, if for no other reason than to maintain parallelism with the API and reduce the learning curve for people familiar with it (as well as to leverage the documentation).

My ultimate goal is to write a playbook that will install, configure and activate services (possibly provisioning a droplet) based on tags specified, and to re/deconfigure a droplet based on tags assigned (or removed) using DO API/control panel/etc. This would include inserting DNS records (such as adding a MX record for a droplet tagged with the mail-server tag).

Thanks!

Copied from original issue: ansible/ansible#35669

Ansible 2.10.0 and 1.0.0 before 2020-08-18

SUMMARY

Related: ansible-collections/community.grafana#111

The 2020-08-18 date is of particular importance. This means that by that day, you MUST have released 1.0.0 for it to appear in Ansible 2.10. If you only have a 0.x.y release by then, we will not automatically include a newer version since according to semver, anything can happen and no stability guarantees are made. So please make sure that you released 1.0.0 by then.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

collection

ADDITIONAL INFORMATION

We will need to resolve #1 first, then make sure this collection is stable, and then tag a 1.0.0 release.

digital_ocean_floating_ip is not idempotent

From @jackivanov on Oct 06, 2019 13:11

SUMMARY

digital_ocean_floating_ip is not idempotent, this is important.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

digital_ocean_floating_ip

ANSIBLE VERSION
ansible 2.8.3
  config file = /Users/XXX/XXX/ansible.cfg
  configured module search path = ['/Users/XXX/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/XXX/XXX/.env/lib/python3.7/site-packages/ansible
  executable location = /Users/XXX/XXX/.env/bin/ansible
  python version = 3.7.4 (default, Jul  9 2019, 18:13:23) [Clang 10.0.1 (clang-1001.0.46.4)]
STEPS TO REPRODUCE
  1. Run the tasks below. Droplet gets created with a Floating IP assigned.
  2. Run the tasks once again, the playbook fails on the second step.
- name: "Creating a droplet..."
  digital_ocean_droplet:
    state: present
    name: "{{ name }}"
    oauth_token: "{{ token }}"
    size: "{{ size }}"
    region: "{{ egion }}"
    image: "{{ image }}"
    wait_timeout: 300
    unique_name: true
    ipv6: true
    ssh_keys: "{{ ssh_key }}"
  register: digital_ocean_droplet

- name: "Create a Floating IP"
  digital_ocean_floating_ip:
    state: present
    oauth_token: "{{ token }}"
    droplet_id: "{{ digital_ocean_droplet.data.droplet.id }}"
  register: digital_ocean_floating_ip
EXPECTED RESULTS

Ansible detects that a Floating IP is already assigned to the droplet and returns success with the data included.

ACTUAL RESULTS
TASK [cloud-digitalocean : Create a Floating IP] ***********************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error creating floating ip [422: Droplet is already assigned to another floating IP.]", "region": null}

Copied from original issue: ansible/ansible#63175

digital_ocean_droplet support resizing

From @jaschaio on Dec 13, 2019 12:35

SUMMARY

Similar to #65623 it would be awesome if the digital_ocean_droplet module would support resizing of Droplets.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

digital_ocean_droplet

ADDITIONAL INFORMATION

Currently the module only checks if a Droplet exists with the given name. It would be awesome if the module would check additionally if the given droplet has as well the same size as defined in the playbook. If it doesn't it could poweroff the droplet and resize it accordingly.

# Resize if droplet exists but block_size is different
-  digital_ocean_droplet:
    state: present
    name: 'example_droplet'
    unique_name: yes # makes it indempotent
    oauth_token: '{{ digitalocean_token }}'
    size: s-1vcpu-1gb # If this value changes, resize the droplet
    region: 'ams3'
    image: ubuntu-18-04-x64

Copied from original issue: ansible/ansible#65806

Add active/inactive states to Droplet integration test

SUMMARY

This feature PR adds "active" and "inactive" as possible states, we should have coverage for these in the Droplet integration test as well.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • tests/integration/targets/digital_ocean_droplet

Get DigitalOcean credentials/integration so we can run integration tests

SUMMARY

All the existing integration tests (and pretty much all functionality for these modules) requires a valid DigitalOcean subscription to be able to test with.

It would be great if we could figure out some way of getting a test/community account set up so we could build and tear down test infrastructure in DigitalOcean, though one major concern would be making sure all resources are always torn down even when test runs fail or throw exceptions.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

Integration tests

ADDITIONAL INFORMATION

(Created after @felixfontein noticed in #1 that the tests were never actually run in shippable in ansible/ansible, either.)

MongoDB missing from community.digitalocean.digital_ocean_database

SUMMARY

DigitalOcean released their MongoDB managed database clusters, which are available via the API with the name/slug 'mongodb', an example API call is below:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" -d '{"name": "backend", "engine": "mongodb", "version": "4", "region": "nyc3", "size": "db-s-1vcpu-1gb", "num_nodes": 1, "tags": ["production"]}'
"https://api.digitalocean.com/v2/databases"

{"database":{"id":"1d897187-4608-42af-ad49-2565a8b5cf33","name":"backend","engine":"mongodb","version":"4","connection":{"protocol":"mongodb+srv","uri":"mongodb+srv://doadmin:[email protected]/admin?tls=true&authSource=admin","database":"admin","host":"backend-6ee199d1.mongo.ondigitalocean.com","port":27017,"user":"doadmin","password":"XXXXXXXX","ssl":true},"private_connection":{"protocol":"mongodb+srv","uri":"mongodb+srv://doadmin:[email protected]/admin?tls=true&authSource=admin","database":"admin","host":"private-backend-e9fdad2c.mongo.ondigitalocean.com","port":27017,"user":"doadmin","password":"XXXXXXXXXX","ssl":true},"users":null,"db_names":null,"num_nodes":1,"region":"nyc3","status":"creating","created_at":"2021-07-02T10:24:13Z","maintenance_window":{"day":"","hour":"","pending":false},"size":"db-s-1vcpu-1gb","tags":["production"]}}

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.digitalocean.digital_ocean_database

ANSIBLE VERSION
ansible [core 2.11.2]
  config file = /Users/admin/Work/evamo-staging/setup/ansible.cfg
  configured module search path = ['/Users/admin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/4.1.0/libexec/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/admin/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.5 (default, May  4 2021, 03:33:11) [Clang 12.0.0 (clang-1200.0.32.29)]
  jinja version = 3.0.1
  libyaml = True
COLLECTION VERSION
community.digitalocean        1.5.1
CONFIGURATION
No special configuration.
OS / ENVIRONMENT

MacOS Cataline version 10.15.7

STEPS TO REPRODUCE

Run the digital_ocean_database to create a managed database cluster

- name: Setup/DO | Create '{{ db_engine }}' Managed Cluster
      community.digitalocean.digital_ocean_database:
        region: "{{ host_region }}"
        oauth_token: "XXXXXXXXXXXXXXXXXX"
        state: present
        name: "{{ db_engine }}.{{ host_environment }}.{{ host_region }}.{{ host_suffix }}"
        engine: "{{ db_engine }}"
        num_nodes: "{{ nodes }}"
        size: "{{ db_size }}"
      register: database_cluster
EXPECTED RESULTS

Expected return as of https://docs.ansible.com/ansible/latest/collections/community/digitalocean/digital_ocean_database_module.html

ACTUAL RESULTS
TASK [Setup/DO | Create 'mongodb' Managed Cluster] **********************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "value of engine must be one of: pg, mysql, redis, got: mongodb"}

digital_ocean_load_balancer_info cannot select LB by ID

From @Akasurde on May 03, 2020 09:13

From @jrkarnes on May 01, 2020 19:37

SUMMARY

When attempting to use the digital_ocean_load_balancer_info module, specifying a load_balancer_id causes the module to experience a failure.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

/ansible/modules/cloud/digital_ocean/digital_ocean_load_balancer_info.py

ANSIBLE VERSION
ansible 2.9.7
  config file = /Users/jkarnes/.ansible.cfg
  configured module search path = [u'/Users/jkarnes/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/jkarnes/Library/Python/2.7/lib/python/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.16 (default, Jun 19 2019, 07:40:37) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)]
CONFIGURATION
DEFAULT_PRIVATE_KEY_FILE(/Users/jkarnes/.ansible.cfg) = /Users/jkarnes/.ssh/adaptive_access
HOST_KEY_CHECKING(/Users/jkarnes/.ansible.cfg) = False
OS / ENVIRONMENT

I'm running this locally against my own machine so I suppose this would be MacOS Mojave 10.14.6.
Model Name: MacBook Pro
Model Identifier: MacBookPro11,3

Not sure what else you want here as this is running against hosts: 127.0.01 and connection: local

STEPS TO REPRODUCE
  1. Create a digital ocean load balancer
  2. Use doctl compute load-balancer list to see your newly created load balancer. Capture it's id and use it for step 3
  3. Execute this extremely minimal playbook:
---
hosts: 127.0.0.1
  connection: local
  vars:
    do_load_balancer_id: "<WHATERVER YOU GOT FROM STEP 2>"
  tasks:
    - name: Get information about the load balancer
        digital_ocean_load_balancer_info:
          load_balancer_id: "{{ do_load_balancer_id }}"
EXPECTED RESULTS

I would expect to receive information about my load balancer, preferably in the form of a HashMap

ACTUAL RESULTS

Abject failure and sadness =(

 ________________________________________________ 
< TASK [Get information about the load balancer] >
 ------------------------------------------------ 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

task path: /Users/jkarnes/Projects/AdaptiveRX/Rundeck/ansible_resources/do_test_cert_manage.yaml:40
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: jkarnes
<127.0.0.1> EXEC /bin/sh -c 'echo ~jkarnes && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/jkarnes/.ansible/tmp `"&& mkdir /Users/jkarnes/.ansible/tmp/ansible-tmp-1588361182.66-55721-19160074506918 && echo ansible-tmp-1588361182.66-55721-19160074506918="` echo /Users/jkarnes/.ansible/tmp/ansible-tmp-1588361182.66-55721-19160074506918 `" ) && sleep 0'
Using module file /Users/jkarnes/Library/Python/2.7/lib/python/site-packages/ansible/modules/cloud/digital_ocean/digital_ocean_load_balancer_info.py
<127.0.0.1> PUT /Users/jkarnes/.ansible/tmp/ansible-local-55615iZU6zr/tmpCvhoQ5 TO /Users/jkarnes/.ansible/tmp/ansible-tmp-1588361182.66-55721-19160074506918/AnsiballZ_digital_ocean_load_balancer_info.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/jkarnes/.ansible/tmp/ansible-tmp-1588361182.66-55721-19160074506918/ /Users/jkarnes/.ansible/tmp/ansible-tmp-1588361182.66-55721-19160074506918/AnsiballZ_digital_ocean_load_balancer_info.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/local/opt/python@2/bin/python2.7 /Users/jkarnes/.ansible/tmp/ansible-tmp-1588361182.66-55721-19160074506918/AnsiballZ_digital_ocean_load_balancer_info.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/jkarnes/.ansible/tmp/ansible-tmp-1588361182.66-55721-19160074506918/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/var/folders/1w/6wt0nysn2lx6cb_nb3_7b8km7hvl82/T/ansible_digital_ocean_load_balancer_info_payload_OmOqob/ansible_digital_ocean_load_balancer_info_payload.zip/ansible/modules/cloud/digital_ocean/digital_ocean_load_balancer_info.py", line 114, in main
  File "/var/folders/1w/6wt0nysn2lx6cb_nb3_7b8km7hvl82/T/ansible_digital_ocean_load_balancer_info_payload_OmOqob/ansible_digital_ocean_load_balancer_info_payload.zip/ansible/modules/cloud/digital_ocean/digital_ocean_load_balancer_info.py", line 97, in core
KeyError: 'load_balancer'
fatal: [127.0.0.1]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "load_balancer_id": "39ad1e52-e861-4d0a-8966-1cb6717ff705", 
            "oauth_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "timeout": 30, 
            "validate_certs": true
        }
    }, 
    "msg": "'load_balancer'"
}
Bonus Information

If you run the digital_ocean_load_balancer_info module without specifying the load_balancer_id parameter, you will get a successful invocation with data in the response. Frustratingly, the "id" field for the load balancer I was trying to get data for was present in the response.

Copied from original issue: ansible/ansible#69283

Copied from original issue: ansible/ansible#265

Integration test coverage

SUMMARY

We don't have complete coverage when it comes to integration testing. Currently, we have Droplet, block volumes, floating IPs, tags and SSH keys. Let's get full coverage.

ISSUE TYPE
  • Bug Report

Digital Ocean Dynamic Inventory plugin

SUMMARY

Deprecate the use of DO inventory script and introduce dynamic inventory plugin.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

plugins/inventory/digital_ocean.py

RFE: Have info modules return empty lists instead of failing when searching for a specific object by name and it doesn't exist

SUMMARY

Per #53 (comment), there was conversation about changing the behavior of *_info modules in the next major release to return an empty list instead of the current behavior of erroring out when a search by a specific name/id of an object isn't matched. This issue is to track that decision.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

All *_info modules

ADDITIONAL INFORMATION

RFE: VPC modules

SUMMARY

Create a module to support VPCs, the API documentation is here.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME
  • digital_ocean_vpc
  • digital_ocean_vpc_info

Add ability to resize Block Store Volumes

SUMMARY

We're missing the ability to resize Block Storage Volumes.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

digital_ocean_block_storage.py

ADDITIONAL INFORMATION

Basically, if we're trying to create an already-existing volume, but its size doesn't match the desired size, the volume would be resized. This would be idempotent.

DigitalOcean doesn't support shinking volumes, so that'd be a no-op

Example usage:

- name: Create a volume
  digital_ocean_block_storage:
    command: create
    state: present
    volume_name: my_volume
    region: nyc1
    block_size: 15
   
- name: Resize the volume
  digital_ocean_block_storage:
    command: create
    state: present
    volume_name: my_volume
    region: nyc1
    block_size: 20  # because the desired size is larger, the volume would be enlarged

New module - DigitalOcean Kubernetes Cluster

SUMMARY

Add a new digital_ocean_kubernetes_cluster module.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

N/A (new module)

ADDITIONAL INFORMATION

DigitalOcean allows management of managed Kubernetes clusters via the v2 API: https://developers.digitalocean.com/documentation/v2/#create-a-new-kubernetes-cluster

It would be nice if I could manage clusters in a DigitalOcean account using a native Ansible module. For example, to create a new cluster:

- name: Ensure K8s cluster exists.
  digital_ocean_kubernetes_cluster:
    state: present
    name: mydroplet
    version: 1.12.1-do.2
    auto_upgrade: true
    region: sfo1
    node_pools:
      - size: s-1vcpu-2gb
        count: 3
        name: frontend-pool
      - size: c-4
        count: 2
        name: backend-pool

This issue was migrated from: ansible/ansible#57244

CI doesn't run on main branch, only on PRs

pylint issues

SUMMARY
ERROR: Found 7 pylint issue(s) which need to be resolved:
ERROR: plugins/inventory/digitalocean.py:111:11: super-with-arguments: Consider using Python 3 style super() without arguments
ERROR: plugins/inventory/digitalocean.py:149:12: raise-missing-from: Consider explicitly re-raising using the 'from' keyword
ERROR: plugins/inventory/digitalocean.py:151:12: raise-missing-from: Consider explicitly re-raising using the 'from' keyword
ERROR: plugins/inventory/digitalocean.py:183:8: super-with-arguments: Consider using Python 3 style super() without arguments
ERROR: plugins/modules/digital_ocean.py:215:8: super-with-arguments: Consider using Python 3 style super() without arguments
ERROR: plugins/modules/digital_ocean_domain.py:86:8: super-with-arguments: Consider using Python 3 style super() without arguments
ERROR: plugins/modules/digital_ocean_domain_record.py:185:8: super-with-arguments: Consider using Python 3 style super() without arguments
ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • plugins/inventory/digitalocean
  • plugins/modules/digital_ocean
  • plugins/modules/digital_ocean_domain
  • plugins/modules/digital_ocean_domain_record
ANSIBLE VERSION
ansible 2.10.8
  config file = /Users/mark/.ansible/collections/ansible_collections/community/digitalocean/ansible.cfg
  configured module search path = ['/Users/mark/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/mark/.pyenv/versions/3.8.8/lib/python3.8/site-packages/ansible
  executable location = /Users/mark/.pyenv/versions/3.8.8/bin/ansible
  python version = 3.8.8 (default, Apr 12 2021, 20:17:20) [Clang 12.0.0 (clang-1200.0.32.28)]
CONFIGURATION
DEFAULT_CALLBACK_WHITELIST(/Users/mark/.ansible/collections/ansible_collections/community/digitalocean/ansible.cfg) = ['timer', 'profile_tasks']
DIFF_ALWAYS(/Users/mark/.ansible/collections/ansible_collections/community/digitalocean/ansible.cfg) = True
OS / ENVIRONMENT
❯ python3 -V
Python 3.8.8
STEPS TO REPRODUCE
❯ ansible-test sanity -v --color --python 3.8
EXPECTED RESULTS

No pylint issues.

ACTUAL RESULTS
ERROR: Found 7 pylint issue(s) which need to be resolved:
ERROR: plugins/inventory/digitalocean.py:111:11: super-with-arguments: Consider using Python 3 style super() without arguments
ERROR: plugins/inventory/digitalocean.py:149:12: raise-missing-from: Consider explicitly re-raising using the 'from' keyword
ERROR: plugins/inventory/digitalocean.py:151:12: raise-missing-from: Consider explicitly re-raising using the 'from' keyword
ERROR: plugins/inventory/digitalocean.py:183:8: super-with-arguments: Consider using Python 3 style super() without arguments
ERROR: plugins/modules/digital_ocean.py:215:8: super-with-arguments: Consider using Python 3 style super() without arguments
ERROR: plugins/modules/digital_ocean_domain.py:86:8: super-with-arguments: Consider using Python 3 style super() without arguments
ERROR: plugins/modules/digital_ocean_domain_record.py:185:8: super-with-arguments: Consider using Python 3 style super() without arguments

Database module setting self.version with incorrect attribs

SUMMARY

In the digital_ocean_database module, it looks like when it is looking to see if a database exists, it is repeatedly overwriting self.version with a number of params. I'm assuming this was just a copy paste error and it should correctly set the appropriate attributes instead.

https://github.com/ansible-collections/community.digitalocean/blob/main/plugins/modules/digital_ocean_database.py#L197-L200
https://github.com/ansible-collections/community.digitalocean/blob/main/plugins/modules/digital_ocean_database.py#L222-L224

Is this intentional? Or should this be fixed?

ISSUE TYPE
  • Bug Report
COMPONENT NAME

digital_ocean_database

ANSIBLE VERSION
ansible 2.9.20
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/tyler/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.9.4 (default, Apr  6 2021, 00:00:00) [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
CONFIGURATION

OS / ENVIRONMENT
NAME=Fedora
VERSION="34 (Workstation Edition)"
ID=fedora
VERSION_ID=34
VERSION_CODENAME=""
PLATFORM_ID="platform:f34"
PRETTY_NAME="Fedora 34 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:34"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/34/system-administrators-guide/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=34
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=34
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Workstation Edition"
VARIANT_ID=workstation
STEPS TO REPRODUCE

N/A

EXPECTED RESULTS

N/A

ACTUAL RESULTS

N/A

Info modules do not always return alist as documented

Update all documentation examples to use FQCN

SUMMARY

All documentation examples in modules and plugins should be updated to use the FQCN (community.digitalocean.[plugin]).

ISSUE TYPE
  • Documentation Report
COMPONENT NAME

Everything.

ANSIBLE VERSION

N/A

Inclusion of community.digitalocean in Ansible 2.10

This collection will be included in Ansible 2.10 because it contains modules and/or plugins that were included in Ansible 2.9. Please review:

DEADLINE: 2020-08-18

The latest version of the collection available on August 18 will be included in Ansible 2.10.0, except possibly newer versions which differ only in the patch level. (For details, see the roadmap). Please release version 1.0.0 of your collection by this date! If 1.0.0 does not exist, the same 0.x.y version will be used in all of Ansible 2.10 without updates, and your 1.x.y release will not be included until Ansible 2.11 (unless you request an exception at a community working group meeting and go through a demanding manual process to vouch for backwards compatibility . . . you want to avoid this!).

Follow semantic versioning rules

Your collection versioning must follow all semver rules. This means:

  • Patch level releases can only contain bugfixes;
  • Minor releases can contain new features, new modules and plugins, and bugfixes, but must not break backwards compatibility;
  • Major releases can break backwards compatibility.

Changelogs and Porting Guide

Your collection should provide data for the Ansible 2.10 changelog and porting guide. The changelog and porting guide are automatically generated from ansible-base, and from the changelogs of the included collections. All changes from the breaking_changes, major_changes, removed_features and deprecated_features sections will appear in both the changelog and the porting guide. You have two options for providing changelog fragments to include:

  1. If possible, use the antsibull-changelog tool, which uses the same changelog fragment as the ansible/ansible repository (see the documentation).
  2. If you cannot use antsibull-changelog, you can provide the changelog in a machine-readable format as changelogs/changelog.yaml inside your collection (see the documentation of changelogs/changelog.yaml format).

If you cannot contribute to the integrated Ansible changelog using one of these methods, please provide a link to your collection's changelog by creating an issue in https://github.com/ansible-community/ansible-build-data/. If you do not provide changelogs/changelog.yml or a link, users will not be able to find out what changed in your collection from the Ansible changelog and porting guide.

Make sure your collection passes the sanity tests

Run ansible-test sanity --docker -v in the collection with the latest ansible-base or stable-2.10 ansible/ansible checkout.

Keep informed

Be sure you're subscribed to:

Questions and Feedback

If you have questions or want to provide feedback, please see the Feedback section in the collection requirements.

(Internal link to keep track of issues: ansible-collections/overview#102)

RFE: Projects and Project Resources

SUMMARY

Projects and Project Resources are useful, let's write modules for them. The API docs are here and here.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME
  • digital_ocean_project
  • digital_ocean_project_resources

Power on and power off droplets

SUMMARY

Implement the basic, fundamental, and obvious feature of changing the power state of an existing droplet.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

digital_ocean_droplet

ADDITIONAL INFORMATION

This feature would allow the simple, obvious, and necessary ability to TURN ON or TURN OFF a droplet that already exists. This is probably the single most basic VPS function and really should already exist.
The feature would probably most easily be called by users via the STATE: parameter, with something like "active/inactive", poweredon/poweredoff, etc.

- name: power on my drupal-test droplet
  digital_ocean_droplet:
    state: active
    id: "{{ my_droplet_id }}"
    oauth_token: "{{ my_do_api_token }}"

digital_ocean_snapshot_info errors out when attempting to get snapshot by id

SUMMARY

When attempting to retrieve a snapshot with snapshot_type: "by_id", I receive an error instead of the expected information on a specific snapshot.

TASK [community.digitalocean.digital_ocean_snapshot_info] ***************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'snapshot'
fatal: [localhost]: FAILED! => {"changed": false, "msg": "'snapshot'"}
ISSUE TYPE
  • Bug Report
COMPONENT NAME

digital_ocean_snapshot_info

ANSIBLE VERSION

CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
- hosts: localhost
  tasks:
    - community.digitalocean.digital_ocean_snapshot_info:
        snapshot_id: "12345678"
        snapshot_type: "by_id"
EXPECTED RESULTS

I would expect snapshot info on the snapshot with the specified id to be present or to receive an error message if that snapshot doesn't exist

ACTUAL RESULTS

The above error message is received.

Zone file not returned on initial domain creation

Sorry for taking so long on this. Unfortunately, it seems like "something else is actually broken".

Take a look at this output: https://gist.github.com/mamercad/8effa85bd0381ab164682b78ca5b6a88

Here's the playbook: https://gist.github.com/mamercad/afe7db39085aa88b4833224a486f4b4b

It seems like there's a different problem: the first run shows "changed" (which is correct since they domain didn't exist), but, it doesn't give back the zone information (this seems like the actual bug). The subsequent run, without changing the play, show as "ok" and return the zone information (which is correct since nothing is changing).

Let's look into this a bit closer.

Originally posted by @mamercad in #22 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.