-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrhel-repo-sync.yml
69 lines (60 loc) · 1.68 KB
/
rhel-repo-sync.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
- hosts: all
vars:
servers:
rhel7.internal.lan:
release: 7Server
repos:
- rhel-7-server-rpms
- rhel-7-server-optional-rpms
- rhel-7-server-extras-rpms
- rhel-7-server-supplementary-rpms
- rhel-ha-for-rhel-7-server-rpms
- rhel-rs-for-rhel-7-server-rpms
- rhel-server-rhscl-7-rpms
rhel6.internal.lan:
release: 6Server
repos:
- rhel-6-server-extras-rpms
- rhel-6-server-optional-rpms
- rhel-6-server-rpms
- rhel-6-server-supplementary-rpms
- rhel-server-rhscl-6-rpms
repo_base: /var/www/html/repos
config_path: /etc/reposync
gather_facts: false
tasks:
- name: Ensure required packages are installed
yum:
name: "{{ packages }}"
vars:
packages:
- yum-utils
- createrepo
become: yes
- name: Create the configuration path base directory
file:
path: '{{ config_path }}'
state: directory
owner: root
group: root
mode: '0755'
become: yes
- name: Create the directory to store the repo files on target
file:
path: '{{ config_path }}/repos.d'
state: directory
owner: root
group: root
mode: '0755'
become: yes
- name: Copy the yum.conf template to the target
template:
src: yum.conf.j2
dest: '{{ config_path }}/yum.conf'
become: yes
- name: Loop and process all Red Hat servers in the servers dict
include_tasks: process-server.yml
loop: "{{ lookup('dict', servers) }}"
loop_control:
loop_var: rhel_server