Initial commit
This commit is contained in:
commit
5fbd676974
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
language: python
|
||||
python: "2.7"
|
||||
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
# Install ansible
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python-pip
|
||||
|
||||
install:
|
||||
# Install ansible
|
||||
- pip install ansible
|
||||
|
||||
# Check ansible version
|
||||
- ansible --version
|
||||
|
||||
# Create ansible.cfg with correct roles_path
|
||||
- printf '[defaults]\nroles_path=../' >ansible.cfg
|
||||
|
||||
script:
|
||||
# Basic role syntax check
|
||||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
|
@ -0,0 +1,46 @@
|
|||
Red Hat Subscription
|
||||
=========
|
||||
|
||||
Manage Red Hat subscritions and repositories.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Current Red Hat subscription.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
| Name | Default Value | Description |
|
||||
|-------------------|---------------------|----------------------|
|
||||
| `rhn_username` | `{{ lookup('env', 'RHN_USERNAME') }}` | Red Hat Port username. |
|
||||
| `rhn_password` | `{{ lookup('env', 'RHN_PASSWORD') }}` | Red Hat Portal password. |
|
||||
| `rhsub_state` | `enable` | Whether to enable or disable a Red Hat subscription. |
|
||||
| `rhsub_autosubscribe` | `True` | Whether or not to autosubscibe to available repositories. If set, will skip the task that manages individual repositories. |
|
||||
| `rhsub_repos` | `{}` | List of repositories to enable or disable. See `defaults/main.yml` for examples. |
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
- hosts: all
|
||||
|
||||
vars:
|
||||
rhn_username: bob.smith@acme.com
|
||||
rhn_password: "{{ vault_rhn_password }}"
|
||||
rhsub_repos:
|
||||
- name: rhel-7-server-extras-rpms
|
||||
state: enable
|
||||
|
||||
roles:
|
||||
- samdoran.redhat-subscription
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
MIT
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
rhn_username: "{{ lookup('env', 'RHN_USERNAME') }}"
|
||||
rhn_password: "{{ lookup('env', 'RHN_PASSWORD') }}"
|
||||
|
||||
rhsub_state: enable
|
||||
rhsub_autosubscribe: True
|
||||
|
||||
rhsub_repos: {}
|
||||
# - name: rhel-7-server-extras-rpms # wildcard or repo name
|
||||
# state: enable # enable or disable
|
|
@ -0,0 +1,19 @@
|
|||
galaxy_info:
|
||||
author: Sam Doran
|
||||
description: "Manage Red Hat subscription and repositories."
|
||||
company:
|
||||
license: MIT
|
||||
min_ansible_version: 1.9
|
||||
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 6
|
||||
- 7
|
||||
|
||||
galaxy_tags:
|
||||
- system
|
||||
- redhat
|
||||
- subscription
|
||||
|
||||
dependencies: []
|
|
@ -0,0 +1,23 @@
|
|||
- name: Check that this is Red Hat
|
||||
assert:
|
||||
that: "{{ ansible_distribution }} == 'RedHat'"
|
||||
tags:
|
||||
- rhsub
|
||||
|
||||
- name: Register Red Hat subscription
|
||||
redhat_subscription:
|
||||
username: "{{ rhn_username }}"
|
||||
password: "{{ rhn_password }}"
|
||||
state: "{{ rhsub_state }}"
|
||||
autosubscribe: "{{ rhsub_autosubscribe }}"
|
||||
tags:
|
||||
- rhsub
|
||||
- rhsub_register
|
||||
|
||||
- name: Configure repository subscriptions
|
||||
command: subscription-manage repos --{{ item.state }} --{{ item.name }}
|
||||
with_items: "{{ rhsub_repos }}"
|
||||
when: not rhsub_autosubscribe
|
||||
tags:
|
||||
- rhsub
|
||||
- rhsub_repos
|
|
@ -0,0 +1,19 @@
|
|||
Vagrant.configure(2) do |config|
|
||||
|
||||
# RHEL 6
|
||||
config.vm.define "rhel6" do |rhel6|
|
||||
rhel6.vm.box = "samdoran/rhel6"
|
||||
rhel6.vm.hostname = "java-rhel6"
|
||||
end
|
||||
|
||||
# RHEL 7
|
||||
config.vm.define "rhel7" do |rhel7|
|
||||
rhel7.vm.box = "samdoran/rhel7"
|
||||
rhel7.vm.hostname = "java-rhel7"
|
||||
end
|
||||
|
||||
config.vm.provision "ansible" do |ansible|
|
||||
ansible.playbook = "vagrant.yml"
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1 @@
|
|||
localhost
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- redhat-subscription
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
- hosts: all
|
||||
remote_user: vagrant
|
||||
become: True
|
||||
roles:
|
||||
- redhat-subscription
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
# vars file for redhat-subscription
|
Loading…
Reference in New Issue