bring up your nextcloud usage to the next level ????
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 2c2a7b8d37
update password only on change and add no_log attribute
1 year ago
plugins update password only on change and add no_log attribute 1 year ago
tests add update_password parameter 1 year ago
.gitignore add envrc to gitignore 2 years ago
.gitlab-ci.yml #2 test basic build 2 years ago
LICENSE Initial commit 2 years ago
Makefile add whisper and syntax test 1 year ago handle folder on creation 1 year ago
drone.yml add first draft for user_info module 2 years ago
galaxy.yml #14 first draft for password modules 1 year ago

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.


Build Status

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


host category origin pull mirror, merge-requests and Issues push mirror, pull-requests and Issues



ansible-galaxy collection install markuman.nextcloud


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


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"
    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
    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
    mode: delete
    src: bla.docx

mode: put

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

talk module

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

password_info module

parameter notes
name the name of the password
- name: look for one password
    name: ansible-test-01
  register: out

- name: fetch all passwords
  register: out

password module

parameter notes
password when no password it given, ansible will request an auto-generated password from the nextcloud server
name the name of the password
username username that belongs to the password
url url of the password
notes notes to the password
favorite whether the password should be marked as favourite or not
state present or absent
update_password When to update a password. on_create (default) will write the password only if the password record is created. always will also update the password if it's exist and the requested password differs from existing.
folder Name of the folder where the password must be saved (works currently only on createion)
- name: sample create
    name: ansible-test-05
    password: something
    username: markus
    notes: made with ansible

- name: >
    when no password is requestes
    nextcloud password apps will auto-generate it    
    name: some super password


List all nextcloud users.

- name: get nc users
  register: out

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