<commit_before>#!/usr/bin/python

# (c) <NAME>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.

DOCUMENTATION = '''
---
module: rhn_register
short_description: Manage Red Hat Network registration using the C(rhnreg_ks) command
description:
    - Manage registration to the Red Hat Network.
version_added: "1.2"
author: <NAME>
notes:
    - In order to register a system, rhnreg_ks requires either a username and password, or an activationkey.
requirements:
    - rhnreg_ks
options:
    state:
        description:
          - whether to register (C(present)), or unregister (C(absent)) a system
        required: false
        choices: [ "present", "absent" ]
        default: "present"
    username:
        description:
            - Red Hat Network username
        required: False
        default: null
    password:
        description:
            - Red Hat Network password
        required: False
        default: null
    server_url:
        description:
            - Specify an alternative Red Hat Network server URL
        required: False
        default: Current value of I(serverURL) from C(/etc/sysconfig/rhn/up2date) is the default
    activationkey:
        description:
            - supply an activation key for use with registration
        required: False
        default: null
    profilename:
        description:
            - supply an profilename for use with registration
        required: False
        default: null
        version_added: "2.0"
    sslcacert:
        description:
            - supply a custom ssl CA certificate file for use with registration
        required: False
        default: None
        version_added: "2.0"
    systemorgid:
        description:
            - supply an organizational id for use with registration
        required: False
        default: None
        version_added: "2.0"
    channels:
        description:
            - Optionally specify a list of comma-separated channels to subscribe to upon successful registration.
        required: false
        default: []
'''

EXAMPLES = '''
# Unregister system from RHN.
- rhn_register: state=absent username=joe_user password=<PASSWORD>

# Register as user (joe_user) with password (<PASSWORD>) and auto-subscribe to available content.
- rhn_register: state=present username=joe_user password=<PASSWORD>

# Register with activationkey (1-222333444) and enable extended update support.
- rhn_register: state=present activationkey=1-222333444 enable_eus=true

# Register with activationkey (1-222333444) and set a profilename which may differ from the hostname.
- rhn_register: state=present activationkey=1-222333444 profilename=host.example.com.custom

# Register as user (joe_user) with password (<PASSWORD>) against a satellite
# server specified by (server_url).
- rhn_register: >
    state=present
    username=joe_user
    password=<PASSWORD>
    server_url=https://xmlrpc.my.satellite/XMLRPC

# Register as user (joe_user) with password (<PASSWORD>) and enable
# channels (rhel-x86_64-server-6-foo-1) and (rhel-x86_64-server-6-bar-1).
- rhn_register: state=present username=joe_user
                password=<PASSWORD>
                channels=rhel-x86_64-server-6-foo-1,rhel-x86_64-server-6-bar-1<commit_msg>Change example syntax on rhn_register module<commit_after>#!/usr/bin/python

# (c) <NAME>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.

DOCUMENTATION = '''
---
module: rhn_register
short_description: Manage Red Hat Network registration using the C(rhnreg_ks) command
description:
    - Manage registration to the Red Hat Network.
version_added: "1.2"
author: <NAME>
notes:
    - In order to register a system, rhnreg_ks requires either a username and password, or an activationkey.
requirements:
    - rhnreg_ks
options:
    state:
        description:
          - whether to register (C(present)), or unregister (C(absent)) a system
        required: false
        choices: [ "present", "absent" ]
        default: "present"
    username:
        description:
            - Red Hat Network username
        required: False
        default: null
    password:
        description:
            - Red Hat Network password
        required: False
        default: null
    server_url:
        description:
            - Specify an alternative Red Hat Network server URL
        required: False
        default: Current value of I(serverURL) from C(/etc/sysconfig/rhn/up2date) is the default
    activationkey:
        description:
            - supply an activation key for use with registration
        required: False
        default: null
    profilename:
        description:
            - supply an profilename for use with registration
        required: False
        default: null
        version_added: "2.0"
    sslcacert:
        description:
            - supply a custom ssl CA certificate file for use with registration
        required: False
        default: None
        version_added: "2.0"
    systemorgid:
        description:
            - supply an organizational id for use with registration
        required: False
        default: None
        version_added: "2.0"
    channels:
        description:
            - Optionally specify a list of comma-separated channels to subscribe to upon successful registration.
        required: false
        default: []
'''

EXAMPLES = '''
# Unregister system from RHN.
- rhn_register:
    state: absent
    username: joe_user
    password: <PASSWORD>

# Register as user (joe_user) with password (<PASSWORD>) and auto-subscribe to available content.
- rhn_register:
    state: present
    username: joe_user
    password: <PASSWORD>

# Register with activationkey (1-222333444) and enable extended update support.
- rhn_register:
    state: present
    activationkey: 1-222333444
    enable_eus: true

# Register with activationkey (1-222333444) and set a profilename which may differ from the hostname.
- rhn_register:
    state: present
    activationkey: 1-222333444
    profilename: host.example.com.custom

# Register as user (joe_user) with password (<PASSWORD>) against a satellite
# server specified by (server_url).
- rhn_register:
    state: present
    username: joe_user
    password: <PASSWORD>'
    server_url: 'https://xmlrpc.my.satellite/XMLRPC'

# Register as user (joe_user) with password (<PASSWORD>) and enable
# channels (rhel-x86_64-server-6-foo-1) and (rhel-x86_64-server-6-bar-1).
- rhn_register:
    state: present
    username: joe_user
    password: <PASSWORD>
    channels: rhel-x86_64-server-6-foo-1,rhel-x86_64-server-6-bar-1
{'fraction_non_alphanumeric': 0.07573415765069552, 'fraction_numerical': 0.0190623390005152, 'mean_word_length': 2.8383588729609492, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 24, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '522128', 'n_tokens_mistral': 2235, 'n_tokens_neox': 2137, 'n_words': 794}