robertdebock.ca

Ansible角色ca

在您的系统上安装和配置证书颁发机构(CA)。

GitHub GitLab 下载 版本
github gitlab downloads 版本

示例剧本

这个示例来自于 molecule/default/converge.yml,并在每次推送、拉取请求和发布时进行测试。

---
- name: Converge
  hosts: all
  become: true
  gather_facts: true

  roles:
    - role: robertdebock.ca

机器需要准备。在CI中,这是通过 molecule/default/prepare.yml 来完成的:

---
- name: Prepare
  hosts: all
  become: true
  gather_facts: false

  roles:
    - role: robertdebock.bootstrap
    - role: robertdebock.buildtools
    - role: robertdebock.epel
    - role: robertdebock.python_pip
    - role: robertdebock.openssl
      openssl_items:
        - name: apache-httpd
          common_name: "{{ ansible_fqdn }}"
    - role: robertdebock.httpd

此外,您还可以查看 完整的解释和示例,了解如何使用这些角色。

角色变量

变量的默认值在 defaults/main.yml 中设置:

---
# ca的默认值文件

# 设置 ca_init: 'yes' 来创建CA
ca_init: true

# 如果您希望拥有自己的根CA,则设置 ca_own_root: 'yes'。
# 如果没有,请手动设置 ca_certificate_path
ca_own_root: true

# CA密钥的密码短语。
ca_passphrase: SuP3rS3creT

# CA的公共名称。
ca_common_name: example.com

# CA的其他详细信息。
ca_country_name: NL
ca_email_address: [email protected]
ca_organization_name: Very little
ca_organizational_unit_name: Even less
ca_state_or_province_name: Utrecht
ca_locality_name: Utrecht

# 有两种格式请求密钥和证书:
# 1. 带详细信息:(包括`name:`)
# ca_requests:
#   - name: certificate1.example.com
#     passphrase: S3creT
#
# 2. 不带详细信息:(不包括`name:`)
# ca_requests:
#   - "{{ ansible_fqdn }}"

# 您也可以混合使用这些格式:
# ca_requests:
#   - name: certificate1.example.com
#     passphrase: S3creT
#   - "{{ ansible_fqdn }}"

# 证书发布位置,通常是一个web服务器位置。
# 如果未指定,则不会发布证书。
# {{ httpd_data_directory }} 是从角色 robertdebock.httpd 继承的。
ca_publication_location: "{{ httpd_data_directory | default('/tmp') }}/pub"

# 证书需要存储在哪里?默认使用分发的
# 首选位置(查看`vars/main.yml`,在`_ca_openssl_path`下)。
# 如果您需要将CA证书放在其他地方,只需使用类似如下:
# ca_openssl_path: /my/preferred/path
ca_openssl_path: "{{ _ca_openssl_path[ansible_os_family] | default(_ca_openssl_path['default']) }}"

要求

所用角色的状态

以下角色用于准备系统。您可以用其他方式准备系统。

要求 GitHub GitLab
robertdebock.bootstrap Build Status GitHub Build Status GitLab
robertdebock.buildtools Build Status GitHub Build Status GitLab
robertdebock.epel Build Status GitHub Build Status GitLab
robertdebock.httpd Build Status GitHub Build Status GitLab
robertdebock.openssl Build Status GitHub Build Status GitLab
robertdebock.python_pip Build Status GitHub Build Status GitLab

上下文

该角色是多个兼容角色的一部分。有关更多信息,请查看 这些角色的文档

以下是相关角色的概述: 依赖关系

兼容性

此角色已在以下 容器镜像 上进行测试:

容器 标签
EL 9
Debian 所有
Fedora 所有
Ubuntu jammy, focal

所需的Ansible最低版本为2.12,已进行了以下测试:

  • 上一个版本。
  • 当前版本。
  • 开发版本。

如果您发现问题,请在 GitHub 上登记。

许可证

Apache-2.0

作者信息

robertdebock

请考虑 赞助我

关于项目

Install and configure a certificate authority on your system.

安装
ansible-galaxy install robertdebock.ca
许可证
apache-2.0
下载
33.9k
拥有者
I know my way around (Linux) infrastructure, have a passion for automation, Docker, Ansible, Molecule and ci/cd.