Browse Source

add new info module and minor tweaks

9.0.0-dev
Markus Bergholz 2 months ago
parent
commit
eda664ae4b
Signed by: m GPG Key ID: B45724801354B174
  1. 3
      meta/runtime.yml
  2. 46
      plugins/modules/info.py
  3. 1
      plugins/modules/user_info.py
  4. 8
      tests/integration/targets/info/tasks/main.yml
  5. 9
      tests/integration/targets/localhost.yml

3
meta/runtime.yml

@ -7,4 +7,5 @@ action_groups:
- password
- password_info
- talk
- user_info
- user_info
- info

46
plugins/modules/info.py

@ -0,0 +1,46 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
module: info
short_description: receive informations about nextcloud server
description:
- receive informations about nextcloud server
version_added: "9.0.0"
author:
- "Markus Bergholz (@markuman)"
extends_documentation_fragment:
- markuman.nextcloud.nextcloud.connectivity
notes:
- Supports C(check_mode).
'''
EXAMPLES = '''
- name: receive informations
markuman.nextcloud.info:
register: out
'''
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.markuman.nextcloud.plugins.module_utils.nextcloud import NextcloudHandler
from ansible_collections.markuman.nextcloud.plugins.module_utils.nextcloud import parameter_spects
def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec=parameter_spects(dict())
)
nc = NextcloudHandler(module.params)
retval = nc.get('/ocs/v1.php/cloud/capabilities').json()
module.exit_json(nextcloud=retval.get('ocs').get('data'))
if __name__ == '__main__':
main()

1
plugins/modules/user_info.py

@ -15,6 +15,7 @@ author:
- "Markus Bergholz (@markuman)"
options:
username:
version_added: "9.0.0"
description:
- Nextcloud username to receive detail information.
- Nextcloud UserID

8
tests/integration/targets/info/tasks/main.yml

@ -0,0 +1,8 @@
- name: nextcloud informations
markuman.nextcloud.info:
register: out
- name: verify nextcloud version
assert:
that:
- out.nextcloud.version.major == 21

9
tests/integration/targets/localhost.yml

@ -113,10 +113,19 @@
user: "{{ NEXTCLOUD_USER }}"
api_token: "{{ NEXTCLOUD_TOKEN }}"
ssl_mode: "{{ SSL_MODE }}"
markuman.nextcloud.info:
host: "{{ NEXTCLOUD_HOST }}"
user: "{{ NEXTCLOUD_USER }}"
api_token: "{{ NEXTCLOUD_TOKEN }}"
ssl_mode: "{{ SSL_MODE }}"
tasks:
- name: integration tests
block:
- name: file integration test
include_role:
name: info
- name: file integration test
include_role:
name: user

Loading…
Cancel
Save