community.windows.win_iis_webbinding 模块 – 配置 IIS 网站绑定
注意
此模块是 community.windows 集合(版本 2.3.0)的一部分。
如果您正在使用 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.windows。
要在 playbook 中使用它,请指定:community.windows.win_iis_webbinding。
概要
- 创建、删除和配置现有 IIS 网站的绑定。 
参数
| 参数 | 注释 | 
|---|---|
| SSL 绑定的证书哈希(指纹)。证书哈希是证书的唯一标识符。 | |
| 绑定证书所在的证书存储的名称。 默认值:  | |
| 要绑定到新站点的/用于新站点的主机头。 如果要创建/删除捕获所有绑定,请省略此参数,而不是将其定义为“*”。 | |
| 要绑定到新站点的/用于新站点的 IP 地址。 默认值:  | |
| 网站名称。 | |
| 要绑定到新站点的/用于新站点的端口。 默认值:  | |
| 用于 Web 绑定的协议(通常为 HTTP、HTTPS 或 FTP)。 默认值:  | |
| 此参数仅在 Server 2012 及更高版本上有效。 主要用于启用和禁用服务器名称指示 (SNI)。 设置为  设置为  | |
| 绑定的状态。 选择 
 | 
参见
另请参阅
- community.windows.win_iis_virtualdirectory
- 在 IIS 中配置虚拟目录。 
- community.windows.win_iis_webapplication
- 配置 IIS Web 应用程序。 
- community.windows.win_iis_webapppool
- 配置 IIS Web 应用程序池。 
- community.windows.win_iis_website
- 配置 IIS 网站。 
示例
- name: Add a HTTP binding on port 9090
  community.windows.win_iis_webbinding:
    name: Default Web Site
    port: 9090
    state: present
- name: Remove the HTTP binding on port 9090
  community.windows.win_iis_webbinding:
    name: Default Web Site
    port: 9090
    state: absent
- name: Remove the default http binding
  community.windows.win_iis_webbinding:
    name: Default Web Site
    port: 80
    ip: '*'
    state: absent
- name: Add a HTTPS binding
  community.windows.win_iis_webbinding:
    name: Default Web Site
    protocol: https
    port: 443
    ip: 127.0.0.1
    certificate_hash: B0D0FA8408FC67B230338FCA584D03792DA73F4C
    state: present
- name: Add a HTTPS binding with host header and SNI enabled
  community.windows.win_iis_webbinding:
    name: Default Web Site
    protocol: https
    port: 443
    host_header: test.com
    ssl_flags: 1
    certificate_hash: D1A3AF8988FD32D1A3AF8988FD323792DA73F4C
    state: present
返回值
常见返回值在此处记录 此处,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 正在操作的绑定的信息 返回:成功时 示例:  | |
| 执行的操作类型 可以是 removed、updated、matched 或 added 返回:成功时 示例:  | |
| 目标网站的状态 在您意外导致绑定冲突(这可能会导致目标站点停止)时可能很有用 返回:始终 示例:  | 
