Add ansible_certificate custom fact
This commit is contained in:
parent
0ae634aed2
commit
c9b21a3286
2 changed files with 26 additions and 0 deletions
|
@ -1,4 +1,15 @@
|
|||
---
|
||||
- name: setup ansible custom facts
|
||||
file:
|
||||
dest: "{{ item }}"
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- /etc/ansible
|
||||
- /etc/ansible/facts.d
|
||||
|
||||
- name: set correct hostname
|
||||
hostname:
|
||||
name: "{{ inventory_hostname }}"
|
||||
|
|
|
@ -30,6 +30,21 @@
|
|||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
|
||||
- name: add ansible certificate fact
|
||||
copy:
|
||||
content: |
|
||||
#!/bin/sh
|
||||
[ -f {{ tls_certs }}/{{ inventory_hostname }}.crt ] && awk '
|
||||
BEGIN { printf "\"" }
|
||||
{ if (!/^-\-/) printf "%s",$0 }
|
||||
END { print "\"" }
|
||||
' {{ tls_certs }}/{{ inventory_hostname }}.crt
|
||||
|
||||
dest: /etc/ansible/facts.d/ansible_certificate.fact
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
|
||||
- name: create full chain of host certficate and ca
|
||||
shell: "cat {{ tls_certs }}/{{ inventory_hostname }}.crt \
|
||||
{{ tls_certs }}/ca.crt > \
|
||||
|
|
Loading…
Add table
Reference in a new issue