ansible-role-redhat-subscri.../tasks/main.yml

65 lines
1.6 KiB
YAML

- name: Ensure this is Red Hat
assert:
that: "ansible_facts.distribution == 'RedHat'"
tags:
- rhsm
- name: Inform the operators if both rhsm_activation_key and rhsm_repos are given
debug:
msg: "rhsm_repos and rhsm_activation_key are exclusive options when using Satellite"
when:
- not rhsm_simplified_content_access
- rhsm_repos | length > 0
- rhsm_activation_key is defined
- rhsm_method == 'satellite'
- name: Configure Red Hat Subscription Manager
template:
src: rhsm.conf.j2
dest: /etc/rhsm/rhsm.conf
owner: root
group: root
mode: 0644
tags:
- rhsm
- rhsm_conf
- name: Block to set rhsm_package_manager_config_file
when:
- rhsm_rhsm_proxy_hostname is defined
tags:
- rhsm
- rhsm_conf
block:
- name: Set rhsm_package_manager_config_file for yum
set_fact:
rhsm_package_manager_config_file: /etc/yum.conf
when:
- ansible_pkg_mgr == 'yum'
- name: Set rhsm_package_manager_config_file for dnf
set_fact:
rhsm_package_manager_config_file: /etc/dnf/dnf.conf
when:
- ansible_pkg_mgr == 'dnf'
- name: Configure proxy settings to package manager
when:
- rhsm_rhsm_proxy_hostname is defined
ini_file:
path: "{{ rhsm_package_manager_config_file }}"
section: main
option: proxy
value: "{{ rhsm_rhsm_proxy_proto | default('http') }}://{{ rhsm_rhsm_proxy_hostname }}:{{ rhsm_rhsm_proxy_port }}"
tags:
- rhsm
- rhsm_conf
- block:
- include_tasks: "{{ rhsm_method }}.yml"
tags:
- rhsm
- rhsm_register
- rhsm_repos
- rhsm_satellite
- rhsm_unregister