-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprocess-server.yml
52 lines (46 loc) · 1.44 KB
/
process-server.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
- name: Create the full path to store the certificates on target
file:
path: '{{ config_path }}/certs/{{ rhel_server.value.release }}'
state: directory
owner: root
group: root
mode: '0755'
become: yes
- name: Create a temp directory for certs and configurations on ansible host
tempfile:
state: directory
prefix: 'repo-'
suffix: '-certs'
register: cert_tmp
delegate_to: localhost
- name: Find SSL certificate and configuration files on {{ rhel_server.key }}
shell: ls /etc/pki/entitlement/* /etc/yum.repos.d/redhat.repo /etc/rhsm/ca/redhat-uep.pem
register: cert_files
delegate_to: '{{ rhel_server.key }}'
become: yes
- name: Fetch all the required files from {{ rhel_server.key }} to the ansible host
fetch:
flat: yes
src: "{{ item }}"
dest: '{{ cert_tmp.path }}/'
with_items: '{{ cert_files.stdout_lines }}'
delegate_to: '{{ rhel_server.key }}'
become: yes
- name: Copy the SSL certificates to the target host
copy:
src: '{{ item }}'
dest: '{{ config_path }}/certs/{{ rhel_server.value.release }}/'
mode: '0600'
with_fileglob:
- "{{ cert_tmp.path }}/*.pem"
become: yes
- name: Process each repository in the repos list
include_tasks: process-repo.yml
with_items: '{{ rhel_server.value.repos }}'
loop_control:
loop_var: rhel_repo
- name: Delete the {{ cert_tmp.path }} directory
file:
path: '{{ cert_tmp.path }}/'
state: absent
delegate_to: localhost