47 lines
1.9 KiB
YAML
47 lines
1.9 KiB
YAML
---
|
|
# Invoked post-reboot on the booted host, not in the chroot: subscription-manager
|
|
# needs a running systemd and the live network.
|
|
- name: Add the Satellite host to /etc/hosts
|
|
when: system_cfg.content.satellite.ip | length > 0
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/hosts
|
|
line: "{{ system_cfg.content.satellite.ip }} {{ system_cfg.content.satellite.host }}"
|
|
regexp: "[[:space:]]{{ system_cfg.content.satellite.host | regex_escape }}([[:space:]]|$)"
|
|
state: present
|
|
|
|
- name: Fetch the Katello CA consumer RPM
|
|
ansible.builtin.get_url:
|
|
url: >-
|
|
{{ system_cfg.content.satellite.ca_url
|
|
if (system_cfg.content.satellite.ca_url | length > 0)
|
|
else 'https://' ~ system_cfg.content.satellite.host ~ '/pub/katello-ca-consumer-latest.noarch.rpm' }}
|
|
dest: /tmp/katello-ca-consumer-latest.noarch.rpm
|
|
validate_certs: false
|
|
mode: "0644"
|
|
|
|
- name: Install the Katello CA consumer RPM
|
|
ansible.builtin.dnf:
|
|
name: /tmp/katello-ca-consumer-latest.noarch.rpm
|
|
state: present
|
|
disable_gpg_check: true
|
|
|
|
- name: Clean any stale subscription identity
|
|
ansible.builtin.command: subscription-manager clean
|
|
changed_when: true
|
|
|
|
- name: Register with Satellite via activation key
|
|
no_log: true
|
|
community.general.redhat_subscription:
|
|
state: present
|
|
server_hostname: "{{ system_cfg.content.satellite.host }}"
|
|
org_id: "{{ system_cfg.content.satellite.org }}"
|
|
activationkey: "{{ system_cfg.content.satellite.activation_key }}"
|
|
environment: "{{ system_cfg.content.satellite.environment | default(omit, true) }}"
|
|
auto_attach: true
|
|
force_register: true
|
|
server_proxy_hostname: "{{ (system_cfg.content.proxy | urlsplit('hostname')) | default(omit, true) }}"
|
|
server_proxy_port: "{{ (system_cfg.content.proxy | urlsplit('port')) | default(omit, true) }}"
|
|
syspurpose:
|
|
service_level_agreement: "{{ system_cfg.content.satellite.service_level | default(omit, true) }}"
|
|
sync: true
|