bring up your nextcloud usage to the next level 🚀 https://galaxy.ansible.com/markuman/nextcloud
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Markus Bergholz 6b5cde5f7b
update 6.0.0
5 days ago
plugins add optional details parameter to password lookup 5 days ago
tests fix talk test 7 days ago
.gitignore add envrc to gitignore 10 months ago
.gitlab-ci.yml #2 test basic build 10 months ago
LICENSE Initial commit 10 months ago
Makefile add whisper and syntax test 7 days ago
README.md add optional details parameter to password lookup 5 days ago
drone.yml add first draft for user_info module 3 months ago
galaxy.yml update 6.0.0 5 days ago

README.md

Ansible Nextcloud Collection

Ansible Nextcloud Collection - is not meant to install nor to maintain your nextcloud itself.
It's meant to bring up your nextcloud usage to the next level 🚀
No ssh required.

Features

Build Status

  • 🔑 lookup plugin for passwords app
  • 💾 file module - download, upload and delete files
  • 🗨 talk module - post messages in conversations
  • 👥 user module - maintain nextcloud users

Support

host category
https://git.osuv.de/m/nextcloud_collection origin
https://gitlab.com/markuman/nextcloud_collection pull mirror, merge-requests and Issues
https://github.com/markuman/nextcloud_collection push mirror, pull-requests and Issues

Usage

Install

https://galaxy.ansible.com/markuman/nextcloud

ansible-galaxy collection install markuman.nextcloud

Auth

You can authenticate either with your user password or with an App-Token (Settings -> Security -> "Create new app password).
When you've setup MFA/2FA/TOTP, you must authenticate with an App-Token.

The collection modules and plugins require the following parameter. Alternatively the parameter can also be set as an ENV variable.

Ansible Parameter ENV Variable
host NEXTCLOUD_HOST
user NEXTCLOUD_USER
api_token NEXTCLOUD_TOKEN

ssl_mode

ssl_mode parameter, default value (https).

  • ability to use http:// for integration tests
  • ability to skip ssl verification
  • Possible values https, http, skip

lookup passwords

When details=False, only the password is returned.
When details=True, the entire object is returned.

- name: Retrieve Password with label "Stackoverflow"
  debug:
    var: lookup('markuman.nextcloud.passwords', 'Stackoverflow' , host='nextcloud.tld', user='ansible', api_token='some-token', details=False)

file module

The file module supports also access_token as an alias for api_token, to be closer on ansible S3 module.

mode: get

- name: fetch file from nextcloud
  markuman.nextcloud.file:
    mode: get
    src: anythingeverything.jpg
    dest: /tmp/anythingeverything.jpg
    overwritten: different # 'always' is the default. 'never' is an option too.
    host: nextcloud.tld
    user: myuser
    api_token: xxx

mode: delete

CAUTION ⚠ removes files and folders - recursive!

- name: delete file on nextcloud
  markuman.nextcloud.file:
    mode: delete
    src: bla.docx

mode: put

- name: upload file on nextcloud
  markuman.nextcloud.file:
    mode: put
    src: /tmp/testtt.jpg
    dest: testtt.jpg

talk module

- name: send hello
  markuman.nextcloud.talk:
    msg: Ho Hi from Ansible.
    channel: 8fyrb4ec

user_info

List all nextcloud users.

- name: get nc users
  markuman.nextcloud.user_info:
  register: out

- debug: msg="{{ out.users }}"