Repository: ansible-collections/community.general

Issue:
jenkins_plugin: HTTP Error 405: Method Not Allowed on disable/enable plugin
### Summary

When I use `state: disabled` for jenkins_plugin module for any plugin ansible fails with 405 response code, because jenkins_plugin.py sends GET request to jenkins but jenkins expects POST method for pluginManager/plugin/*  api requests.

I think this issue can easily be fixed with adding method=POST perameter to the _get_url_data here:
https://github.com/ansible-collections/community.general/blob/main/plugins/modules/web_infrastructure/jenkins_plugin.py#L696 

### Issue Type

Bug Report

### Component Name

jenkins_plugin

### Ansible Version

```console (paste below)
$ ansible --version
ansible 2.9.18
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.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, Aug 13 2020, 02:51:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
```

### Configuration

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


### OS / Environment

RHEL 7

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
- name: Install Plugins
  jenkins_plugin:
    name: xvfb
    url: "{{ jenkins_instance_url }}"
    state: disabled
```


### Expected Results

correctly disabled or enabled plugin

### Actual Results

```console (paste below)
TASK [jenkins : Disable or Enable Plugins] *************************************
failed: [test-jenkins-master-001] (item={'key': 'xvfb', 'value': 'false'}) => changed=false
  ansible_facts:
    discovered_interpreter_python: /usr/bin/python
  ansible_loop_var: item
  details: 'HTTP Error 405: Method Not Allowed'
  item:
    key: xvfb
    value: 'false'
  msg: Plugin not found.
```


### Code of Conduct

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


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

If these files are inaccurate, 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/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @jtyr @nerzhul
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/plugins/modules/web_infrastructure/jenkins_plugin.py b/plugins/modules/web_infrastructure/jenkins_plugin.py
--- a/plugins/modules/web_infrastructure/jenkins_plugin.py
+++ b/plugins/modules/web_infrastructure/jenkins_plugin.py
@@ -696,7 +696,8 @@ def _pm_query(self, action, msg):
         self._get_url_data(
             url,
             msg_status="Plugin not found. %s" % url,
-            msg_exception="%s has failed." % msg)
+            msg_exception="%s has failed." % msg,
+            method="POST")
 
 
 def main():


Test patch: