diff options
Diffstat (limited to 'roles')
23 files changed, 525 insertions, 32 deletions
| diff --git a/roles/copr_cli/README.md b/roles/copr_cli/README.md new file mode 100644 index 000000000..edc68454e --- /dev/null +++ b/roles/copr_cli/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +This role manages Copr CLI. + +https://apps.fedoraproject.org/packages/copr-cli/ + +Requirements +------------ + +None + +Role Variables +-------------- + +None + +Dependencies +------------ + +None + +Example Playbook +---------------- + +    - hosts: servers +      roles: +      - role: copr_cli + +License +------- + +Apache License, Version 2.0 + +Author Information +------------------ + +Thomas Wiest diff --git a/roles/copr_cli/defaults/main.yml b/roles/copr_cli/defaults/main.yml new file mode 100644 index 000000000..3b8adf910 --- /dev/null +++ b/roles/copr_cli/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for copr_cli diff --git a/roles/copr_cli/handlers/main.yml b/roles/copr_cli/handlers/main.yml new file mode 100644 index 000000000..c3dec5a4c --- /dev/null +++ b/roles/copr_cli/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for copr_cli diff --git a/roles/copr_cli/meta/main.yml b/roles/copr_cli/meta/main.yml new file mode 100644 index 000000000..f050281fd --- /dev/null +++ b/roles/copr_cli/meta/main.yml @@ -0,0 +1,14 @@ +--- +galaxy_info: +  author: Thomas Wiest +  description: Manages Copr CLI +  company: Red Hat +  license: Apache License, Version 2.0 +  min_ansible_version: 1.2 +  platforms: +  - name: EL +    versions: +    - 7 +  categories: +  - packaging +dependencies: [] diff --git a/roles/copr_cli/tasks/main.yml b/roles/copr_cli/tasks/main.yml new file mode 100644 index 000000000..f7ef1c26e --- /dev/null +++ b/roles/copr_cli/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- yum: +    name: copr-cli +    state: present diff --git a/roles/copr_cli/vars/main.yml b/roles/copr_cli/vars/main.yml new file mode 100644 index 000000000..1522c94d9 --- /dev/null +++ b/roles/copr_cli/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for copr_cli diff --git a/roles/lib_zabbix/library/zbx_item.py b/roles/lib_zabbix/library/zbx_item.py index 5dc3cff9b..996c98fae 100644 --- a/roles/lib_zabbix/library/zbx_item.py +++ b/roles/lib_zabbix/library/zbx_item.py @@ -41,6 +41,24 @@ def exists(content, key='result'):      return True +def get_data_type(data_type): +    ''' +    Possible values: +    0 - decimal; +    1 - octal; +    2 - hexadecimal; +    3 - bool; +    ''' +    vtype = 0 +    if 'octal' in data_type: +        vtype = 1 +    elif 'hexadecimal' in data_type: +        vtype = 2 +    elif 'bool' in data_type: +        vtype = 3 + +    return vtype +  def get_value_type(value_type):      '''      Possible values: @@ -158,6 +176,7 @@ def main():              template_name=dict(default=None, type='str'),              zabbix_type=dict(default='trapper', type='str'),              value_type=dict(default='int', type='str'), +            data_type=dict(default='decimal', type='str'),              interval=dict(default=60, type='int'),              delta=dict(default=0, type='int'),              multiplier=dict(default=None, type='str'), @@ -219,6 +238,7 @@ def main():                    'hostid': templateid[0],                    'type': get_zabbix_type(module.params['zabbix_type']),                    'value_type': get_value_type(module.params['value_type']), +                  'data_type': get_data_type(module.params['data_type']),                    'applications': get_app_ids(module.params['applications'], app_name_ids),                    'formula': formula,                    'multiplier': use_multiplier, diff --git a/roles/lib_zabbix/library/zbx_itemprototype.py b/roles/lib_zabbix/library/zbx_itemprototype.py index 43498c015..aca9c8336 100644 --- a/roles/lib_zabbix/library/zbx_itemprototype.py +++ b/roles/lib_zabbix/library/zbx_itemprototype.py @@ -116,6 +116,24 @@ def get_zabbix_type(ztype):      return _vtype +def get_data_type(data_type): +    ''' +    Possible values: +    0 - decimal; +    1 - octal; +    2 - hexadecimal; +    3 - bool; +    ''' +    vtype = 0 +    if 'octal' in data_type: +        vtype = 1 +    elif 'hexadecimal' in data_type: +        vtype = 2 +    elif 'bool' in data_type: +        vtype = 3 + +    return vtype +  def get_value_type(value_type):      '''      Possible values: @@ -175,6 +193,7 @@ def main():              interfaceid=dict(default=None, type='int'),              zabbix_type=dict(default='trapper', type='str'),              value_type=dict(default='float', type='str'), +            data_type=dict(default='decimal', type='str'),              delay=dict(default=60, type='int'),              lifetime=dict(default=30, type='int'),              state=dict(default='present', type='str'), @@ -238,6 +257,7 @@ def main():                    'ruleid': get_rule_id(zapi, module.params['discoveryrule_key'], template['templateid']),                    'type': get_zabbix_type(module.params['zabbix_type']),                    'value_type': get_value_type(module.params['value_type']), +                  'data_type': get_data_type(module.params['data_type']),                    'applications': get_app_ids(zapi, module.params['applications'], template['templateid']),                    'formula': formula,                    'multiplier': use_multiplier, diff --git a/roles/lib_zabbix/library/zbx_itservice.py b/roles/lib_zabbix/library/zbx_itservice.py new file mode 100644 index 000000000..a5ee97e15 --- /dev/null +++ b/roles/lib_zabbix/library/zbx_itservice.py @@ -0,0 +1,263 @@ +#!/usr/bin/env python +''' + Ansible module for zabbix itservices +''' +# vim: expandtab:tabstop=4:shiftwidth=4 +# +#   Zabbix itservice ansible module +# +# +#   Copyright 2015 Red Hat Inc. +# +#   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. +# + +# This is in place because each module looks similar to each other. +# These need duplicate code as their behavior is very similar +# but different for each zabbix class. +# pylint: disable=duplicate-code + +# pylint: disable=import-error +from openshift_tools.monitoring.zbxapi import ZabbixAPI, ZabbixConnection + +def exists(content, key='result'): +    ''' Check if key exists in content or the size of content[key] > 0 +    ''' +    if not content.has_key(key): +        return False + +    if not content[key]: +        return False + +    return True + +def get_parent(dependencies): +    '''Put dependencies into the proper update format''' +    rval = None +    for dep in dependencies: +        if dep['relationship'] == 'parent': +            return dep +    return rval + +def format_dependencies(dependencies): +    '''Put dependencies into the proper update format''' +    rval = [] +    for dep in dependencies: +        rval.append({'dependsOnServiceid': dep['serviceid'], +                     'soft': get_dependency_type(dep['dep_type']), +                    }) + +    return rval + +def get_dependency_type(dep_type): +    '''Determine the dependency type''' +    rval = 0 +    if 'soft' == dep_type: +        rval = 1 + +    return rval + +def get_service_id_by_name(zapi, dependencies): +    '''Fetch the service id for an itservice''' +    deps = [] +    for dep in dependencies: +        if dep['name'] == 'root': +            deps.append(dep) +            continue + +        content = zapi.get_content('service', +                                   'get', +                                   {'filter': {'name': dep['name']}, +                                    'selectDependencies': 'extend', +                                   }) +        if content.has_key('result') and content['result']: +            dep['serviceid'] = content['result'][0]['serviceid'] +            deps.append(dep) + +    return deps + +def add_dependencies(zapi, service_name, dependencies): +    '''Fetch the service id for an itservice + +       Add a dependency on the parent for this current service item. +    ''' + +    results = get_service_id_by_name(zapi, [{'name': service_name}]) + +    content = {} +    for dep in dependencies: +        content = zapi.get_content('service', +                                   'adddependencies', +                                   {'serviceid': results[0]['serviceid'], +                                    'dependsOnServiceid': dep['serviceid'], +                                    'soft': get_dependency_type(dep['dep_type']), +                                   }) +        if content.has_key('result') and content['result']: +            continue +        else: +            break + +    return content + +def get_show_sla(inc_sla): +    ''' Determine the showsla paramter +    ''' +    rval = 1 +    if 'do not cacluate' in inc_sla: +        rval = 0 +    return rval + +def get_algorithm(inc_algorithm_str): +    ''' +    Determine which type algorithm +    ''' +    rval = 0 +    if 'at least one' in inc_algorithm_str: +        rval = 1 +    elif 'all' in inc_algorithm_str: +        rval = 2 + +    return rval + +# The branches are needed for CRUD and error handling +# pylint: disable=too-many-branches +def main(): +    ''' +    ansible zabbix module for zbx_itservice +    ''' + +    module = AnsibleModule( +        argument_spec=dict( +            zbx_server=dict(default='https://localhost/zabbix/api_jsonrpc.php', type='str'), +            zbx_user=dict(default=os.environ.get('ZABBIX_USER', None), type='str'), +            zbx_password=dict(default=os.environ.get('ZABBIX_PASSWORD', None), type='str'), +            zbx_debug=dict(default=False, type='bool'), +            name=dict(default=None, type='str'), +            algorithm=dict(default='do not calculate', choices=['do not calculate', 'at least one', 'all'], type='str'), +            show_sla=dict(default='calculate', choices=['do not calculate', 'calculate'], type='str'), +            good_sla=dict(default='99.9', type='float'), +            sort_order=dict(default=1, type='int'), +            state=dict(default='present', type='str'), +            trigger_id=dict(default=None, type='int'), +            dependencies=dict(default=[], type='list'), +            dep_type=dict(default='hard', choices=['hard', 'soft'], type='str'), +        ), +        #supports_check_mode=True +    ) + +    zapi = ZabbixAPI(ZabbixConnection(module.params['zbx_server'], +                                      module.params['zbx_user'], +                                      module.params['zbx_password'], +                                      module.params['zbx_debug'])) + +    #Set the instance and the template for the rest of the calls +    zbx_class_name = 'service' +    state = module.params['state'] + +    content = zapi.get_content(zbx_class_name, +                               'get', +                               {'filter': {'name': module.params['name']}, +                                'selectDependencies': 'extend', +                               }) + +    #******# +    # GET +    #******# +    if state == 'list': +        module.exit_json(changed=False, results=content['result'], state="list") + +    #******# +    # DELETE +    #******# +    if state == 'absent': +        if not exists(content): +            module.exit_json(changed=False, state="absent") + +        content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0]['serviceid']]) +        module.exit_json(changed=True, results=content['result'], state="absent") + +    # Create and Update +    if state == 'present': + +        dependencies = get_service_id_by_name(zapi, module.params['dependencies']) +        params = {'name': module.params['name'], +                  'algorithm': get_algorithm(module.params['algorithm']), +                  'showsla': get_show_sla(module.params['show_sla']), +                  'goodsla': module.params['good_sla'], +                  'sortorder': module.params['sort_order'], +                  'triggerid': module.params['trigger_id'] +                 } + +        # Remove any None valued params +        _ = [params.pop(key, None) for key in params.keys() if params[key] is None] + +        #******# +        # CREATE +        #******# +        if not exists(content): +            content = zapi.get_content(zbx_class_name, 'create', params) + +            if content.has_key('error'): +                module.exit_json(failed=True, changed=True, results=content['error'], state="present") + +            if dependencies: +                content = add_dependencies(zapi, module.params['name'], dependencies) + +                if content.has_key('error'): +                    module.exit_json(failed=True, changed=True, results=content['error'], state="present") + +            module.exit_json(changed=True, results=content['result'], state='present') + + +        ######## +        # UPDATE +        ######## +        params['dependencies'] = dependencies +        differences = {} +        zab_results = content['result'][0] +        for key, value in params.items(): + +            if key == 'goodsla': +                if float(value) != float(zab_results[key]): +                    differences[key] = value + +            elif key == 'dependencies': +                zab_dep_ids = [item['serviceid'] for item in zab_results[key]] +                user_dep_ids = [item['serviceid'] for item in dependencies] +                if set(zab_dep_ids) != set(user_dep_ids): +                    differences[key] = format_dependencies(dependencies) + +            elif zab_results[key] != value and zab_results[key] != str(value): +                differences[key] = value + +        if not differences: +            module.exit_json(changed=False, results=zab_results, state="present") + +        differences['serviceid'] = zab_results['serviceid'] +        content = zapi.get_content(zbx_class_name, 'update', differences) + +        if content.has_key('error'): +            module.exit_json(failed=True, changed=False, results=content['error'], state="present") + +        module.exit_json(changed=True, results=content['result'], state="present") + +    module.exit_json(failed=True, +                     changed=False, +                     results='Unknown state passed. %s' % state, +                     state="unknown") + +# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import, locally-disabled +# import module snippets.  This are required +from ansible.module_utils.basic import * + +main() diff --git a/roles/lib_zabbix/library/zbx_trigger.py b/roles/lib_zabbix/library/zbx_trigger.py index ab7731faa..b5faefa70 100644 --- a/roles/lib_zabbix/library/zbx_trigger.py +++ b/roles/lib_zabbix/library/zbx_trigger.py @@ -136,6 +136,8 @@ def main():              status=dict(default=None, type='str'),              state=dict(default='present', type='str'),              template_name=dict(default=None, type='str'), +            hostgroup_name=dict(default=None, type='str'), +            query_type=dict(default='filter', choices=['filter', 'search'], type='str'),          ),          #supports_check_mode=True      ) @@ -157,10 +159,11 @@ def main():      content = zapi.get_content(zbx_class_name,                                 'get', -                               {'filter': {'description': tname}, +                               {module.params['query_type']: {'description': tname},                                  'expandExpression': True,                                  'selectDependencies': 'triggerid',                                  'templateids': templateid, +                                'group': module.params['hostgroup_name'],                                 })      # Get diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml index 44c4e6766..2992505bf 100644 --- a/roles/lib_zabbix/tasks/create_template.yml +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -33,6 +33,7 @@      key: "{{ item.key }}"      name: "{{ item.name | default(item.key, true) }}"      value_type: "{{ item.value_type | default('int') }}" +    data_type: "{{ item.data_type | default('decimal') }}"      description: "{{ item.description | default('', True) }}"      multiplier: "{{ item.multiplier | default('', True) }}"      units: "{{ item.units | default('', True) }}" @@ -81,6 +82,7 @@      key: "{{ item.key }}"      discoveryrule_key: "{{ item.discoveryrule_key }}"      value_type: "{{ item.value_type }}" +    data_type: "{{ item.data_type | default('decimal') }}"      template_name: "{{ template.name }}"      applications: "{{ item.applications }}"      description: "{{ item.description | default('', True) }}" diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 828ddc49b..51e3ef1c0 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -24,8 +24,23 @@ import StringIO  import yaml  from distutils.util import strtobool  from distutils.version import LooseVersion -from netaddr import IPNetwork +import struct +import socket +def first_ip(network): +    """ Return the first IPv4 address in network + +        Args: +            network (str): network in CIDR format +        Returns: +            str: first IPv4 address +    """ +    atoi = lambda addr: struct.unpack("!I", socket.inet_aton(addr))[0] +    itoa = lambda addr: socket.inet_ntoa(struct.pack("!I", addr)) + +    (address, netmask) = network.split('/') +    netmask_i = (0xffffffff << (32 - atoi(netmask))) & 0xffffffff +    return itoa((atoi(address) & netmask_i) + 1)  def hostname_valid(hostname):      """ Test if specified hostname should be considered valid @@ -525,7 +540,7 @@ def set_aggregate_facts(facts):                           'kubernetes.default.svc', 'kubernetes.default.svc.' + cluster_domain]              all_hostnames.update(svc_names)              internal_hostnames.update(svc_names) -            first_svc_ip = str(IPNetwork(facts['master']['portal_net'])[1]) +            first_svc_ip = first_ip(facts['master']['portal_net'])              all_hostnames.add(first_svc_ip)              internal_hostnames.add(first_svc_ip) @@ -543,8 +558,10 @@ def set_etcd_facts_if_unset(facts):      If anything goes wrong parsing these, the fact will not be set.      """ -    if 'etcd' in facts: -        if 'master' in facts and facts['master']['embedded_etcd']: +    if 'master' in facts and facts['master']['embedded_etcd']: +        etcd_facts = facts['etcd'] if 'etcd' in facts else dict() + +        if 'etcd_data_dir' not in etcd_facts:              try:                  # Parse master config to find actual etcd data dir:                  master_cfg_path = os.path.join(facts['common']['config_base'], @@ -553,28 +570,37 @@ def set_etcd_facts_if_unset(facts):                  config = yaml.safe_load(master_cfg_f.read())                  master_cfg_f.close() -                facts['etcd']['etcd_data_dir'] = \ +                etcd_facts['etcd_data_dir'] = \                      config['etcdConfig']['storageDirectory'] + +                facts['etcd'] = etcd_facts +              # We don't want exceptions bubbling up here:              # pylint: disable=broad-except              except Exception:                  pass -        else: -            # Read ETCD_DATA_DIR from /etc/etcd/etcd.conf: -            try: -                # Add a fake section for parsing: -                ini_str = '[root]\n' + open('/etc/etcd/etcd.conf', 'r').read() -                ini_fp = StringIO.StringIO(ini_str) -                config = ConfigParser.RawConfigParser() -                config.readfp(ini_fp) -                etcd_data_dir = config.get('root', 'ETCD_DATA_DIR') -                if etcd_data_dir.startswith('"') and etcd_data_dir.endswith('"'): -                    etcd_data_dir = etcd_data_dir[1:-1] -                facts['etcd']['etcd_data_dir'] = etcd_data_dir -            # We don't want exceptions bubbling up here: -            # pylint: disable=broad-except -            except Exception: -                pass +    else: +        etcd_facts = facts['etcd'] if 'etcd' in facts else dict() + +        # Read ETCD_DATA_DIR from /etc/etcd/etcd.conf: +        try: +            # Add a fake section for parsing: +            ini_str = '[root]\n' + open('/etc/etcd/etcd.conf', 'r').read() +            ini_fp = StringIO.StringIO(ini_str) +            config = ConfigParser.RawConfigParser() +            config.readfp(ini_fp) +            etcd_data_dir = config.get('root', 'ETCD_DATA_DIR') +            if etcd_data_dir.startswith('"') and etcd_data_dir.endswith('"'): +                etcd_data_dir = etcd_data_dir[1:-1] + +            etcd_facts['etcd_data_dir'] = etcd_data_dir +            facts['etcd'] = etcd_facts + +        # We don't want exceptions bubbling up here: +        # pylint: disable=broad-except +        except Exception: +            pass +      return facts  def set_deployment_facts_if_unset(facts): diff --git a/roles/openshift_facts/tasks/main.yml b/roles/openshift_facts/tasks/main.yml index a28aa7ba2..913f0dc78 100644 --- a/roles/openshift_facts/tasks/main.yml +++ b/roles/openshift_facts/tasks/main.yml @@ -6,10 +6,9 @@      - ansible_version | version_compare('1.9.0', 'ne')      - ansible_version | version_compare('1.9.0.1', 'ne') -- name: Ensure python-netaddr and PyYaml are installed +- name: Ensure PyYaml is installed    yum: pkg={{ item }} state=installed    with_items: -    - python-netaddr      - PyYAML  - name: Gather Cluster facts diff --git a/roles/openshift_node/tasks/storage_plugins/glusterfs.yml b/roles/openshift_node/tasks/storage_plugins/glusterfs.yml index b812e81df..5cd4a6041 100644 --- a/roles/openshift_node/tasks/storage_plugins/glusterfs.yml +++ b/roles/openshift_node/tasks/storage_plugins/glusterfs.yml @@ -4,9 +4,14 @@      pkg: glusterfs-fuse      state: installed -- name: Set seboolean to allow gluster storage plugin access from containers +- name: Set sebooleans to allow gluster storage plugin access from containers    seboolean: -    name: virt_use_fusefs +    name: "{{ item }}"      state: yes      persistent: yes    when: ansible_selinux and ansible_selinux.status == "enabled" +  with_items: +  - virt_use_fusefs +  - virt_sandbox_use_fusefs +  register: sebool_result +  failed_when: "'state' not in sebool_result and 'msg' in sebool_result and 'SELinux boolean item does not exist' not in sebool_result.msg" diff --git a/roles/os_zabbix/vars/template_aws.yml b/roles/os_zabbix/vars/template_aws.yml index 0ed682128..57832a3fe 100644 --- a/roles/os_zabbix/vars/template_aws.yml +++ b/roles/os_zabbix/vars/template_aws.yml @@ -4,7 +4,7 @@ g_template_aws:    zdiscoveryrules:    - name: disc.aws      key: disc.aws -    lifetime: 1 +    lifetime: 14      description: "Dynamically register AWS bucket info"    zitemprototypes: diff --git a/roles/os_zabbix/vars/template_openshift_master.yml b/roles/os_zabbix/vars/template_openshift_master.yml index 6defc4989..174486e15 100644 --- a/roles/os_zabbix/vars/template_openshift_master.yml +++ b/roles/os_zabbix/vars/template_openshift_master.yml @@ -13,6 +13,13 @@ g_template_openshift_master:      applications:      - Openshift Master +  - key: openshift.master.api.healthz +    description: "Checks the healthz check of the master's api: https://master_host/healthz" +    type: int +    data_type: bool +    applications: +    - Openshift Master +    - key: openshift.master.user.count      description: Shows number of users in a cluster      type: int @@ -24,8 +31,20 @@ g_template_openshift_master:      type: int      applications:      - Openshift Master -   -  - key: openshift.project.counter + +  - key: openshift.master.pod.user.running.count +    description: Shows number of user pods running (non infrastructure pods) +    type: int +    applications: +    - Openshift Master + +  - key: openshift.master.pod.total.count +    description: Shows total number of pods (running and non running) +    type: int +    applications: +    - Openshift Master + +  - key: openshift.project.count      description: Shows number of projects on a cluster      type: int      applications: @@ -109,6 +128,11 @@ g_template_openshift_master:      url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_create_app.asciidoc'      priority: avg +  - name: 'Openshift Master API health check is failing on {HOST.NAME}' +    expression: '{Template Openshift Master:openshift.master.api.healthz.max(#3)}<1' +    url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' +    priority: high +    - name: 'Openshift Master process not running on {HOST.NAME}'      expression: '{Template Openshift Master:openshift.master.process.count.max(#3)}<1'      url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' @@ -125,7 +149,7 @@ g_template_openshift_master:      priority: info    - name: 'There are no projects running on {HOST.NAME}' -    expression: '{Template Openshift Master:openshift.project.counter.last()}=0' +    expression: '{Template Openshift Master:openshift.project.count.last()}=0'      url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc'      priority: info diff --git a/roles/rhel_subscribe/tasks/main.yml b/roles/rhel_subscribe/tasks/main.yml index 8fb2fc042..30c0920a1 100644 --- a/roles/rhel_subscribe/tasks/main.yml +++ b/roles/rhel_subscribe/tasks/main.yml @@ -6,19 +6,26 @@  - set_fact:      rhel_subscription_user: "{{ lookup('oo_option', 'rhel_subscription_user') | default(rhsub_user, True) | default(omit, True) }}"      rhel_subscription_pass: "{{ lookup('oo_option', 'rhel_subscription_pass') | default(rhsub_pass, True) | default(omit, True) }}" +    rhel_subscription_server: "{{ lookup('oo_option', 'rhel_subscription_server') | default(rhsub_server) }}"  - fail:      msg: "This role is only supported for Red Hat hosts"    when: ansible_distribution != 'RedHat'  - fail: -    msg: Either rsub_user or the rhel_subscription_user env variable are required for this role. +    msg: Either rhsub_user or the rhel_subscription_user env variable are required for this role.    when: rhel_subscription_user is not defined  - fail: -    msg: Either rsub_pass or the rhel_subscription_pass env variable are required for this role. +    msg: Either rhsub_pass or the rhel_subscription_pass env variable are required for this role.    when: rhel_subscription_pass is not defined +- name: Satellite preparation +  command: "rpm -Uvh http://{{ rhel_subscription_server }}/pub/katello-ca-consumer-latest.noarch.rpm" +  args: +    creates: /etc/rhsm/ca/katello-server-ca.pem +  when: rhel_subscription_server is defined and rhel_subscription_server +  - name: RedHat subscriptions    redhat_subscription:      username: "{{ rhel_subscription_user }}" diff --git a/roles/tito/README.md b/roles/tito/README.md new file mode 100644 index 000000000..c4e2856dc --- /dev/null +++ b/roles/tito/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +This role manages Tito. + +https://github.com/dgoodwin/tito + +Requirements +------------ + +None + +Role Variables +-------------- + +None + +Dependencies +------------ + +None + +Example Playbook +---------------- + +    - hosts: servers +      roles: +      - role: tito + +License +------- + +Apache License, Version 2.0 + +Author Information +------------------ + +Thomas Wiest diff --git a/roles/tito/defaults/main.yml b/roles/tito/defaults/main.yml new file mode 100644 index 000000000..dd7cd269e --- /dev/null +++ b/roles/tito/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for tito diff --git a/roles/tito/handlers/main.yml b/roles/tito/handlers/main.yml new file mode 100644 index 000000000..e9ce609d5 --- /dev/null +++ b/roles/tito/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for tito diff --git a/roles/tito/meta/main.yml b/roles/tito/meta/main.yml new file mode 100644 index 000000000..fb121c08e --- /dev/null +++ b/roles/tito/meta/main.yml @@ -0,0 +1,14 @@ +--- +galaxy_info: +  author: Thomas Wiest +  description: Manages Tito +  company: Red Hat +  license: Apache License, Version 2.0 +  min_ansible_version: 1.2 +  platforms: +  - name: EL +    versions: +    - 7 +  categories: +  - packaging +dependencies: [] diff --git a/roles/tito/tasks/main.yml b/roles/tito/tasks/main.yml new file mode 100644 index 000000000..f7b4ef363 --- /dev/null +++ b/roles/tito/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- yum: +    name: tito +    state: present diff --git a/roles/tito/vars/main.yml b/roles/tito/vars/main.yml new file mode 100644 index 000000000..8a1aafc41 --- /dev/null +++ b/roles/tito/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for tito | 
