| 1 |
--- |
| 2 |
- name: "Subscription Manifest" |
| 3 |
ansible.builtin.include_role: |
| 4 |
name: theforeman.foreman.manifest |
| 5 |
|
| 6 |
- name: "Enable RHEL7 repository" |
| 7 |
ansible.builtin.include_role: |
| 8 |
name: theforeman.foreman.repositories |
| 9 |
vars: |
| 10 |
foreman_products: |
| 11 |
- name: Red Hat Enterprise Linux Server |
| 12 |
repository_sets: |
| 13 |
- name: Red Hat Enterprise Linux 7 Server (RPMs) |
| 14 |
basearch: x86_64 |
| 15 |
releasever: 7Server |
| 16 |
when: foreman_content_rhel_enable_rhel7 |
| 17 |
|
| 18 |
- name: "Enable RHEL8 repositories" |
| 19 |
ansible.builtin.include_role: |
| 20 |
name: theforeman.foreman.repositories |
| 21 |
vars: |
| 22 |
foreman_products: |
| 23 |
- name: Red Hat Enterprise Linux for x86_64 |
| 24 |
repository_sets: |
| 25 |
- name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) |
| 26 |
releasever: "{{ foreman_content_rhel_rhel8_releasever }}" |
| 27 |
- name: Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) |
| 28 |
releasever: "{{ foreman_content_rhel_rhel8_releasever }}" |
| 29 |
when: foreman_content_rhel_enable_rhel8 |
| 30 |
|
| 31 |
- name: "Sync RHEL7 repository" |
| 32 |
theforeman.foreman.repository_sync: |
| 33 |
username: "{{ foreman_username }}" |
| 34 |
password: "{{ foreman_password }}" |
| 35 |
organization: "{{ foreman_organization }}" |
| 36 |
server_url: "{{ foreman_server_url }}" |
| 37 |
validate_certs: "{{ foreman_validate_certs }}" |
| 38 |
product: Red Hat Enterprise Linux Server |
| 39 |
async: 14400 |
| 40 |
poll: 0 |
| 41 |
register: __foreman_rhel7_sync |
| 42 |
when: foreman_content_rhel_enable_rhel7 and foreman_content_rhel_sync_now |
| 43 |
|
| 44 |
- name: "Sync RHEL8 repositories" |
| 45 |
theforeman.foreman.repository_sync: |
| 46 |
username: "{{ foreman_username }}" |
| 47 |
password: "{{ foreman_password }}" |
| 48 |
organization: "{{ foreman_organization }}" |
| 49 |
server_url: "{{ foreman_server_url }}" |
| 50 |
validate_certs: "{{ foreman_validate_certs }}" |
| 51 |
product: Red Hat Enterprise Linux for x86_64 |
| 52 |
async: 14400 |
| 53 |
poll: 0 |
| 54 |
register: __foreman_rhel8_sync |
| 55 |
when: foreman_content_rhel_enable_rhel8 and foreman_content_rhel_sync_now |
| 56 |
|
| 57 |
- name: "Create Sync Plan" |
| 58 |
ansible.builtin.include_role: |
| 59 |
name: theforeman.foreman.sync_plans |
| 60 |
vars: |
| 61 |
foreman_sync_plans: |
| 62 |
- name: "{{ foreman_sync_plan_name | default('RHEL Sync Plan') }}" |
| 63 |
interval: "{{ foreman_sync_plan_interval | default('daily') }}" |
| 64 |
cron_expression: "{{ foreman_sync_plan_cron_expression | default(omit) }}" |
| 65 |
sync_date: "{{ foreman_sync_plan_sync_date | default('2020-01-01 00:00:00 UTC') }}" |
| 66 |
products: |
| 67 |
"{{ [foreman_content_rhel_enable_rhel7 | ternary('Red Hat Enterprise Linux Server', ''), |
| 68 |
foreman_content_rhel_enable_rhel8 | ternary('Red Hat Enterprise Linux for x86_64', '')] |
| 69 |
| select() | list }}" |
| 70 |
|
| 71 |
- name: "Create Activation Key" |
| 72 |
ansible.builtin.include_role: |
| 73 |
name: theforeman.foreman.activation_keys |
| 74 |
vars: |
| 75 |
foreman_activation_keys: |
| 76 |
- name: "{{ foreman_activation_key_name | default('base_rhel_key') }}" |
| 77 |
description: "Generated by ansible role theforeman.foreman.content_rhel" |
| 78 |
|
| 79 |
- name: "Wait for RHEL7 sync completion" |
| 80 |
ansible.builtin.async_status: |
| 81 |
jid: "{{ __foreman_rhel7_sync.ansible_job_id }}" |
| 82 |
register: __foreman_rhel7_job_result |
| 83 |
until: __foreman_rhel7_job_result is finished |
| 84 |
retries: 99999 |
| 85 |
delay: 10 |
| 86 |
when: foreman_content_rhel_enable_rhel7 and foreman_content_rhel_sync_now and foreman_content_rhel_wait_for_syncs |
| 87 |
|
| 88 |
- name: "Wait for RHEL8 sync completion" |
| 89 |
ansible.builtin.async_status: |
| 90 |
jid: "{{ __foreman_rhel8_sync.ansible_job_id }}" |
| 91 |
register: __foreman_rhel8_job_result |
| 92 |
until: __foreman_rhel8_job_result is finished |
| 93 |
retries: 99999 |
| 94 |
delay: 10 |
| 95 |
when: foreman_content_rhel_enable_rhel8 and foreman_content_rhel_sync_now and foreman_content_rhel_wait_for_syncs |