lowlydba.sqlserver.backup (2.3.2) — module

Performs a backup operation

| "added in version" 0.8.0 of lowlydba.sqlserver"

Authors: John McCall (@lowlydba)

Install collection

Install with ansible-galaxy collection install lowlydba.sqlserver:==2.3.2


Add to requirements.yml

  collections:
    - name: lowlydba.sqlserver
      version: 2.3.2

Description

Performs any type of database backup operation.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create striped full database backup in default dir
  lowlydba.sqlserver.backup:
    sql_instance: sql-01.myco.io
    database: LowlyDB
    type: full
    file_count: 8
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create t-log backup
  lowlydba.sqlserver.backup:
    sql_instance: sql-01.myco.io
    database: LowlyDB
    type: log

Inputs

    
path:
    description:
    - Path in which to place the backup files.
    - If not specified, the backups will be placed in the default backup location for
      SqlInstance.
    required: false
    type: str

type:
    choices:
    - full
    - log
    - differential
    - diff
    - database
    default: database
    description:
    - The type of backup to perform.
    required: false
    type: str

verify:
    default: false
    description:
    - If set, the backup will be verified via C(RESTORE VERIFYONLY)
    required: false
    type: bool

checksum:
    default: false
    description:
    - If set, the backup checksum will be calculated.
    required: false
    type: bool

compress:
    default: false
    description:
    - If set, use compression when creating the backup if it is supported by the version
      and edition.
    required: false
    type: bool

database:
    description:
    - The database to process.
    required: true
    type: str

copy_only:
    default: false
    description:
    - The backup will be CopyOnly.
    required: false
    type: bool

file_path:
    description:
    - The name of the file to backup to.
    - If no name is specified then the backup files will be named C(DatabaseName_yyyyMMddHHmm)
      (i.e. C(Database1_201714022131))
    required: false
    type: str

block_size:
    choices:
    - 0.5kb
    - 1kb
    - 2kb
    - 4kb
    - 8kb
    - 16kb
    - 32kb
    - 64kb
    description:
    - Specifies block size to use.
    required: false
    type: str

build_path:
    default: false
    description:
    - By default this command will not attempt to create missing paths, this switch will
      change the behaviour so that it will.
    required: false
    type: bool

file_count:
    default: 0
    description:
    - The number of striped files to create the backup with.
    required: false
    type: int

initialize:
    default: false
    description:
    - Initializes the media as part of the backup operation.
    required: false
    type: bool

no_recovery:
    default: false
    description:
    - If set, performs a tail log backup.
    required: false
    type: bool

with_format:
    default: false
    description:
    - Formats the media as the first step of the backup operation.
    required: false
    type: bool

buffer_count:
    default: 0
    description:
    - Number of I/O buffers to use.
    required: false
    type: int

sql_instance:
    description:
    - The SQL Server instance to modify.
    required: true
    type: str

sql_password:
    description:
    - Password for SQL Authentication.
    required: false
    type: str

sql_username:
    description:
    - Username for SQL Authentication.
    required: false
    type: str

create_folder:
    default: false
    description:
    - If set, database is backed up to its own subfolder within the path.
    required: false
    type: bool

azure_base_url:
    description:
    - The URL to the base container of an Azure Storage account to write backups to.
    required: false
    type: str

replace_in_name:
    default: false
    description:
    - If set, the following list of strings will be replaced in the FilePath and Path
      strings. C(instancename) - will be replaced with the instance Name C(servername)
      - will be replaced with the server name C(dbname) - will be replaced with the database
      name C(timestamp) - will be replaced with the timestamp (either the default, or
      the format provided) C(backuptype) - will be replaced with C(Full), C(Log), or C(Differential)
      as appropriate
    required: false
    type: bool

azure_credential:
    description:
    - The name of the credential on the SQL instance that can write to the I(azure_base_url),
      only needed if using Storage access keys If using SAS credentials, the command will
      look for a credential with a name matching the I(azure_base_url).
    required: false
    type: str

increment_prefix:
    default: false
    description:
    - If set, this will prefix backup files with an incrementing integer (ie; C(1-), C(2-)).
    - Using this has been alleged to improved restore times on some Azure based SQL Database
      platforms.
    required: false
    type: bool

timestamp_format:
    description:
    - By default the command timestamps backups using the format C(yyyyMMddHHmm). Using
      this option this can be overridden.
    required: false
    type: str

max_transfer_size:
    default: 0
    description:
    - Sets the size of the unit of transfer. Values must be a multiple of 64kb.
    required: false
    type: int

ignore_file_checks:
    default: false
    description:
    - If set, stops the function from checking path validity.
    required: false
    type: bool

encryption_algorithm:
    choices:
    - AES128
    - AES192
    - AES256
    - TRIPLEDES
    description:
    - Specifies the Encryption Algorithm to used.
    required: false
    type: str

encryption_certificate:
    description:
    - The name of the certificate to be used to encrypt the backups.
    required: false
    type: str

Outputs

data:
  description: Modified output from the C(Backup-DbaDatabase) function.
  returned: success, but not in check_mode.
  type: dict