nextcloud.admin.run_occ (2.1.0) — module

Run the occ command line tool with given arguments

Authors: Marc Crébassa (@aalaesar)

Install collection

Install with ansible-galaxy collection install nextcloud.admin:==2.1.0


Add to requirements.yml

  collections:
    - name: nextcloud.admin
      version: 2.1.0

Description

Run admin commands on a Nextcloud instance using the OCC command line tool.

Pass only arguments understood by the occ tool.

Check https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html for more details about the available commands.

Don't support check mode.

Always returns state as 'changed'.

This module requires to be run with advanced privileges unless it is run as the user that own the occ tool.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: get nextcloud basic info status
  nextcloud.admin.run_occ:
    command: status --output=json
    nextcloud_path: /var/lib/www/nextcloud
  changed_when: false
  register: nc_status
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: install an application
  nextcloud.admin.run_occ:
    command: app:install notes
    nextcloud_path: /var/lib/www/nextcloud

Inputs

    
command:
    aliases:
    - args
    description:
    - The string passed directly to the occ command line.
    - Shell variable expansion is not available.
    - Shell pipelining is not supported.
    type: str

php_runtime:
    aliases:
    - php
    default: php
    description:
    - Specify the php runtime used to run the occ tool.
    - Can be an absolute or relative path if the runtime is available in the PATH.
    type: str

nextcloud_path:
    aliases:
    - path
    - nc_path
    - nc_dir
    description:
    - Specify the nextcloud instance's location in the host.
    - If not given, the module can't use the occ tool.
    type: str

Outputs

command:
  description: The complete line of arguments given to the occ tool.
  returned: always
  type: string
rc:
  description: The return code given by the occ tool.
  returned: always
  type: int
stderr:
  description: The complete error return of the occ tool in one string. All new lines
    will be replaced by \\n.
  returned: always
  type: str
stderr_lines:
  description: The complete error return of the occ tool. Each line is a element of
    a list.
  elements: str
  returned: always
  type: list
stdout:
  description: The complete normal return of the occ tool in one string. All new lines
    will be replaced by \\n.
  returned: always
  type: str
stdout_lines:
  description: The complete normal return of the occ tool. Each line is a element
    of a list.
  elements: str
  returned: always
  type: list