Retire Tripleo: remove repo content
TripleO project is retiring - https://review.opendev.org/c/openstack/governance/+/905145 this commit remove the content of this project repo Change-Id: I6b367027aff77f4bf9810903e62ccb59bca0ff38
This commit is contained in:
parent
eefe501923
commit
340d059ee5
@ -1,8 +0,0 @@
|
||||
skip_list: # or 'skip_list' to silence them completely
|
||||
- command-instead-of-shell # Use shell only when shell functionality is required
|
||||
- experimental # all rules tagged as experimental
|
||||
- no-changed-when # Commands should not change things if nothing needs doing
|
||||
- no-handler # Tasks that run when changed should likely be handlers
|
||||
- package-latest # Package installs should not use latest
|
||||
- role-name # Role name {0} does not match ``^[a-z][a-z0-9_]+$`` pattern
|
||||
- fqcn-builtins # Use FQCN for builtin actions.
|
66
.gitignore
vendored
66
.gitignore
vendored
@ -1,66 +0,0 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
sdist/
|
||||
var/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*,cover
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
|
||||
# Sphinx documentation
|
||||
doc/build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# virtualenv
|
||||
.venv/
|
||||
|
||||
# jenkins config
|
||||
jenkins/config.ini
|
||||
playbooks/debug.yml
|
||||
|
||||
# Editors
|
||||
.*.sw[klmnop]
|
||||
/tests/vars/satellite.yml
|
201
LICENSE
201
LICENSE
@ -1,201 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
125
README.md
125
README.md
@ -1,125 +0,0 @@
|
||||
Red Hat Subscription
|
||||
====================
|
||||
[![Galaxy](https://img.shields.io/badge/galaxy-openstack.redhat--subscription-blue.svg?style=flat)](https://galaxy.ansible.com/openstack/redhat-subscription)
|
||||
|
||||
Manage Red Hat subscriptions and repositories. This role supports registering to Satellite 5, Satellite 6, or the Red Hat Customer Portal.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
You will need to have an active Red Hat subscription in order for registration to succeed.
|
||||
|
||||
Provide `rhsm_username` and `rhsm_password` _or_ `rhsm_activation_key`. These options are mutually exclusive and providing both will result in a failure. The recommended option is to provide an activation key rather than username and password.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
| Name | Default Value | Description |
|
||||
|-------------------|---------------------|----------------------|
|
||||
| `rhsm_method` | `portal` | Method to use for activation: `portal` or `satellite`. If `satellite`, the role will determine the Satellite Server version and take the appropriate registration actions. |
|
||||
| `rhsm_username` | `[undefined]` | Red Hat Portal username. |
|
||||
| `rhsm_password` | `[undefined]` | Red Hat Portal password. |
|
||||
| `rhsm_activation_key` | `[undefined]` | Red Hat Portal Activation Key. |
|
||||
| `rhsm_release` | `[undefined]` | RHEL release version (e.g. 8.1). |
|
||||
| `rhsm_org_id` | `[undefined]` | Red Hat Portal Organization Identifier. |
|
||||
| `rhsm_pool_ids` | `[undefined]` | Red Hat Subscription pool IDs to consume. |
|
||||
| `rhsm_state` | `present` | Whether to enable or disable a Red Hat subscription. |
|
||||
| `rhsm_autosubscribe` | `[undefined]` | Whether or not to autosubscribe to available repositories. |
|
||||
| `rhsm_consumer_hostname` | `[undefined]` | Name of the system to use when registering. Defaults to using the system hostname if undefined. |
|
||||
| `rhsm_force_register` | `False` | Whether or not to force registration. |
|
||||
| `rhsm_repos` | `[]` | The list of repositories to enable or disable. |
|
||||
| `rhsm_repos_state` | `[undefined]` | The state of all repos in `rhsm_repos`. The module default is `enabled`.|
|
||||
| `rhsm_repos_purge` | `[undefined]` | Whether or not to disable repos not specified in `rhsm_repos`. The module default is `False`. |
|
||||
| `rhsm_rhsm_port` | `443` | Port to use when connecting to subscription server. Must be 8443 if a capsule is used otherwise 443 for Satellite or RHN. |
|
||||
| `rhsm_server_hostname` | `subscription.rhn.redhat.com` | FQDN of subscription server. |
|
||||
| `rhsm_server_prefix` | `/subscription` or `/rhsm` | RHS server prefix. `/subscription` when using registering via `portal`, `/rhsm` when registering via `satellite`. |
|
||||
| `rhsm_insecure` | `False` | Disable certificate validation. |
|
||||
| `rhsm_simplified_content_access` | `False` | Enable Simplified Content Access. |
|
||||
| `rhsm_ssl_verify_depth` | `3` | Depths certificates should be validated when checking. |
|
||||
| `rhsm_rhsm_proxy_proto` | `[undefined]` | protocol used to reach the proxy server (http or https). |
|
||||
| `rhsm_rhsm_proxy_hostname` | `[undefined]` | FQDN of outbound proxy server. |
|
||||
| `rhsm_rhsm_proxy_port` | `[undefined]` | Port to use for proxy server. |
|
||||
| `rhsm_rhsm_proxy_user` | `[undefined]` | Username to use for proxy server. |
|
||||
| `rhsm_rhsm_proxy_password` | `[undefined]` | Password to use for proxy server. Save this in an Ansible Vault or other secret store. |
|
||||
| `rhsm_baseurl` | `https://cdn.redhat.com` | Base URL for content. |
|
||||
| `rhsm_satellite_url` | `[see defaults/main.yml]` | URL of the Satellite server that will be probed to determine the Satellite version. Uses the scheme and hostname of `rhsm_baseurl` by default. |
|
||||
| `rhsm_ca_cert_dir` | `/etc/rhsm/ca/` | Server CA certificate directory. |
|
||||
| `rhsm_product_cert_dir` | `/etc/pki/product` | Product certificate directory. |
|
||||
| `rhsm_entitlement_cert_dir` | `/etc/pki/entitlement` | Entitlement certificate directory. |
|
||||
| `rhsm_consumer_cert_dir` | `/etc/pki/consumer` | Consumer certificate directory. |
|
||||
| `rhsm_manage_repos` | `True` | Manage generation of yum repositories for subscribed content. |
|
||||
| `rhsm_full_refresh_on_yum` | `False` | Refresh repo files with server overrides on every `yum` command. |
|
||||
| `rhsm_report_package_profile` | `True` | Whether to report the package profiles to the subscription management service. |
|
||||
| `rhsm_plugin_dir` | `/usr/share/rhsm-plugins` | Directory to search for subscription manage plugins. |
|
||||
| `rhsm_plugin_conf_dir` | `/etc/rhsm/pluginconf.d` | Directory to search for plugin configuration files. |
|
||||
| `rhsm_cert_check_interval` | `240` | Interval in minutes to run certificate check. |
|
||||
| `rhsm_auto_attach_interval` | `1440` | Interval in minutes to run auto-attach. |
|
||||
| `rhsm_logging` | [see `defaults/main.yml`] | Logging settings for various RHSM components. |
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
|
||||
About repositories
|
||||
------------------
|
||||
|
||||
If you are using an activation key with Satellite, the repositories that are
|
||||
associated to the subscription are configured in your local instance of Satellite.
|
||||
You can't specify rhsm_repos parameter if you are using rhsm_activation_key with
|
||||
Satellite.
|
||||
Otherwise, when using Portal registration method you can use either rhsm_username and
|
||||
rhsm_password or activation key and you can use rhsm_repos to select which repos get deployed.
|
||||
|
||||
|
||||
Example Playbook with Red Hat portal
|
||||
------------------------------------
|
||||
|
||||
::
|
||||
|
||||
- hosts: all
|
||||
vars:
|
||||
rhsm_username: bob.smith@acme.com
|
||||
rhsm_password: "{{ vault_rhsm_password }}"
|
||||
rhsm_repos:
|
||||
- rhel-7-server-rpms
|
||||
- rhel-7-server-extras-rpms
|
||||
- rhel-7-server-rh-common-rpms
|
||||
- rhel-ha-for-rhel-7-server-rpms
|
||||
roles:
|
||||
- openstack.redhat-subscription
|
||||
|
||||
Example Playbook with Satellite 6
|
||||
---------------------------------
|
||||
|
||||
::
|
||||
|
||||
- hosts: all
|
||||
vars:
|
||||
rhsm_activation_key: "secrete_key"
|
||||
rhsm_org_id: "Default_Organization"
|
||||
rhsm_server_hostname: "mysatserver.com"
|
||||
rhsm_baseurl: "https://mysatserver.com/pulp/repos"
|
||||
rhsm_method: satellite
|
||||
rhsm_insecure: true
|
||||
roles:
|
||||
- openstack.redhat-subscription
|
||||
|
||||
Example Playbook to unregister
|
||||
------------------------------
|
||||
|
||||
::
|
||||
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: Unregister the node
|
||||
include_role:
|
||||
name: openstack.redhat-subscription
|
||||
tasks_from: unregister
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Apache 2.0
|
||||
|
10
README.rst
Normal file
10
README.rst
Normal file
@ -0,0 +1,10 @@
|
||||
This project is no longer maintained.
|
||||
|
||||
The contents of this repository are still available in the Git
|
||||
source code management system. To see the contents of this
|
||||
repository before it reached its end of life, please check out the
|
||||
previous commit with "git checkout HEAD^1".
|
||||
|
||||
For any further questions, please email
|
||||
openstack-discuss@lists.openstack.org or join #openstack-dev on
|
||||
OFTC.
|
@ -1,6 +0,0 @@
|
||||
# These are required here because ansible can't be in global-requirements due
|
||||
# to licensing conflicts. But we sill need to be able to pull them in for
|
||||
# lint checks and want to document these as ansible specific things that may
|
||||
# be required for this repository.
|
||||
ansible-core<2.12
|
||||
ansible-lint
|
12
ansible.cfg
12
ansible.cfg
@ -1,12 +0,0 @@
|
||||
[defaults]
|
||||
gathering = smart
|
||||
command_warnings = False
|
||||
retry_files_enabled = False
|
||||
callback_whitelist = profile_tasks
|
||||
|
||||
# Attempt to load custom modules whether it's installed system-wide or from a virtual environment
|
||||
roles_path = roles:$VIRTUAL_ENV/usr/share/ansible/roles/redhat-subscription:$VIRTUAL_ENV/usr/local/share/
|
||||
|
||||
|
||||
[ssh_connection]
|
||||
control_path = %(directory)s/%C
|
@ -1,48 +0,0 @@
|
||||
# These parameters aren't required, so no default is provided:
|
||||
# rhsm_username: joe
|
||||
# rhsm_password: secrete
|
||||
# rhsm_activation_key: AAA-BBB-CCC-DDD
|
||||
# rhsm_release: 8.1
|
||||
# rhsm_ord_id: 1234
|
||||
# rhsm_autosubscribe: true # or no (note it's mutually exclusive to rhsm_activation_key)
|
||||
|
||||
rhsm_state: present # present or absent
|
||||
rhsm_method: portal # portal or satellite
|
||||
rhsm_force_register: false
|
||||
|
||||
rhsm_repos: []
|
||||
|
||||
## /etc/rhsm/rhsm.conf settings
|
||||
# Port must be changed to 8443 if registration is done against a capsule.
|
||||
rhsm_rhsm_port: 443
|
||||
rhsm_server_hostname: subscription.rhn.redhat.com
|
||||
rhsm_server_prefix: "{{ '/rhsm' if rhsm_method == 'satellite' else '/subscription' }}"
|
||||
rhsm_insecure: false
|
||||
rhsm_simplified_content_access: false
|
||||
rhsm_ssl_verify_depth: 3
|
||||
# rhsm_rhsm_proxy_proto: ""
|
||||
# rhsm_rhsm_proxy_hostname: ""
|
||||
# rhsm_rhsm_proxy_port: ""
|
||||
# rhsm_rhsm_proxy_user: ""
|
||||
# rhsm_rhsm_proxy_password: ""
|
||||
rhsm_baseurl: https://cdn.redhat.com
|
||||
rhsm_satellite_url: "{{ rhsm_baseurl | urlsplit('scheme') ~ '://' ~ rhsm_baseurl | urlsplit('hostname') }}"
|
||||
rhsm_ca_cert_dir: /etc/rhsm/ca/
|
||||
rhsm_product_cert_dir: /etc/pki/product
|
||||
rhsm_entitlement_cert_dir: /etc/pki/entitlement
|
||||
rhsm_consumer_cert_dir: /etc/pki/consumer
|
||||
rhsm_manage_repos: true
|
||||
rhsm_full_refresh_on_yum: false
|
||||
rhsm_report_package_profile: true
|
||||
rhsm_plugin_dir: /usr/share/rhsm-plugins
|
||||
rhsm_plugin_conf_dir: /etc/rhsm/pluginconf.d
|
||||
rhsm_cert_check_interval: 240
|
||||
rhsm_auto_attach_interval: 1440
|
||||
rhsm_logging:
|
||||
default: INFO
|
||||
# subscription_manager: DEBUG
|
||||
# subscription_manager_managercli: DEBUG
|
||||
# rhsm: DEBUG
|
||||
# rhsm_connection: DEBUG
|
||||
# rhsm_app: DEBUG
|
||||
# rhsm_app_rhsmd: DEBUG
|
@ -1,294 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# Copyright (c) 2017 OpenStack Foundation
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from copy import deepcopy
|
||||
from fnmatch import fnmatch
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
||||
# TODO(jfrancoa): Rename back into rhsm_repository once
|
||||
# Ansible 2.8 is used.
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: rhsm_repository_conf
|
||||
short_description:
|
||||
- Manage RHSM repositories using the subscription-manager command
|
||||
description:
|
||||
- Manage(Enable/Disable) RHSM repositories to the Red Hat Subscription
|
||||
Management entitlement platform using the C(subscription-manager) command.
|
||||
version_added: '2.5'
|
||||
author: Giovanni Sciortino (@giovannisciortino)
|
||||
notes:
|
||||
- In order to manage RHSM repositories the system must be already registered
|
||||
to RHSM manually or using the Ansible C(redhat_subscription) module.
|
||||
|
||||
requirements:
|
||||
- subscription-manager
|
||||
options:
|
||||
state:
|
||||
description:
|
||||
- If state is equal to present or disabled, indicates the desired
|
||||
repository state.
|
||||
choices: [present, enabled, absent, disabled]
|
||||
required: true
|
||||
default: "present"
|
||||
name:
|
||||
description:
|
||||
- The ID of repositories to enable.
|
||||
- To operate on several repositories this can accept a comma separated
|
||||
list or a YAML list.
|
||||
required: true
|
||||
purge:
|
||||
description:
|
||||
- Disable any repositories not listed in the task.
|
||||
type: bool
|
||||
default: false
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Enable a RHSM repository
|
||||
rhsm_repository_conf:
|
||||
name: rhel-7-server-rpms
|
||||
|
||||
- name: Disable all RHSM repositories
|
||||
rhsm_repository_conf:
|
||||
name: '*'
|
||||
state: disabled
|
||||
|
||||
- name: Enable all repositories starting with rhel-6-server
|
||||
rhsm_repository_conf:
|
||||
name: rhel-6-server*
|
||||
state: enabled
|
||||
|
||||
- name: Disable all repositories except rhel-7-server-rpms
|
||||
rhsm_repository_conf:
|
||||
name: rhel-7-server-rpms
|
||||
purge: true
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
repositories:
|
||||
description:
|
||||
- The list of RHSM repositories with their states.
|
||||
- When this module is used to change the repositories states, this list
|
||||
contains the updated states after the changes.
|
||||
returned: success
|
||||
type: list
|
||||
'''
|
||||
|
||||
|
||||
def run_subscription_manager(module, arguments):
|
||||
# Execute subuscription-manager with arguments and manage common errors
|
||||
rhsm_bin = module.get_bin_path('subscription-manager')
|
||||
if not rhsm_bin:
|
||||
module.fail_json(
|
||||
msg='The executable file subscription-manager was '
|
||||
'not found in PATH')
|
||||
|
||||
lang_env = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C')
|
||||
rc, out, err = module.run_command("%s %s" % (rhsm_bin, " ".join(
|
||||
arguments)), environ_update=lang_env)
|
||||
|
||||
if rc == 1 and (err == 'The password you typed is invalid.\nPlease try '
|
||||
'again.\n' or os.getuid() != 0):
|
||||
module.fail_json(msg='The executable file subscription-manager must '
|
||||
'be run using root privileges')
|
||||
elif rc == 0 and out == \
|
||||
'This system has no repositories available through subscriptions.\n':
|
||||
module.fail_json(
|
||||
msg='This system has no repositories available through '
|
||||
'subscriptions')
|
||||
elif rc == 1:
|
||||
module.fail_json(msg='subscription-manager failed with the following '
|
||||
'error: %s' % err)
|
||||
else:
|
||||
return rc, out, err
|
||||
|
||||
|
||||
def get_repository_list(module, list_parameter):
|
||||
# Generate RHSM repository list and return a list of dict
|
||||
if list_parameter == 'list_enabled':
|
||||
rhsm_arguments = ['repos', '--list-enabled']
|
||||
elif list_parameter == 'list_disabled':
|
||||
rhsm_arguments = ['repos', '--list-disabled']
|
||||
elif list_parameter == 'list':
|
||||
rhsm_arguments = ['repos', '--list']
|
||||
rc, out, err = run_subscription_manager(module, rhsm_arguments)
|
||||
|
||||
skip_lines = [
|
||||
'+----------------------------------------------------------+',
|
||||
' Available Repositories in /etc/yum.repos.d/redhat.repo'
|
||||
]
|
||||
repo_id_re = re.compile(r'Repo ID:\s+(.*)')
|
||||
repo_name_re = re.compile(r'Repo Name:\s+(.*)')
|
||||
repo_url_re = re.compile(r'Repo URL:\s+(.*)')
|
||||
repo_enabled_re = re.compile(r'Enabled:\s+(.*)')
|
||||
|
||||
repo_id = ''
|
||||
repo_name = ''
|
||||
repo_url = ''
|
||||
repo_enabled = ''
|
||||
|
||||
repo_result = []
|
||||
for line in out.splitlines():
|
||||
if line == '' or line in skip_lines:
|
||||
continue
|
||||
|
||||
repo_id_match = repo_id_re.match(line)
|
||||
if repo_id_match:
|
||||
repo_id = repo_id_match.group(1)
|
||||
continue
|
||||
|
||||
repo_name_match = repo_name_re.match(line)
|
||||
if repo_name_match:
|
||||
repo_name = repo_name_match.group(1)
|
||||
continue
|
||||
|
||||
repo_url_match = repo_url_re.match(line)
|
||||
if repo_url_match:
|
||||
repo_url = repo_url_match.group(1)
|
||||
continue
|
||||
|
||||
repo_enabled_match = repo_enabled_re.match(line)
|
||||
if repo_enabled_match:
|
||||
repo_enabled = repo_enabled_match.group(1)
|
||||
|
||||
repo = {
|
||||
"id": repo_id,
|
||||
"name": repo_name,
|
||||
"url": repo_url,
|
||||
"enabled": True if repo_enabled == '1' else False
|
||||
}
|
||||
|
||||
repo_result.append(repo)
|
||||
|
||||
return repo_result
|
||||
|
||||
|
||||
def repository_modify(module, state, name, purge=False):
|
||||
name = set(name)
|
||||
current_repo_list = get_repository_list(module, 'list')
|
||||
updated_repo_list = deepcopy(current_repo_list)
|
||||
matched_existing_repo = {}
|
||||
for repoid in name:
|
||||
matched_existing_repo[repoid] = []
|
||||
for idx, repo in enumerate(current_repo_list):
|
||||
if fnmatch(repo['id'], repoid):
|
||||
matched_existing_repo[repoid].append(repo)
|
||||
# Update current_repo_list to return it as result variable
|
||||
updated_repo_list[idx]['enabled'] = True \
|
||||
if state == 'enabled' else False
|
||||
|
||||
changed = False
|
||||
results = []
|
||||
diff_before = ""
|
||||
diff_after = ""
|
||||
rhsm_arguments = ['repos']
|
||||
|
||||
for repoid in matched_existing_repo:
|
||||
if len(matched_existing_repo[repoid]) == 0:
|
||||
results.append("%s is not a valid repository ID" % repoid)
|
||||
module.fail_json(
|
||||
results=results,
|
||||
msg="%s is not a valid repository ID" % repoid)
|
||||
for repo in matched_existing_repo[repoid]:
|
||||
if state in ['disabled', 'absent']:
|
||||
if repo['enabled']:
|
||||
changed = True
|
||||
diff_before += "Repository '%s' is enabled for this " \
|
||||
"system\n" % repo['id']
|
||||
diff_after += "Repository '%s' is disabled for this " \
|
||||
"system\n" % repo['id']
|
||||
results.append(
|
||||
"Repository '%s' is disabled for this system" % repo['id'])
|
||||
rhsm_arguments += ['--disable', repo['id']]
|
||||
|
||||
elif state in ['enabled', 'present']:
|
||||
if not repo['enabled']:
|
||||
changed = True
|
||||
diff_before += "Repository '%s' is disabled for this " \
|
||||
"system\n" % repo['id']
|
||||
diff_after += "Repository '%s' is enabled for this " \
|
||||
"system\n" % repo['id']
|
||||
results.append("Repository '%s' is enabled for this "
|
||||
"system" % repo['id'])
|
||||
rhsm_arguments += ['--enable', repo['id']]
|
||||
|
||||
# Disable all enabled repos on the system that are not in the task and not
|
||||
# marked as disabled by the task
|
||||
if purge:
|
||||
enabled_repo_ids = set(repo['id'] for repo in updated_repo_list
|
||||
if repo['enabled'])
|
||||
matched_repoids_set = set(matched_existing_repo.keys())
|
||||
difference = enabled_repo_ids.difference(matched_repoids_set)
|
||||
if len(difference) > 0:
|
||||
for repoid in difference:
|
||||
changed = True
|
||||
diff_before.join("Repository '{repoid}'' is enabled for this "
|
||||
"system\n".format(repoid=repoid))
|
||||
diff_after.join("Repository '{repoid}' is disabled for this "
|
||||
"system\n".format(repoid=repoid))
|
||||
results.append("Repository '{repoid}' is disabled for this "
|
||||
"system".format(repoid=repoid))
|
||||
rhsm_arguments.extend(['--disable', repoid])
|
||||
|
||||
diff = {'before': diff_before,
|
||||
'after': diff_after,
|
||||
'before_header': "RHSM repositories",
|
||||
'after_header': "RHSM repositories"}
|
||||
|
||||
if not module.check_mode:
|
||||
rc, out, err = run_subscription_manager(module, rhsm_arguments)
|
||||
results = out.splitlines()
|
||||
module.exit_json(
|
||||
results=results,
|
||||
changed=changed,
|
||||
repositories=updated_repo_list,
|
||||
diff=diff)
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
name=dict(type='list', required=True),
|
||||
state=dict(
|
||||
choices=['enabled', 'disabled', 'present', 'absent'],
|
||||
default='enabled'),
|
||||
purge=dict(type='bool', default=False),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
name = module.params['name']
|
||||
state = module.params['state']
|
||||
purge = module.params['purge']
|
||||
|
||||
repository_modify(module, state, name, purge)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -1,18 +0,0 @@
|
||||
galaxy_info:
|
||||
role_name: redhat-subscription
|
||||
author: tripleo
|
||||
description: "Manage Red Hat subscription and repositories."
|
||||
company:
|
||||
license: Apache 2.0
|
||||
min_ansible_version: 2.5
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 6
|
||||
- 7
|
||||
- 8
|
||||
galaxy_tags:
|
||||
- system
|
||||
- redhat
|
||||
- subscription
|
||||
dependencies: []
|
@ -1 +0,0 @@
|
||||
pbr>=1.6
|
38
setup.cfg
38
setup.cfg
@ -1,38 +0,0 @@
|
||||
[metadata]
|
||||
name = ansible-role-redhat-subscription
|
||||
summary = ansible-role-redhat-subscription - An ansible role to Manage Red Hat subscritions and repositories
|
||||
description_file =
|
||||
README.md
|
||||
author = Sam Doran
|
||||
author_email = sdoran@redhat.com
|
||||
home_page = https://github.com/openstack/ansible-role-redhat-subscription
|
||||
classifier =
|
||||
License :: OSI Approved :: Apache Software License
|
||||
Development Status :: 4 - Beta
|
||||
Intended Audience :: Developers
|
||||
Intended Audience :: System Administrators
|
||||
Intended Audience :: Information Technology
|
||||
Topic :: Utilities
|
||||
|
||||
[global]
|
||||
setup_hooks =
|
||||
pbr.hooks.setup_hook
|
||||
|
||||
[files]
|
||||
data_files =
|
||||
/usr/share/ansible/roles/redhat-subscription/defaults = defaults/*
|
||||
/usr/share/ansible/roles/redhat-subscription/handlers = handlers/*
|
||||
/usr/share/ansible/roles/redhat-subscription/library = library/*
|
||||
/usr/share/ansible/roles/redhat-subscription/meta = meta/*
|
||||
/usr/share/ansible/roles/redhat-subscription/tasks = tasks/*
|
||||
/usr/share/ansible/roles/redhat-subscription/templates = templates/*
|
||||
/usr/share/ansible/roles/redhat-subscription/tests = tests/*
|
||||
/usr/share/ansible/roles/redhat-subscription/vars = vars/*
|
||||
/usr/share/ansible/roles/redhat-subscription/files = files/*
|
||||
|
||||
[wheel]
|
||||
universal = 1
|
||||
|
||||
[pbr]
|
||||
skip_authors = True
|
||||
skip_changelog = True
|
21
setup.py
21
setup.py
@ -1,21 +0,0 @@
|
||||
# Copyright Red Hat, Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr'],
|
||||
pbr=True,
|
||||
py_modules=[],
|
||||
long_description_content_type='text/markdown')
|
@ -1,65 +0,0 @@
|
||||
- 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_facts['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_facts['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 }}"
|
||||
mode: 0644
|
||||
tags:
|
||||
- rhsm
|
||||
- rhsm_conf
|
||||
|
||||
- block:
|
||||
- include_tasks: "{{ rhsm_method }}.yml"
|
||||
tags:
|
||||
- rhsm
|
||||
- rhsm_register
|
||||
- rhsm_repos
|
||||
- rhsm_satellite
|
||||
- rhsm_unregister
|
@ -1,51 +0,0 @@
|
||||
- block:
|
||||
- import_tasks: register.yml
|
||||
|
||||
rescue:
|
||||
- block:
|
||||
- name: Manage Red Hat subscription (force)
|
||||
redhat_subscription:
|
||||
username: "{{ rhsm_username | default(omit) }}"
|
||||
password: "{{ rhsm_password | default(omit) }}"
|
||||
activationkey: "{{ rhsm_activation_key | default(omit) }}"
|
||||
release: "{{ rhsm_release | default(omit) }}"
|
||||
org_id: "{{ rhsm_org_id | default(omit) }}"
|
||||
pool_ids: "{{ rhsm_pool_ids | default(omit) }}"
|
||||
state: "{{ rhsm_state | default(omit) }}"
|
||||
autosubscribe: "{{ rhsm_autosubscribe | default(omit) }}"
|
||||
consumer_name: "{{ rhsm_consumer_hostname | default(omit) }}"
|
||||
force_register: true
|
||||
rhsm_baseurl: "{{ rhsm_baseurl | default(omit) }}"
|
||||
server_proxy_hostname: "{{ rhsm_rhsm_proxy_hostname | default(omit) }}"
|
||||
server_proxy_port: "{{ rhsm_rhsm_proxy_port | default(omit) }}"
|
||||
server_proxy_user: "{{ rhsm_rhsm_proxy_user | default(omit) }}"
|
||||
server_proxy_password: "{{ rhsm_rhsm_proxy_password | default(omit) }}"
|
||||
register: subscrition_result
|
||||
environment:
|
||||
SMDEV_CONTAINER_OFF: "{{ rhsm_disable_container_check }}"
|
||||
tags:
|
||||
- rhsm
|
||||
- rhsm_register
|
||||
|
||||
rescue:
|
||||
- name: Clean all local subscription data
|
||||
command: subscription-manager clean
|
||||
environment:
|
||||
SMDEV_CONTAINER_OFF: "{{ rhsm_disable_container_check }}"
|
||||
|
||||
- import_tasks: register.yml
|
||||
|
||||
- name: Configure repository subscriptions
|
||||
# TODO(jfrancoa): Change back into rhsm_repository once
|
||||
# we start using Ansible 2.8.
|
||||
rhsm_repository_conf:
|
||||
name: "{{ rhsm_repos }}"
|
||||
purge: "{{ rhsm_repos_purge | default(omit) }}"
|
||||
state: "{{ rhsm_repos_state | default(omit) }}"
|
||||
when:
|
||||
- rhsm_repos | length > 0
|
||||
- rhsm_state == 'present'
|
||||
- rhsm_activation_key is not defined or rhsm_method == 'portal' or rhsm_simplified_content_access
|
||||
tags:
|
||||
- rhsm
|
||||
- rhsm_repos
|
@ -1,33 +0,0 @@
|
||||
- name: Manage Red Hat subscription
|
||||
redhat_subscription:
|
||||
username: "{{ rhsm_username | default(omit) }}"
|
||||
password: "{{ rhsm_password | default(omit) }}"
|
||||
activationkey: "{{ rhsm_activation_key | default(omit) }}"
|
||||
org_id: "{{ rhsm_org_id | default(omit) }}"
|
||||
release: "{{ rhsm_release | default(omit) }}"
|
||||
pool_ids: "{{ rhsm_pool_ids | default(omit) }}"
|
||||
state: "{{ rhsm_state | default(omit) }}"
|
||||
autosubscribe: "{{ rhsm_autosubscribe | default(omit) }}"
|
||||
consumer_name: "{{ rhsm_consumer_hostname | default(omit) }}"
|
||||
force_register: "{{ rhsm_force_register | default(omit) }}"
|
||||
rhsm_baseurl: "{{ rhsm_baseurl | default(omit) }}"
|
||||
server_proxy_hostname: "{{ rhsm_rhsm_proxy_hostname | default(omit) }}"
|
||||
server_proxy_port: "{{ rhsm_rhsm_proxy_port | default(omit) }}"
|
||||
server_proxy_user: "{{ rhsm_rhsm_proxy_user | default(omit) }}"
|
||||
server_proxy_password: "{{ rhsm_rhsm_proxy_password | default(omit) }}"
|
||||
register: subscrition_result
|
||||
environment:
|
||||
SMDEV_CONTAINER_OFF: "{{ rhsm_disable_container_check }}"
|
||||
tags:
|
||||
- rhsm
|
||||
- rhsm_register
|
||||
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1715958
|
||||
# A regression in Satellite added a delay to the registration to happen.
|
||||
# To counter this problem we retry 5 times with a delay of 10 seconds between
|
||||
# retries.
|
||||
retries: 5
|
||||
delay: 10
|
||||
until: not subscrition_result.failed
|
||||
failed_when:
|
||||
- "subscrition_result.stdout is defined"
|
||||
- "'The system has been registered' not in subscrition_result.stdout"
|
@ -1,8 +0,0 @@
|
||||
- name: SATELLITE 5 | Install TLS certificate
|
||||
uri:
|
||||
url: "{{ rhsm_satellite_url }}/pub/rhsm_ORG_TRUSTED_SSL_CERT"
|
||||
dest: /usr/share/rhn
|
||||
validate_certs: false
|
||||
|
||||
- name: SATELLITE 5 | Register to Satellite 5
|
||||
command: rhreg_ks --serverURL='{{ rhsm_satellite_url }}/XMLRPC'
|
@ -1,45 +0,0 @@
|
||||
- name: SATELLITE 6 | Set Satellite server CA as a fact
|
||||
set_fact:
|
||||
rhsm_katello_ca: "{{ lookup('url', rhsm_satellite_url ~ '/pub/katello-server-ca.crt', validate_certs=False, split_lines=False) }}"
|
||||
|
||||
- block:
|
||||
- name: Ensure appropriate version of subscription-manager is installed
|
||||
assert:
|
||||
fail_msg: The installed version of subscription-manager is too old.
|
||||
that:
|
||||
- ansible_facts['packages']['subscription-manager'][0]['version'] is version_compare('1.10', '>=')
|
||||
rescue:
|
||||
- name: Attempt to update subscription-manager
|
||||
yum:
|
||||
name: subscription-manager
|
||||
state: latest
|
||||
|
||||
- name: Ensure appropriate version of subscription-manager is installed
|
||||
assert:
|
||||
fail_msg: The installed version of subscription-manager is too old.
|
||||
that:
|
||||
- ansible_facts['packages']['subscription-manager'][0]['version'] is version_compare('1.10', '>=')
|
||||
|
||||
- name: Configure yum plugins
|
||||
ini_file:
|
||||
path: /etc/yum/pluginconf.d/{{ item.file }}
|
||||
section: "{{ item.section | default('main') }}"
|
||||
option: "{{ item.option }}"
|
||||
value: "{{ item.value }}"
|
||||
loop: "{{ rhsm_yum_plugins }}"
|
||||
|
||||
- name: SATELLITE 6 | Install katello-ca-consumer
|
||||
yum:
|
||||
name: "{{ rhsm_satellite_url }}/pub/katello-ca-consumer-latest.noarch.rpm"
|
||||
state: present
|
||||
validate_certs: false
|
||||
disable_gpg_check: true
|
||||
register: katello_rpm
|
||||
|
||||
# This script is provided by katello-ca-consumer and takes care of deploying
|
||||
# the katello certificates and prepare the config in RHSM.
|
||||
- name: SATELLITE 6 | Execute katello-rhsm-consumer
|
||||
shell: katello-rhsm-consumer
|
||||
environment:
|
||||
SMDEV_CONTAINER_OFF: "{{ rhsm_disable_container_check }}"
|
||||
when: katello_rpm.changed
|
@ -1,112 +0,0 @@
|
||||
- name: SATELLITE | Check for Satellite 5
|
||||
uri:
|
||||
url: "{{ rhsm_satellite_url }}/rhn/Login.do"
|
||||
validate_certs: false
|
||||
status_code:
|
||||
- 200
|
||||
- 404
|
||||
register: _sat5_check
|
||||
retries: 3
|
||||
delay: 5
|
||||
until: "'status' in _sat5_check"
|
||||
run_once: true
|
||||
ignore_errors: true
|
||||
tags:
|
||||
- rhsm_satellite
|
||||
|
||||
- name: SATELLITE | Check for Satellite 6
|
||||
uri:
|
||||
url: "{{ rhsm_satellite_url }}/pulp/api/v2/status/"
|
||||
validate_certs: false
|
||||
status_code:
|
||||
- 200
|
||||
register: _sat6_check_v6
|
||||
retries: 3
|
||||
delay: 5
|
||||
until: "'status' in _sat6_check_v6"
|
||||
run_once: true
|
||||
ignore_errors: true
|
||||
tags:
|
||||
- rhsm_satellite
|
||||
|
||||
- name: Set correct v6 check result
|
||||
set_fact:
|
||||
_sat6_check: "{{ _sat6_check_v6 }}"
|
||||
when:
|
||||
- _sat6_check_v6 is success
|
||||
|
||||
- name: Block Satellite 6.10
|
||||
when:
|
||||
- _sat6_check_v6 is failed
|
||||
block:
|
||||
- name: SATELLITE | Check for Satellite 6.10
|
||||
uri:
|
||||
url: "{{ rhsm_satellite_url }}/pulp/api/v3/status/"
|
||||
validate_certs: false
|
||||
status_code:
|
||||
- 200
|
||||
- 404
|
||||
register: _sat6_check_v610
|
||||
run_once: true
|
||||
retries: 3
|
||||
delay: 5
|
||||
until: "'status' in _sat6_check_v610"
|
||||
tags:
|
||||
- rhsm_satellite
|
||||
|
||||
- name: Set correct v6.10 check result
|
||||
set_fact:
|
||||
_sat6_check: "{{ _sat6_check_v610 }}"
|
||||
|
||||
- name: SATELLITE | Gather service facts
|
||||
service_facts:
|
||||
|
||||
- name: SATELLITE | Start and enable rhsmcertsd
|
||||
service:
|
||||
name: rhsmcertd
|
||||
state: started
|
||||
enabled: true
|
||||
when:
|
||||
- "'rhsmcertd' in (ansible_facts.services.keys() | replace('.service', ''))"
|
||||
|
||||
- name: SATELLITE | Set Satellite version 5
|
||||
set_fact:
|
||||
rhsm_satellite_version: 5
|
||||
when:
|
||||
- (_sat5_check.status | default(400)) == 200
|
||||
tags:
|
||||
- rhsm_satellite
|
||||
|
||||
- name: SATELLITE | Set Satellite version 6
|
||||
set_fact:
|
||||
rhsm_satellite_version: 6
|
||||
when:
|
||||
- (_sat6_check.status | default(400)) == 200
|
||||
tags:
|
||||
- rhsm_satellite
|
||||
|
||||
- name: Fail if Satellite version was not found
|
||||
fail:
|
||||
msg: "Satellite version was not found, you should file a bug"
|
||||
when:
|
||||
- rhsm_satellite_version is undefined
|
||||
|
||||
- name: SATELLITE | Gather package facts
|
||||
package_facts:
|
||||
|
||||
- name: SATELLITE | Run Satellite {{ rhsm_satellite_version }} tasks
|
||||
include_tasks: "satellite-{{ rhsm_satellite_version }}.yml"
|
||||
when:
|
||||
- rhsm_state == 'present'
|
||||
tags:
|
||||
- rhsm_satellite
|
||||
|
||||
- import_tasks: portal.yml
|
||||
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1717093
|
||||
- name: SATELLITE 6 | Install katello-host-tools
|
||||
package:
|
||||
name: katello-host-tools
|
||||
state: present
|
||||
when:
|
||||
- (rhsm_satellite_version | int) == 6
|
@ -1,7 +0,0 @@
|
||||
- name: Unregister Red Hat subscription
|
||||
command: subscription-manager remove --all
|
||||
environment:
|
||||
SMDEV_CONTAINER_OFF: "{{ rhsm_disable_container_check }}"
|
||||
become: true
|
||||
tags:
|
||||
- rhsm_unregister
|
@ -1,57 +0,0 @@
|
||||
# {{ ansible_managed }}
|
||||
[server]
|
||||
hostname = {{ rhsm_server_hostname }}
|
||||
prefix = {{ rhsm_server_prefix }}
|
||||
port = {{ rhsm_rhsm_port }}
|
||||
insecure = {{ rhsm_insecure | int }}
|
||||
ssl_verify_depth = {{ rhsm_ssl_verify_depth }}
|
||||
{% if rhsm_rhsm_proxy_hostname is defined %}
|
||||
proxy_hostname = {{ rhsm_rhsm_proxy_hostname }}
|
||||
{% endif %}
|
||||
{% if rhsm_rhsm_proxy_port is defined %}
|
||||
proxy_port = {{ rhsm_rhsm_proxy_port }}
|
||||
{% endif %}
|
||||
{% if rhsm_rhsm_proxy_user is defined %}
|
||||
proxy_user = {{ rhsm_rhsm_proxy_user }}
|
||||
{% endif %}
|
||||
{% if rhsm_rhsm_proxy_password is defined %}
|
||||
proxy_password = {{ rhsm_rhsm_proxy_password }}
|
||||
{% endif %}
|
||||
|
||||
[rhsm]
|
||||
baseurl = {{ rhsm_baseurl }}
|
||||
ca_cert_dir = {{ rhsm_ca_cert_dir }}
|
||||
repo_ca_cert = {{ rhsm_repo_ca_cert }}
|
||||
productCertDir = {{ rhsm_product_cert_dir }}
|
||||
entitlementCertDir = {{ rhsm_entitlement_cert_dir }}
|
||||
consumerCertDir = {{ rhsm_consumer_cert_dir }}
|
||||
manage_repos = {{ rhsm_manage_repos | int }}
|
||||
full_refresh_on_yum = {{ rhsm_full_refresh_on_yum | int }}
|
||||
report_package_profile = {{ rhsm_report_package_profile | int }}
|
||||
pluginDir = {{ rhsm_plugin_dir }}
|
||||
pluginConfDir = {{ rhsm_plugin_conf_dir }}
|
||||
|
||||
[rhsmcertd]
|
||||
certCheckInterval = {{ rhsm_cert_check_interval }}
|
||||
autoAttachInterval = {{ rhsm_auto_attach_interval }}
|
||||
|
||||
[logging]
|
||||
default_log_level = {{ rhsm_logging.default }}
|
||||
{% if rhsm_logging.subscription_manager is defined %}
|
||||
subscription_manager = {{ rhsm_logging.subscription_manager }}
|
||||
{% endif %}
|
||||
{% if rhsm_logging.subscription_manager_managercli is defined %}
|
||||
subscription_manager.managercli = {{ rhsm_logging.subscription_manager_managercli }}
|
||||
{% endif %}
|
||||
{% if rhsm_logging.rhsm is defined %}
|
||||
rhsm = {{ rhsm_logging.rhsm }}
|
||||
{% endif %}
|
||||
{% if rhsm_logging.rhsm_connection is defined %}
|
||||
rhsm.connection = {{ rhsm_logging.rhsm_connection }}
|
||||
{% endif %}
|
||||
{% if rhsm_logging.rhsm_app is defined %}
|
||||
rhsm-app = {{ rhsm_logging.rhsm_app }}
|
||||
{% endif %}
|
||||
{% if rhsm_logging.rhsm_app_rhsmd is defined %}
|
||||
rhsm-app.rhsmd = {{ rhsm_logging.rhsm_app_rhsmd }}
|
||||
{% endif %}
|
@ -1,3 +0,0 @@
|
||||
hacking>=4.0.0,<4.1.0 # Apache-2.0
|
||||
bashate>=0.5.1 # Apache-2.0
|
||||
pyflakes>=2.2.0
|
30
tests/Vagrantfile
vendored
30
tests/Vagrantfile
vendored
@ -1,30 +0,0 @@
|
||||
Vagrant.configure(2) do |config|
|
||||
|
||||
# RHEL 6
|
||||
config.vm.define "rhsm-rhel6" do |rhel6|
|
||||
rhel6.vm.box = "samdoran/rhel6"
|
||||
rhel6.vm.hostname = "rhsm-rhel6"
|
||||
config.vm.provider "virtualbox" do |vbox|
|
||||
vbox.name = "rhsm-rhel6"
|
||||
vbox.cpus = 1
|
||||
vbox.memory = 1024
|
||||
end
|
||||
end
|
||||
|
||||
# RHEL 7
|
||||
config.vm.define "rhsm-rhel7" do |rhel7|
|
||||
rhel7.vm.box = "samdoran/rhel7"
|
||||
rhel7.vm.hostname = "rhsm-rhel7"
|
||||
config.vm.provider "virtualbox" do |vbox|
|
||||
vbox.name = "rhsm-rhel7"
|
||||
vbox.cpus = 1
|
||||
vbox.memory = 1024
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.provision "ansible" do |ansible|
|
||||
ansible.playbook = 'vagrant.yml'
|
||||
ansible.extra_vars = 'vars/portal.yml'
|
||||
ansible.compatibility_mode = '2.0'
|
||||
end
|
||||
end
|
@ -1,6 +0,0 @@
|
||||
[defaults]
|
||||
inventory = .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory
|
||||
roles_path = ../../
|
||||
stdout_callback = debug
|
||||
retry_files = False
|
||||
host_key_checking = False
|
@ -1,6 +0,0 @@
|
||||
- hosts: all
|
||||
remote_user: vagrant
|
||||
become: true
|
||||
|
||||
roles:
|
||||
- ansible-role-redhat-subscription
|
@ -1,15 +0,0 @@
|
||||
rhsm_username: "{{ lookup('env', 'RHSM_USERNAME') }}"
|
||||
rhsm_password: "{{ lookup('env', 'RHSM_PASSWORD') }}"
|
||||
rhsm_pool_ids: "{{ lookup('env', 'RHSM_POOL_ID') }}"
|
||||
rhsm_repos: "{{ repos[ansible_distribution ~ '-' ~ ansible_distribution_major_version] }}"
|
||||
# rhsm_state: present
|
||||
# rhsm_repos_purge: true
|
||||
|
||||
repos:
|
||||
RedHat-6:
|
||||
- rhel-{{ ansible_distribution_major_version }}-server-extras-rpms
|
||||
- rhel-{{ ansible_distribution_major_version }}-server-rh-common-rpms
|
||||
RedHat-7:
|
||||
- rhel-{{ ansible_distribution_major_version }}-server-extras-rpms
|
||||
- rhel-{{ ansible_distribution_major_version }}-server-rh-common-rpms
|
||||
# - rhel-{{ ansible_distribution_major_version }}-server-openstack-12-tools-rpms
|
63
tox.ini
63
tox.ini
@ -1,63 +0,0 @@
|
||||
[tox]
|
||||
minversion = 2.0
|
||||
envlist = docs, linters
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
install_command = pip install -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages}
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
whitelist_externals = bash
|
||||
|
||||
[testenv:bindep]
|
||||
basepython = python3
|
||||
# Do not install any requirements. We want this to be fast and work even if
|
||||
# system dependencies are missing, since it's used to tell you what system
|
||||
# dependencies are missing! This also means that bindep must be installed
|
||||
# separately, outside of the requirements files.
|
||||
deps = bindep
|
||||
commands = bindep test
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python3
|
||||
commands = python setup.py build_sphinx
|
||||
|
||||
[testenv:pep8]
|
||||
basepython = python3
|
||||
commands =
|
||||
# Run hacking/flake8 check for all python files
|
||||
bash -c "git ls-files | xargs grep --binary-files=without-match \
|
||||
--files-with-match '^.!.*python$' \
|
||||
--exclude-dir .tox \
|
||||
--exclude-dir .git \
|
||||
--exclude-dir .eggs \
|
||||
--exclude-dir *.egg-info \
|
||||
--exclude-dir dist \
|
||||
--exclude-dir *lib/python* \
|
||||
--exclude-dir doc \
|
||||
| xargs flake8 --verbose"
|
||||
|
||||
[testenv:ansible-lint]
|
||||
basepython = python3
|
||||
commands = bash -c "ansible-lint"
|
||||
|
||||
[testenv:linters]
|
||||
basepython = python3
|
||||
deps =
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
-r{toxinidir}/ansible-requirements.txt
|
||||
commands =
|
||||
{[testenv:pep8]commands}
|
||||
{[testenv:ansible-lint]commands}
|
||||
|
||||
[testenv:venv]
|
||||
basepython = python3
|
||||
commands = {posargs}
|
||||
|
||||
[flake8]
|
||||
# E123, E125 skipped as they are invalid PEP-8.
|
||||
# E265 deals withs paces inside of comments
|
||||
show-source = True
|
||||
ignore = E123,E125,E265
|
||||
builtins = _
|
@ -1,11 +0,0 @@
|
||||
rhsm_repo_ca_cert: "{{ '%(ca_cert_dir)s' ~ ('katello-server-ca.pem' if rhsm_method == 'satellite' else 'redhat-uep.pem') }}"
|
||||
rhsm_full_refresh_on_yum: "{{ 1 if rhsm_method == 'satellite' else 0 }}"
|
||||
rhsm_disable_container_check: ''
|
||||
rhsm_yum_plugins:
|
||||
- file: product-id.conf
|
||||
option: enabled
|
||||
value: 1
|
||||
|
||||
- file: subscription-manager.conf
|
||||
option: enabled
|
||||
value: 1
|
@ -1,12 +0,0 @@
|
||||
- project:
|
||||
templates:
|
||||
- publish-to-pypi
|
||||
check:
|
||||
jobs:
|
||||
- openstack-tox-linters
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-linters
|
||||
post:
|
||||
jobs:
|
||||
- publish-openstack-python-branch-tarball
|
Loading…
Reference in New Issue
Block a user