lowlydba.sqlserver.credential 模块 – 在 SQL 服务器上配置凭据

注意

此模块是 lowlydba.sqlserver 集合(版本 2.3.4)的一部分。

如果您正在使用 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install lowlydba.sqlserver。您需要进一步的要求才能使用此模块,请参阅 要求 以了解详细信息。

要在 Playbook 中使用它,请指定:lowlydba.sqlserver.credential

lowlydba.sqlserver 1.3.0 中的新功能

概要

  • 在 SQL 服务器上创建、替换或删除凭据。

要求

执行此模块的主机需要以下要求。

参数

参数

注释

force

布尔值

如果启用此开关,则会删除并重新创建现有凭据。

选项

  • false ← (默认)

  • true

identity

字符串 / 必需

凭据标识。

mapped_class_type

字符串

设置与凭据关联的类。

选项

  • "CryptographicProvider"

  • "None"

name

字符串

凭据名称。

password

字符串

用于验证凭据标识的密码。

provider_name

字符串

为企业密钥管理提供程序指定加密提供程序名称。

sql_instance

字符串 / 必需

要修改的 SQL Server 实例。

sql_password

字符串

用于 SQL 身份验证的密码。

sql_username

字符串

用于 SQL 身份验证的用户名。

state

字符串

对象应该是 present 还是 absent

选项

  • "present" ← (默认)

  • "absent"

属性

属性

支持

描述

check_mode

支持:完全支持

可以在 check_mode 中运行,并在不修改目标的情况下返回已更改的状态预测。

platform

平台: 全部

可以对其进行操作的目标操作系统/系列。

示例

- name: Create a credential with a password
  lowlydba.sqlserver.credential:
    sql_instance: sql-01.myco.io
    identity: ad\\user
    name: MyCredential
    password : <Password>

- name: Replace an existing credential
  lowlydba.sqlserver.credential:
    sql_instance: sql-01.myco.io
    identity: MyIdentity
    force: true

- name: Create a credential using a SAS token for a backup URL
  lowlydba.sqlserver.credential:
    sql_instance: sql-01.myco.io
    identity: SHARED ACCESS SIGNATURE
    name: https://<azure storage account name>.blob.core.windows.net/<blob container>
    password : <Shared Access Token>

- name: Remove a credential
  lowlydba.sqlserver.credential:
    sql_instance: sql-01.myco.io
    identity: MyIdentity
    state: absent

返回值

通用返回值在此处有文档记录:此处,以下是此模块特有的字段

描述

数据

字典

来自 New-DbaDbCredentialGet-DbaDbCredentialRemove-DbaDbCredential 函数的输出。

已返回:成功,但不在 check_mode 中。

作者

  • Joe Krilov (@Joey40)

  • John McCall (@lowlydba)