An ansible playbook that adds the necessary configuration directives to configure multiple subject alternative (SAN) names in /etc/pki/tls/openssl.cnf, the default openssl configuration file on EL 7 or greater.
The playbook uses lineinfile and blockinfile tasks with regular expressions to ensure the required configuration directives
such as [ alt_names ] section are present.
Custom markers are used for req_ext and alt_names blocks.
- Gather facts is enabled
- /etc/pki/tls/openssl.cnf file is present
- Ansible user is able to elevate on the target node
- Required variables are defined
countryNameThe country name value that should be used in openssl.cnf as the defaultstateOrProvinceNameThe state or province name value that should be used in openssl.cnf as the defaultlocalityNameThe locality name value that should be used in openssl.cnf as the defaultorganizationNameThe organization name value that should be used in openssl.cnf as the defaultzero_organizationalUnitNameThe organizational unit name value that should be used in openssl.cnf as the default
Use a git client to clone the repository.
The main branch is the release branch.
cd ~/; git clone https://github.com/whitehat237/openssl_altnames.gitansible-playbook openssl_altnames/playbook.yml -i inventory.yml --limit host.example.com --user local --become -kKNote: This example assumes you have ansible core installed on the same machine you have cloned the repository to.