Я остановлен из-за ошибки при генерации открытых ключей с помощью модуля openssl_publickey от Ansible.Система состоит из машины с RHEL 7.5 + Ansible 2.5 и некоторых других машин с таким же ОС, python 2.7, pyOpenSSL == 17.5.0, OpenSSL 1.0.2k-fips (26 января 2017 г.).Включенная часть пьесы (в частности, задача «создать открытый ключ»):
- name: "make sure the {{ certs_dir }} is present"
file:
state: directory
path: "{{ certs_dir }}"
owner: ansible
group: root
mode: 0755
- name: "create dir for certificates to be signed"
file:
state: directory
path: "{{ clients_certs_sign_req_dir }}"
owner: ansible
group: root
mode: 0755
delegate_to: localhost
- name: "generate private key"
openssl_privatekey:
path: "{{ certs_dir }}/{{item}}.pem"
size: 2048
type: RSA
state: present
mode: 0644
with_items: "{{ inventory_hostname }}"
- name: "generate public key"
openssl_publickey:
path: "{{ certs_dir }}/{{item}}_pub.pem"
privatekey_path: "{{ certs_dir }}/{{item}}.pem"
format: PEM
force: yes
state: present
mode: 0644
with_items: "{{ inventory_hostname }}"
- name: "generate certificate signing request for host"
openssl_csr:
path: "{{ certs_dir }}/{{item}}-cert-file.csr"
privatekey_path: "{{ certs_dir }}/{{item}}.pem"
country_name: "{{ca_country}}"
organization_name: "{{ca_organization}}"
common_name: "{{item}}"
subject_alt_name: "{{ host_san }}"
with_items: "{{ inventory_hostname }}"
Ошибка:
The full traceback is:
File "/tmp/ansible_S8LwIJ/ansible_module_openssl_publickey.py", line 289, in main
public_key.generate(module)
File "/tmp/ansible_S8LwIJ/ansible_module_openssl_publickey.py", line 195, in generate
raise PublicKeyError('You need to have PyOpenSSL>=16.0.0 to generate public keys')
failed: [node02] (item=node02) => {
"changed": false,
"invocation": {
"module_args": {
"attributes": null,
"backup": null,
"content": null,
"delimiter": null,
"directory_mode": null,
"follow": false,
"force": true,
"format": "PEM",
"group": null,
"mode": 420,
"owner": null,
"path": "/usr/share/ca-certs/node02_pub.pem",
"privatekey_passphrase": null,
"privatekey_path": "/usr/share/ca-certs/node02.pem",
"regexp": null,
"remote_src": null,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"state": "present",
"unsafe_writes": null
}
},
"item": "node02",
"msg": "You need to have PyOpenSSL>=16.0.0 to generate public keys"
Есть идеи?В качестве последнего шанса я подумал сгенерировать открытый ключ напрямую с помощью openssl, но это будет смесь, которая мне не очень нравится.Спасибо Роб