Repository: ansible-collections/community.general

Issue:
DNSimple does not return records
### Summary

According to dnsimple docs [1] it should be possible to list all records of a given domain but it actually is not.

### Issue Type

Bug Report

### Component Name

dnsimple

### Ansible Version

```console (paste below)
$ ansible --version
ansible 2.9.6


```


### Community.general Version

```console (paste below)
$ ansible-galaxy collection list community.general
3.7.0
```


### Configuration

```console (paste below)
$ ansible-config dump --only-changed

```


### OS / Environment

_No response_

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
- name: Fetch my.com domain records
  community.general.dnsimple:
    domain: my.com
    state: present
  delegate_to: localhost
  register: records

```


### Expected Results

all records from the my.com domain in a list/dictionary/etc

### Actual Results

```console (paste below)
info about the domain, no records
```
@drcapulet

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
Files identified in the description:
* [`plugins/modules/net_tools/dnsimple.py`](https://github.com/ansible-collections/community.general/blob/main/plugins/modules/net_tools/dnsimple.py)

If these files are incorrect, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @drcapulet
[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: notify --->
Where in the documentation (https://docs.ansible.com/ansible/latest/collections/community/general/dnsimple_module.html) do you find that it should return such a list?
Hi, in the examples section:
```
- name: Fetch my.com domain records
  community.general.dnsimple:
    domain: my.com
    state: present
  delegate_to: localhost
  register: records
```
In the DNSimple UI if you click "my.com" records, you will see a list of records. This task seems to imply that records variable should hold the records to my.com domain. 
Ah, I didn't look at the examples. That seems to indicate that indeed... Looking at the code, it seems that simply the result of `get_domain()` is returned (https://github.com/ansible-collections/community.general/blob/main/plugins/modules/net_tools/dnsimple.py#L429); maybe another version of the dnsimple Python library also returned the records with that, but the one you have installed does not? (Which version of `dnsimple` do you have installed?)
Thanks for checking, I believe this is the most recent version of the dnsimple Python library:
`dnsimple in /home/user/.local/lib/python3.8/site-packages (2.2.1)`
Ansible community.general version is:
```
collections:
  - name: community.general
    version: 3.7.0
```


The dnsimple library changed quite a lot between < 2.0.0 and >= 2.0.0 (it might also use a different API); my personal guess would be that this is related to that. But since I don't use dnsimple and cannot try, I can just make wild guesses :)
The action of "fetch" on "state: present" does not make a lot of sense to begin with, and is a little counter-intuitive.. If the domain doesn't exist this actually CREATES if the domain. Which can be pretty dangerous, for ex, you have records under my.com:
ex1.subdomain.my.com
ex2.subdomain.my.com

and you run with this domain in attempt to see what is under "subdomain.my.com" expecting the above to return. Instead it creates an entire new domain "subdomain.my.com" which then breaks resolution for the existing records. (ex1,ex2).
Similar seems to be true for adding records:
```
- name: Create a test.my.com A record to point to 127.0.0.1
  community.general.dnsimple:
    domain: my.com
    record: test
    type: A
    value: 127.0.0.1
  delegate_to: localhost
  register: record
```
Without "state" you would think this might just check if the record exists, instead it creates it... State is required for removing a record, seems like it ought to be the same for adding. Same way that "state: present" does not make a lot of sense for:
"if the domain exists, **fetch** records, if not create the domain"
Instead it should just be "if state is present and the domain exists, show the domain exists(**unchanged**) if not, create it".
But I guess this is up to the author, I am pretty new to this
I'm currently tending to simply remove that example, as it is the only piece of documentation hinting at this functionality. If this should be properly implemented, adding a new `dnsimple_info` module would be the best solution anyway.

(BTW, if you want to prevent modification, you can simply add `check_mode: true` to the task at the same level as the module name, i.e. not as a module parameter. That way the module will be told not create anything.)
resolved_by_pr #3571

Resolving patch:
diff --git a/plugins/modules/net_tools/dnsimple.py b/plugins/modules/net_tools/dnsimple.py
--- a/plugins/modules/net_tools/dnsimple.py
+++ b/plugins/modules/net_tools/dnsimple.py
@@ -92,13 +92,6 @@
     account_api_token: dummyapitoken
   delegate_to: localhost
 
-- name: Fetch my.com domain records
-  community.general.dnsimple:
-    domain: my.com
-    state: present
-  delegate_to: localhost
-  register: records
-
 - name: Delete a domain
   community.general.dnsimple:
     domain: my.com


Test patch: