diff options
Diffstat (limited to 'roles')
84 files changed, 1630 insertions, 1321 deletions
diff --git a/roles/ansible/tasks/main.yml b/roles/ansible/tasks/main.yml index 5d20a3b35..2a6ac7713 100644 --- a/roles/ansible/tasks/main.yml +++ b/roles/ansible/tasks/main.yml @@ -2,9 +2,7 @@ # Install ansible client - name: Install Ansible - yum: - pkg: ansible - state: installed + action: "{{ ansible_pkg_mgr }} name=ansible state=present" - include: config.yml vars: diff --git a/roles/ansible_tower/tasks/main.yaml b/roles/ansible_tower/tasks/main.yaml index b7757214d..36fc9b282 100644 --- a/roles/ansible_tower/tasks/main.yaml +++ b/roles/ansible_tower/tasks/main.yaml @@ -1,6 +1,6 @@ --- - name: install some useful packages - yum: name={{ item }} + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: - git - python-pip diff --git a/roles/ansible_tower_cli/tasks/main.yml b/roles/ansible_tower_cli/tasks/main.yml index 41fac22a0..0c5163b50 100644 --- a/roles/ansible_tower_cli/tasks/main.yml +++ b/roles/ansible_tower_cli/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Install python-ansible-tower-cli - yum: name=python-ansible-tower-cli + action: "{{ ansible_pkg_mgr }} name=python-ansible-tower-cli state=present" - template: src: tower_cli.cfg.j2 diff --git a/roles/cockpit/tasks/main.yml b/roles/cockpit/tasks/main.yml index 875cbad21..b90e7dfd6 100644 --- a/roles/cockpit/tasks/main.yml +++ b/roles/cockpit/tasks/main.yml @@ -1,8 +1,6 @@ --- - name: Install cockpit-ws - yum: - name: "{{ item }}" - state: present + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: - cockpit-ws - cockpit-shell diff --git a/roles/copr_cli/tasks/main.yml b/roles/copr_cli/tasks/main.yml index f7ef1c26e..4bfd551d3 100644 --- a/roles/copr_cli/tasks/main.yml +++ b/roles/copr_cli/tasks/main.yml @@ -1,4 +1,2 @@ --- -- yum: - name: copr-cli - state: present +- action: "{{ ansible_pkg_mgr }} name=copr-cli state=present" diff --git a/roles/docker/README.md b/roles/docker/README.md index 225dd44b9..46f259eb7 100644 --- a/roles/docker/README.md +++ b/roles/docker/README.md @@ -1,38 +1,38 @@ Role Name ========= -A brief description of the role goes here. +Ensures docker package is installed, and optionally raises timeout for systemd-udevd.service to 5 minutes. Requirements ------------ -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. +None Role Variables -------------- -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. +udevw_udevd_dir: location of systemd config for systemd-udevd.service +docker_udev_workaround: raises udevd timeout to 5 minutes (https://bugzilla.redhat.com/show_bug.cgi?id=1272446) Dependencies ------------ -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. +None Example Playbook ---------------- -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - hosts: servers roles: - - { role: username.rolename, x: 42 } + - role: docker + docker_udev_workaround: "true" License ------- -BSD +ASL 2.0 Author Information ------------------ -An optional section for the role authors to include contact information, or a website (HTML is not allowed). +OpenShift operations, Red Hat, Inc diff --git a/roles/docker/handlers/main.yml b/roles/docker/handlers/main.yml index eca7419c1..7d60f1891 100644 --- a/roles/docker/handlers/main.yml +++ b/roles/docker/handlers/main.yml @@ -2,3 +2,8 @@ - name: restart docker service: name=docker state=restarted + +- name: restart udev + service: + name: systemd-udevd + state: restarted diff --git a/roles/docker/meta/main.yml b/roles/docker/meta/main.yml index c5c362c60..6e2c98601 100644 --- a/roles/docker/meta/main.yml +++ b/roles/docker/meta/main.yml @@ -1,124 +1,12 @@ --- galaxy_info: - author: your name - description: - company: your company (optional) - # Some suggested licenses: - # - BSD (default) - # - MIT - # - GPLv2 - # - GPLv3 - # - Apache - # - CC-BY - license: license (GPLv2, CC-BY, etc) + author: OpenShift + description: docker package install + company: Red Hat, Inc + license: ASL 2.0 min_ansible_version: 1.2 - # - # Below are all platforms currently available. Just uncomment - # the ones that apply to your role. If you don't see your - # platform on this list, let us know and we'll get it added! - # - #platforms: - #- name: EL - # versions: - # - all - # - 5 - # - 6 - # - 7 - #- name: GenericUNIX - # versions: - # - all - # - any - #- name: Fedora - # versions: - # - all - # - 16 - # - 17 - # - 18 - # - 19 - # - 20 - #- name: opensuse - # versions: - # - all - # - 12.1 - # - 12.2 - # - 12.3 - # - 13.1 - # - 13.2 - #- name: Amazon - # versions: - # - all - # - 2013.03 - # - 2013.09 - #- name: GenericBSD - # versions: - # - all - # - any - #- name: FreeBSD - # versions: - # - all - # - 8.0 - # - 8.1 - # - 8.2 - # - 8.3 - # - 8.4 - # - 9.0 - # - 9.1 - # - 9.1 - # - 9.2 - #- name: Ubuntu - # versions: - # - all - # - lucid - # - maverick - # - natty - # - oneiric - # - precise - # - quantal - # - raring - # - saucy - # - trusty - #- name: SLES - # versions: - # - all - # - 10SP3 - # - 10SP4 - # - 11 - # - 11SP1 - # - 11SP2 - # - 11SP3 - #- name: GenericLinux - # versions: - # - all - # - any - #- name: Debian - # versions: - # - all - # - etch - # - lenny - # - squeeze - # - wheezy - # - # Below are all categories currently available. Just as with - # the platforms above, uncomment those that apply to your role. - # - #categories: - #- cloud - #- cloud:ec2 - #- cloud:gce - #- cloud:rax - #- clustering - #- database - #- database:nosql - #- database:sql - #- development - #- monitoring - #- networking - #- packaging - #- system - #- web + platforms: + - name: EL + versions: + - 7 dependencies: [] - # List your role dependencies here, one per line. Only - # dependencies available via galaxy should be listed here. - # Be sure to remove the '[]' above if you add dependencies - # to this list. - diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 96949230d..e94ebe3e1 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -1,8 +1,10 @@ --- # tasks file for docker - name: Install docker - yum: pkg=docker - + action: "{{ ansible_pkg_mgr }} name=docker state=present" + - name: enable and start the docker service service: name=docker enabled=yes state=started +- include: udev_workaround.yml + when: docker_udev_workaround | default(False) diff --git a/roles/docker/tasks/udev_workaround.yml b/roles/docker/tasks/udev_workaround.yml new file mode 100644 index 000000000..3c236f698 --- /dev/null +++ b/roles/docker/tasks/udev_workaround.yml @@ -0,0 +1,30 @@ +--- + +- name: Getting current systemd-udevd exec command + command: grep -e "^ExecStart=" /lib/systemd/system/systemd-udevd.service + changed_when: false + register: udevw_udev_start_cmd + +- name: Assure systemd-udevd.service.d directory exists + file: + path: "{{ udevw_udevd_dir }}" + state: directory + +- name: Create systemd-udevd override file + copy: + content: | + [Service] + #Need blank ExecStart to "clear" pre-exising one + ExecStart= + {{ udevw_udev_start_cmd.stdout }} --event-timeout=300 + dest: "{{ udevw_udevd_dir }}/override.conf" + owner: root + mode: "0644" + notify: + - restart udev + register: udevw_override_conf + +- name: reload systemd config files + command: systemctl daemon-reload + when: udevw_override_conf | changed + diff --git a/roles/docker/vars/main.yml b/roles/docker/vars/main.yml new file mode 100644 index 000000000..162487545 --- /dev/null +++ b/roles/docker/vars/main.yml @@ -0,0 +1,3 @@ +--- + +udevw_udevd_dir: /etc/systemd/system/systemd-udevd.service.d diff --git a/roles/etcd/README.md b/roles/etcd/README.md index 88e4ff874..329a926c0 100644 --- a/roles/etcd/README.md +++ b/roles/etcd/README.md @@ -7,7 +7,7 @@ Requirements ------------ This role assumes it's being deployed on a RHEL/Fedora based host with package -named 'etcd' available via yum. +named 'etcd' available via yum or dnf (conditionally). Role Variables -------------- diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml index fcbdecd37..61892fe06 100644 --- a/roles/etcd/tasks/main.yml +++ b/roles/etcd/tasks/main.yml @@ -8,7 +8,7 @@ when: "'ipv4' not in hostvars[inventory_hostname]['ansible_' ~ etcd_interface] or 'address' not in hostvars[inventory_hostname]['ansible_' ~ etcd_interface].ipv4" - name: Install etcd - yum: pkg=etcd-2.* state=present + action: "{{ ansible_pkg_mgr }} name=etcd-2.* state=present" - name: Validate permissions on the config dir file: diff --git a/roles/etcd_common/defaults/main.yml b/roles/etcd_common/defaults/main.yml index 96f4b63af..3af509448 100644 --- a/roles/etcd_common/defaults/main.yml +++ b/roles/etcd_common/defaults/main.yml @@ -1,5 +1,5 @@ --- -etcd_peers_group: etcd +etcd_peers_group: oo_etcd_to_config # etcd server vars etcd_conf_dir: /etc/etcd diff --git a/roles/flannel/README.md b/roles/flannel/README.md index b8aa830ac..8f271aada 100644 --- a/roles/flannel/README.md +++ b/roles/flannel/README.md @@ -7,7 +7,8 @@ Requirements ------------ This role assumes it's being deployed on a RHEL/Fedora based host with package -named 'flannel' available via yum, in version superior to 0.3. +named 'flannel' available via yum or dnf (conditionally), in version superior +to 0.3. Role Variables -------------- diff --git a/roles/flannel/tasks/main.yml b/roles/flannel/tasks/main.yml index acfb009ec..1e86176ea 100644 --- a/roles/flannel/tasks/main.yml +++ b/roles/flannel/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Install flannel sudo: true - yum: pkg=flannel state=present + action: "{{ ansible_pkg_mgr }} name=flannel state=present" - name: Set flannel etcd url sudo: true diff --git a/roles/fluentd_master/tasks/main.yml b/roles/fluentd_master/tasks/main.yml index 55cd94460..65c67fe8d 100644 --- a/roles/fluentd_master/tasks/main.yml +++ b/roles/fluentd_master/tasks/main.yml @@ -1,9 +1,7 @@ --- # TODO: Update fluentd install and configuration when packaging is complete - name: download and install td-agent - yum: - name: 'http://packages.treasuredata.com/2/redhat/7/x86_64/td-agent-2.2.0-0.x86_64.rpm' - state: present + action: "{{ ansible_pkg_mgr }} name='http://packages.treasuredata.com/2/redhat/7/x86_64/td-agent-2.2.0-0.x86_64.rpm' state=present" - name: Verify fluentd plugin installed command: '/opt/td-agent/embedded/bin/gem query -i fluent-plugin-kubernetes' diff --git a/roles/fluentd_node/tasks/main.yml b/roles/fluentd_node/tasks/main.yml index f9ef30b83..85488b55e 100644 --- a/roles/fluentd_node/tasks/main.yml +++ b/roles/fluentd_node/tasks/main.yml @@ -1,9 +1,7 @@ --- # TODO: Update fluentd install and configuration when packaging is complete - name: download and install td-agent - yum: - name: 'http://packages.treasuredata.com/2/redhat/7/x86_64/td-agent-2.2.0-0.x86_64.rpm' - state: present + action: "{{ ansible_pkg_mgr }} name='http://packages.treasuredata.com/2/redhat/7/x86_64/td-agent-2.2.0-0.x86_64.rpm' state=present" - name: Verify fluentd plugin installed command: '/opt/td-agent/embedded/bin/gem query -i fluent-plugin-kubernetes' diff --git a/roles/haproxy/tasks/main.yml b/roles/haproxy/tasks/main.yml index 5638b7313..106ab8489 100644 --- a/roles/haproxy/tasks/main.yml +++ b/roles/haproxy/tasks/main.yml @@ -1,8 +1,6 @@ --- - name: Install haproxy - yum: - pkg: haproxy - state: present + action: "{{ ansible_pkg_mgr }} name=haproxy state=present" - name: Configure haproxy template: diff --git a/roles/kube_nfs_volumes/tasks/main.yml b/roles/kube_nfs_volumes/tasks/main.yml index d1dcf261a..2cc35844c 100644 --- a/roles/kube_nfs_volumes/tasks/main.yml +++ b/roles/kube_nfs_volumes/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Install pyparted (RedHat/Fedora) - yum: name=pyparted,python-httplib2 state=present + action: "{{ ansible_pkg_mgr }} name=pyparted,python-httplib2 state=present" - name: partition the drives partitionpool: disks={{ disks }} force={{ force }} sizes={{ sizes }} diff --git a/roles/kube_nfs_volumes/tasks/nfs.yml b/roles/kube_nfs_volumes/tasks/nfs.yml index 559fcf17c..eaec28544 100644 --- a/roles/kube_nfs_volumes/tasks/nfs.yml +++ b/roles/kube_nfs_volumes/tasks/nfs.yml @@ -1,6 +1,6 @@ --- -- name: Install NFS server on Fedora/Red Hat - yum: name=nfs-utils state=present +- name: Install NFS server + action: "{{ ansible_pkg_mgr }} name=nfs-utils state=present" - name: Start rpcbind on Fedora/Red Hat service: name=rpcbind state=started enabled=yes diff --git a/roles/lib_zabbix/library/zbx_action.py b/roles/lib_zabbix/library/zbx_action.py index d64cebae1..c08bef4f7 100644 --- a/roles/lib_zabbix/library/zbx_action.py +++ b/roles/lib_zabbix/library/zbx_action.py @@ -1,8 +1,8 @@ #!/usr/bin/env python +# vim: expandtab:tabstop=4:shiftwidth=4 ''' Ansible module for zabbix actions ''' -# vim: expandtab:tabstop=4:shiftwidth=4 # # Zabbix action ansible module # @@ -30,6 +30,17 @@ # pylint: disable=import-error from openshift_tools.monitoring.zbxapi import ZabbixAPI, ZabbixConnection, ZabbixAPIError +CUSTOM_SCRIPT_ACTION = '0' +IPMI_ACTION = '1' +SSH_ACTION = '2' +TELNET_ACTION = '3' +GLOBAL_SCRIPT_ACTION = '4' + +EXECUTE_ON_ZABBIX_AGENT = '0' +EXECUTE_ON_ZABBIX_SERVER = '1' + +OPERATION_REMOTE_COMMAND = '1' + def exists(content, key='result'): ''' Check if key exists in content or the size of content[key] > 0 ''' @@ -70,6 +81,40 @@ def filter_differences(zabbix_filters, user_filters): return rval +def host_in_zabbix(zab_hosts, usr_host): + ''' Check whether a particular user host is already in the + Zabbix list of hosts ''' + + for usr_hst_key, usr_hst_val in usr_host.items(): + for zab_host in zab_hosts: + if usr_hst_key in zab_host and \ + zab_host[usr_hst_key] == str(usr_hst_val): + return True + + return False + +def hostlist_in_zabbix(zab_hosts, usr_hosts): + ''' Check whether user-provided list of hosts are already in + the Zabbix action ''' + + if len(zab_hosts) != len(usr_hosts): + return False + + for usr_host in usr_hosts: + if not host_in_zabbix(zab_hosts, usr_host): + return False + + return True + +def opcommand_diff(zab_op_cmd, usr_op_cmd): + ''' Check whether user-provided opcommand matches what's already + stored in Zabbix ''' + + for usr_op_cmd_key, usr_op_cmd_val in usr_op_cmd.items(): + if zab_op_cmd[usr_op_cmd_key] != str(usr_op_cmd_val): + return True + return False + # This logic is quite complex. We are comparing two lists of dictionaries. # The outer for-loops allow us to descend down into both lists at the same time # and then walk over the key,val pairs of the incoming user dict's changes @@ -89,6 +134,9 @@ def operation_differences(zabbix_ops, user_ops): for zab, user in zip(zabbix_ops, user_ops): for key, val in user.items(): if key == 'opconditions': + if len(zab[key]) != len(val): + rval[key] = val + break for z_cond, u_cond in zip(zab[key], user[key]): if not all([str(u_cond[op_key]) == z_cond[op_key] for op_key in \ ['conditiontype', 'operator', 'value']]): @@ -113,6 +161,18 @@ def operation_differences(zabbix_ops, user_ops): if usr_ids != zab_usr_ids: rval[key] = val + elif key == 'opcommand': + if opcommand_diff(zab[key], val): + rval[key] = val + break + + # opcommand_grp can be treated just like opcommand_hst + # as opcommand_grp[] is just a list of groups + elif key == 'opcommand_hst' or key == 'opcommand_grp': + if not hostlist_in_zabbix(zab[key], val): + rval[key] = val + break + elif zab[key] != str(val): rval[key] = val return rval @@ -285,7 +345,7 @@ def get_condition_type(event_source, inc_condition): def get_operation_type(inc_operation): ''' determine the correct operation type''' o_types = {'send message': 0, - 'remote command': 1, + 'remote command': OPERATION_REMOTE_COMMAND, 'add host': 2, 'remove host': 3, 'add to host group': 4, @@ -298,7 +358,64 @@ def get_operation_type(inc_operation): return o_types[inc_operation] -def get_action_operations(zapi, inc_operations): +def get_opcommand_type(opcommand_type): + ''' determine the opcommand type ''' + oc_types = {'custom script': CUSTOM_SCRIPT_ACTION, + 'IPMI': IPMI_ACTION, + 'SSH': SSH_ACTION, + 'Telnet': TELNET_ACTION, + 'global script': GLOBAL_SCRIPT_ACTION, + } + + return oc_types[opcommand_type] + +def get_execute_on(execute_on): + ''' determine the execution target ''' + e_types = {'zabbix agent': EXECUTE_ON_ZABBIX_AGENT, + 'zabbix server': EXECUTE_ON_ZABBIX_SERVER, + } + + return e_types[execute_on] + +def action_remote_command(ansible_module, zapi, operation): + ''' Process remote command type of actions ''' + + if 'type' not in operation['opcommand']: + ansible_module.exit_json(failed=True, changed=False, state='unknown', + results="No Operation Type provided") + + operation['opcommand']['type'] = get_opcommand_type(operation['opcommand']['type']) + + if operation['opcommand']['type'] == CUSTOM_SCRIPT_ACTION: + + if 'execute_on' in operation['opcommand']: + operation['opcommand']['execute_on'] = get_execute_on(operation['opcommand']['execute_on']) + + # custom script still requires the target hosts/groups to be set + operation['opcommand_hst'] = [] + operation['opcommand_grp'] = [] + for usr_host in operation['target_hosts']: + if usr_host['target_type'] == 'zabbix server': + # 0 = target host local/current host + operation['opcommand_hst'].append({'hostid': 0}) + elif usr_host['target_type'] == 'group': + group_name = usr_host['target'] + gid = get_host_group_id_by_name(zapi, group_name) + operation['opcommand_grp'].append({'groupid': gid}) + elif usr_host['target_type'] == 'host': + host_name = usr_host['target'] + hid = get_host_id_by_name(zapi, host_name) + operation['opcommand_hst'].append({'hostid': hid}) + + # 'target_hosts' is just to make it easier to build zbx_actions + # not part of ZabbixAPI + del operation['target_hosts'] + else: + ansible_module.exit_json(failed=True, changed=False, state='unknown', + results="Unsupported remote command type") + + +def get_action_operations(ansible_module, zapi, inc_operations): '''Convert the operations into syntax for api''' for operation in inc_operations: operation['operationtype'] = get_operation_type(operation['operationtype']) @@ -312,9 +429,8 @@ def get_action_operations(zapi, inc_operations): else: operation['opmessage']['default_msg'] = 0 - # NOT supported for remote commands - elif operation['operationtype'] == 1: - continue + elif operation['operationtype'] == OPERATION_REMOTE_COMMAND: + action_remote_command(ansible_module, zapi, operation) # Handle Operation conditions: # Currently there is only 1 available which @@ -330,9 +446,9 @@ def get_action_operations(zapi, inc_operations): condition['operator'] = 0 if condition['value'] == 'acknowledged': - condition['operator'] = 1 + condition['value'] = 1 else: - condition['operator'] = 0 + condition['value'] = 0 return inc_operations @@ -454,14 +570,15 @@ def main(): if not exists(content): module.exit_json(changed=False, state="absent") - content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0]['itemid']]) + content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0]['actionid']]) module.exit_json(changed=True, results=content['result'], state="absent") # Create and Update if state == 'present': conditions = get_action_conditions(zapi, module.params['event_source'], module.params['conditions_filter']) - operations = get_action_operations(zapi, module.params['operations']) + operations = get_action_operations(module, zapi, + module.params['operations']) params = {'name': module.params['name'], 'esc_period': module.params['escalation_time'], 'eventsource': get_event_source(module.params['event_source']), diff --git a/roles/lib_zabbix/library/zbx_graph.py b/roles/lib_zabbix/library/zbx_graph.py new file mode 100644 index 000000000..121ec3dee --- /dev/null +++ b/roles/lib_zabbix/library/zbx_graph.py @@ -0,0 +1,331 @@ +#!/usr/bin/env python +''' + Ansible module for zabbix graphs +''' +# vim: expandtab:tabstop=4:shiftwidth=4 +# +# Zabbix graphs 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. +# + +#--- +#- hosts: localhost +# gather_facts: no +# tasks: +# - zbx_graph: +# zbx_server: https://zabbixserver/zabbix/api_jsonrpc.php +# zbx_user: Admin +# zbx_password: zabbix +# name: Test Graph +# height: 300 +# width: 500 +# graph_items: +# - item_name: openshift.master.etcd.create.fail +# color: red +# line_style: bold +# - item_name: openshift.master.etcd.create.success +# color: red +# line_style: bold +# +# + +# 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_graph_type(graphtype): + ''' + Possible values: + 0 - normal; + 1 - stacked; + 2 - pie; + 3 - exploded; + ''' + gtype = 0 + if 'stacked' in graphtype: + gtype = 1 + elif 'pie' in graphtype: + gtype = 2 + elif 'exploded' in graphtype: + gtype = 3 + + return gtype + +def get_show_legend(show_legend): + '''Get the value for show_legend + 0 - hide + 1 - (default) show + ''' + rval = 1 + if 'hide' == show_legend: + rval = 0 + + return rval + +def get_template_id(zapi, template_name): + ''' + get related templates + ''' + # Fetch templates by name + content = zapi.get_content('template', + 'get', + {'filter': {'host': template_name},}) + + if content.has_key('result'): + return content['result'][0]['templateid'] + + return None + +def get_color(color_in): + ''' Receive a color and translate it to a hex representation of the color + + Will have a few setup by default + ''' + colors = {'black': '000000', + 'red': 'FF0000', + 'pink': 'FFC0CB', + 'purple': '800080', + 'orange': 'FFA500', + 'gold': 'FFD700', + 'yellow': 'FFFF00', + 'green': '008000', + 'cyan': '00FFFF', + 'aqua': '00FFFF', + 'blue': '0000FF', + 'brown': 'A52A2A', + 'gray': '808080', + 'grey': '808080', + 'silver': 'C0C0C0', + } + if colors.has_key(color_in): + return colors[color_in] + + return color_in + +def get_line_style(style): + '''determine the line style + ''' + line_style = {'line': 0, + 'filled': 1, + 'bold': 2, + 'dot': 3, + 'dashed': 4, + 'gradient': 5, + } + + if line_style.has_key(style): + return line_style[style] + + return 0 + +def get_calc_function(func): + '''Determine the caclulation function''' + rval = 2 # default to avg + if 'min' in func: + rval = 1 + elif 'max' in func: + rval = 4 + elif 'all' in func: + rval = 7 + elif 'last' in func: + rval = 9 + + return rval + +def get_graph_item_type(gtype): + '''Determine the graph item type + ''' + rval = 0 # simple graph type + if 'sum' in gtype: + rval = 2 + + return rval + +def get_graph_items(zapi, gitems): + '''Get graph items by id''' + + r_items = [] + for item in gitems: + content = zapi.get_content('item', + 'get', + {'filter': {'name': item['item_name']}}) + _ = item.pop('item_name') + color = get_color(item.pop('color')) + drawtype = get_line_style(item.get('line_style', 'line')) + func = get_calc_function(item.get('calc_func', 'avg')) + g_type = get_graph_item_type(item.get('graph_item_type', 'simple')) + + if content.has_key('result'): + tmp = {'itemid': content['result'][0]['itemid'], + 'color': color, + 'drawtype': drawtype, + 'calc_fnc': func, + 'type': g_type, + } + r_items.append(tmp) + + return r_items + +def compare_gitems(zabbix_items, user_items): + '''Compare zabbix results with the user's supplied items + return True if user_items are equal + return False if any of the values differ + ''' + if len(zabbix_items) != len(user_items): + return False + + for u_item in user_items: + for z_item in zabbix_items: + if u_item['itemid'] == z_item['itemid']: + if not all([str(value) == z_item[key] for key, value in u_item.items()]): + return False + + return True + +# The branches are needed for CRUD and error handling +# pylint: disable=too-many-branches +def main(): + ''' + ansible zabbix module for zbx_graphs + ''' + + 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'), + height=dict(default=None, type='int'), + width=dict(default=None, type='int'), + graph_type=dict(default='normal', type='str'), + show_legend=dict(default='show', type='str'), + state=dict(default='present', type='str'), + graph_items=dict(default=None, type='list'), + ), + #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 = 'graph' + state = module.params['state'] + + content = zapi.get_content(zbx_class_name, + 'get', + {'filter': {'name': module.params['name']}, + #'templateids': templateid, + 'selectGraphItems': '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]['graphid']]) + module.exit_json(changed=True, results=content['result'], state="absent") + + # Create and Update + if state == 'present': + + params = {'name': module.params['name'], + 'height': module.params['height'], + 'width': module.params['width'], + 'graphtype': get_graph_type(module.params['graph_type']), + 'show_legend': get_show_legend(module.params['show_legend']), + 'gitems': get_graph_items(zapi, module.params['graph_items']), + } + + # 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") + + module.exit_json(changed=True, results=content['result'], state='present') + + + ######## + # UPDATE + ######## + differences = {} + zab_results = content['result'][0] + for key, value in params.items(): + + if key == 'gitems': + if not compare_gitems(zab_results[key], value): + differences[key] = value + + 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") + + # We have differences and need to update + differences['graphid'] = zab_results['graphid'] + 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_graphprototype.py b/roles/lib_zabbix/library/zbx_graphprototype.py new file mode 100644 index 000000000..8287c1e2d --- /dev/null +++ b/roles/lib_zabbix/library/zbx_graphprototype.py @@ -0,0 +1,331 @@ +#!/usr/bin/env python +''' + Ansible module for zabbix graphprototypes +''' +# vim: expandtab:tabstop=4:shiftwidth=4 +# +# Zabbix graphprototypes 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. +# + +#--- +#- hosts: localhost +# gather_facts: no +# tasks: +# - zbx_graphprototype: +# zbx_server: https://zabbixserver/zabbix/api_jsonrpc.php +# zbx_user: Admin +# zbx_password: zabbix +# name: Test Graph +# height: 300 +# width: 500 +# graph_items: +# - item_name: Bytes per second IN on network interface {#OSO_NET_INTERFACE} +# color: red +# line_style: bold +# item_type: prototype +# - item_name: Template OS Linux: Bytes per second OUT on network interface {#OSO_NET_INTERFACE} +# item_type: prototype +# +# + +# 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_graph_type(graphtype): + ''' + Possible values: + 0 - normal; + 1 - stacked; + 2 - pie; + 3 - exploded; + ''' + gtype = 0 + if 'stacked' in graphtype: + gtype = 1 + elif 'pie' in graphtype: + gtype = 2 + elif 'exploded' in graphtype: + gtype = 3 + + return gtype + +def get_show_legend(show_legend): + '''Get the value for show_legend + 0 - hide + 1 - (default) show + ''' + rval = 1 + if 'hide' == show_legend: + rval = 0 + + return rval + +def get_template_id(zapi, template_name): + ''' + get related templates + ''' + # Fetch templates by name + content = zapi.get_content('template', + 'get', + {'filter': {'host': template_name},}) + + if content.has_key('result'): + return content['result'][0]['templateid'] + + return None + +def get_color(color_in='black'): + ''' Receive a color and translate it to a hex representation of the color + + Will have a few setup by default + ''' + colors = {'black': '000000', + 'red': 'FF0000', + 'pink': 'FFC0CB', + 'purple': '800080', + 'orange': 'FFA500', + 'gold': 'FFD700', + 'yellow': 'FFFF00', + 'green': '008000', + 'cyan': '00FFFF', + 'aqua': '00FFFF', + 'blue': '0000FF', + 'brown': 'A52A2A', + 'gray': '808080', + 'grey': '808080', + 'silver': 'C0C0C0', + } + if colors.has_key(color_in): + return colors[color_in] + + return color_in + +def get_line_style(style): + '''determine the line style + ''' + line_style = {'line': 0, + 'filled': 1, + 'bold': 2, + 'dot': 3, + 'dashed': 4, + 'gradient': 5, + } + + if line_style.has_key(style): + return line_style[style] + + return 0 + +def get_calc_function(func): + '''Determine the caclulation function''' + rval = 2 # default to avg + if 'min' in func: + rval = 1 + elif 'max' in func: + rval = 4 + elif 'all' in func: + rval = 7 + elif 'last' in func: + rval = 9 + + return rval + +def get_graph_item_type(gtype): + '''Determine the graph item type + ''' + rval = 0 # simple graph type + if 'sum' in gtype: + rval = 2 + + return rval + +def get_graph_items(zapi, gitems): + '''Get graph items by id''' + + r_items = [] + for item in gitems: + content = zapi.get_content('item%s' % item.get('item_type', ''), + 'get', + {'filter': {'name': item['item_name']}}) + _ = item.pop('item_name') + color = get_color(item.pop('color', 'black')) + drawtype = get_line_style(item.get('line_style', 'line')) + func = get_calc_function(item.get('calc_func', 'avg')) + g_type = get_graph_item_type(item.get('graph_item_type', 'simple')) + + if content.has_key('result'): + tmp = {'itemid': content['result'][0]['itemid'], + 'color': color, + 'drawtype': drawtype, + 'calc_fnc': func, + 'type': g_type, + } + r_items.append(tmp) + + return r_items + +def compare_gitems(zabbix_items, user_items): + '''Compare zabbix results with the user's supplied items + return True if user_items are equal + return False if any of the values differ + ''' + if len(zabbix_items) != len(user_items): + return False + + for u_item in user_items: + for z_item in zabbix_items: + if u_item['itemid'] == z_item['itemid']: + if not all([str(value) == z_item[key] for key, value in u_item.items()]): + return False + + return True + +# The branches are needed for CRUD and error handling +# pylint: disable=too-many-branches +def main(): + ''' + ansible zabbix module for zbx_graphprototypes + ''' + + 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'), + height=dict(default=None, type='int'), + width=dict(default=None, type='int'), + graph_type=dict(default='normal', type='str'), + show_legend=dict(default='show', type='str'), + state=dict(default='present', type='str'), + graph_items=dict(default=None, type='list'), + ), + #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 = 'graphprototype' + state = module.params['state'] + + content = zapi.get_content(zbx_class_name, + 'get', + {'filter': {'name': module.params['name']}, + #'templateids': templateid, + 'selectGraphItems': '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]['graphid']]) + module.exit_json(changed=True, results=content['result'], state="absent") + + # Create and Update + if state == 'present': + + params = {'name': module.params['name'], + 'height': module.params['height'], + 'width': module.params['width'], + 'graphtype': get_graph_type(module.params['graph_type']), + 'show_legend': get_show_legend(module.params['show_legend']), + 'gitems': get_graph_items(zapi, module.params['graph_items']), + } + + # 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") + + module.exit_json(changed=True, results=content['result'], state='present') + + + ######## + # UPDATE + ######## + differences = {} + zab_results = content['result'][0] + for key, value in params.items(): + + if key == 'gitems': + if not compare_gitems(zab_results[key], value): + differences[key] = value + + 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") + + # We have differences and need to update + differences['graphid'] = zab_results['graphid'] + 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_httptest.py b/roles/lib_zabbix/library/zbx_httptest.py index 96733b3d1..6b28117ad 100644 --- a/roles/lib_zabbix/library/zbx_httptest.py +++ b/roles/lib_zabbix/library/zbx_httptest.py @@ -131,6 +131,14 @@ def steps_equal(zab_steps, user_steps): return True +def process_steps(steps): + '''Preprocess the step parameters''' + for idx, step in enumerate(steps): + if not step.has_key('no'): + step['no'] = idx + 1 + + return steps + # The branches are needed for CRUD and error handling # pylint: disable=too-many-branches def main(): @@ -218,7 +226,7 @@ def main(): 'hostid': hostid, 'agent': module.params['agent'], 'retries': module.params['retries'], - 'steps': module.params['steps'], + 'steps': process_steps(module.params['steps']), 'applicationid': get_app_id(zapi, module.params['application']), 'delay': module.params['interval'], 'verify_host': get_verify_host(module.params['verify_host']), diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml index 2992505bf..47749389e 100644 --- a/roles/lib_zabbix/tasks/create_template.yml +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -105,3 +105,27 @@ description: "{{ item.description | default('', True) }}" with_items: template.ztriggerprototypes when: template.ztriggerprototypes is defined + +- name: Create Graphs + zbx_graph: + zbx_server: "{{ server }}" + zbx_user: "{{ user }}" + zbx_password: "{{ password }}" + name: "{{ item.name }}" + height: "{{ item.height }}" + width: "{{ item.width }}" + graph_items: "{{ item.graph_items }}" + with_items: template.zgraphs + when: template.zgraphs is defined + +- name: Create Graph Prototypes + zbx_graphprototype: + zbx_server: "{{ server }}" + zbx_user: "{{ user }}" + zbx_password: "{{ password }}" + name: "{{ item.name }}" + height: "{{ item.height }}" + width: "{{ item.width }}" + graph_items: "{{ item.graph_items }}" + with_items: template.zgraphprototypes + when: template.zgraphprototypes is defined diff --git a/roles/nickhammond.logrotate/tasks/main.yml b/roles/nickhammond.logrotate/tasks/main.yml index fda23e05e..0a0cf1fae 100644 --- a/roles/nickhammond.logrotate/tasks/main.yml +++ b/roles/nickhammond.logrotate/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: nickhammond.logrotate | Install logrotate - action: "{{ansible_pkg_mgr}} pkg=logrotate state=present" + action: "{{ ansible_pkg_mgr }} name=logrotate state=present" - name: nickhammond.logrotate | Setup logrotate.d scripts template: diff --git a/roles/openshift_ansible_inventory/tasks/main.yml b/roles/openshift_ansible_inventory/tasks/main.yml index f6919dada..4a0968686 100644 --- a/roles/openshift_ansible_inventory/tasks/main.yml +++ b/roles/openshift_ansible_inventory/tasks/main.yml @@ -1,7 +1,5 @@ --- -- yum: - name: "{{ item }}" - state: present +- action: "{{ ansible_pkg_mgr }} name={{ item}} state=present" with_items: - openshift-ansible-inventory - openshift-ansible-inventory-aws diff --git a/roles/openshift_cluster_metrics/tasks/main.yml b/roles/openshift_cluster_metrics/tasks/main.yml index 3938aba4c..9b7735e54 100644 --- a/roles/openshift_cluster_metrics/tasks/main.yml +++ b/roles/openshift_cluster_metrics/tasks/main.yml @@ -7,7 +7,7 @@ - name: Create InfluxDB Services command: > - {{ openshift.common.client_binary }} create -f + {{ openshift.common.client_binary }} create -f /etc/openshift/cluster-metrics/influxdb.yaml register: oex_influxdb_services failed_when: "'already exists' not in oex_influxdb_services.stderr and oex_influxdb_services.rc != 0" @@ -15,14 +15,14 @@ - name: Create Heapster Service Account command: > - {{ openshift.common.client_binary }} create -f + {{ openshift.common.client_binary }} create -f /etc/openshift/cluster-metrics/heapster-serviceaccount.yaml register: oex_heapster_serviceaccount failed_when: "'already exists' not in oex_heapster_serviceaccount.stderr and oex_heapster_serviceaccount.rc != 0" changed_when: false - name: Add cluster-reader role to Heapster - command: > + command: > {{ openshift.common.admin_binary }} policy add-cluster-role-to-user cluster-reader diff --git a/roles/openshift_common/tasks/main.yml b/roles/openshift_common/tasks/main.yml index e9df4e364..c34f42838 100644 --- a/roles/openshift_common/tasks/main.yml +++ b/roles/openshift_common/tasks/main.yml @@ -3,6 +3,10 @@ msg: Flannel can not be used with openshift sdn when: openshift_use_openshift_sdn | default(false) | bool and openshift_use_flannel | default(false) | bool +- fail: + msg: openshift_hostname must be 64 characters or less + when: openshift_hostname is defined and openshift_hostname | length > 64 + - name: Set common Cluster facts openshift_facts: role: common @@ -10,6 +14,7 @@ cluster_id: "{{ openshift_cluster_id | default('default') }}" debug_level: "{{ openshift_debug_level | default(2) }}" hostname: "{{ openshift_hostname | default(None) }}" + install_examples: "{{ openshift_install_examples | default(True) }}" ip: "{{ openshift_ip | default(None) }}" public_hostname: "{{ openshift_public_hostname | default(None) }}" public_ip: "{{ openshift_public_ip | default(None) }}" @@ -18,3 +23,19 @@ deployment_type: "{{ openshift_deployment_type }}" use_fluentd: "{{ openshift_use_fluentd | default(None) }}" use_flannel: "{{ openshift_use_flannel | default(None) }}" + use_manageiq: "{{ openshift_use_manageiq | default(None) }}" + +- name: Install the base package for versioning + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') }} state=present" + +- name: Set version facts + openshift_facts: + + # For enterprise versions < 3.1 and origin versions < 1.1 we want to set the + # hostname by default. +- set_fact: + set_hostname_default: "{{ not openshift.common.version_greater_than_3_1_or_1_1 }}" + +- name: Set hostname + hostname: name={{ openshift.common.hostname }} + when: openshift_set_hostname | default(set_hostname_default) | bool diff --git a/roles/openshift_examples/README.md b/roles/openshift_examples/README.md index 7d8735a0a..6ddbe7017 100644 --- a/roles/openshift_examples/README.md +++ b/roles/openshift_examples/README.md @@ -11,6 +11,13 @@ ansible. Requirements ------------ +Facts +----- + +| Name | Default Value | Description | +-----------------------------|---------------|----------------------------------------| +| openshift_install_examples | true | Runs the role with the below variables | + Role Variables -------------- @@ -32,7 +39,7 @@ Example Playbook TODO ---- Currently we use `oc create -f` against various files and we accept non zero return code as a success -if (and only iff) stderr also contains the string 'already exists'. This means that if one object in the file exists already +if (and only if) stderr also contains the string 'already exists'. This means that if one object in the file exists already but others fail to create you won't be aware of the failure. This also means that we do not currently support updating existing objects. diff --git a/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-centos7-v1-0.json b/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-centos7-v1-0.json deleted file mode 100644 index 268d680f4..000000000 --- a/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-centos7-v1-0.json +++ /dev/null @@ -1,285 +0,0 @@ -{ - "kind": "ImageStreamList", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "ruby", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "openshift/ruby-20-centos7", - "tags": [ - { - "name": "latest" - }, - { - "name": "2.0", - "annotations": { - "description": "Build and run Ruby 2.0 applications", - "iconClass": "icon-ruby", - "tags": "builder,ruby", - "supports": "ruby:2.0,ruby", - "version": "2.0", - "sampleRepo": "https://github.com/openshift/ruby-ex.git" - }, - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "nodejs", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "openshift/nodejs-010-centos7", - "tags": [ - { - "name": "latest" - }, - { - "name": "0.10", - "annotations": { - "description": "Build and run NodeJS 0.10 applications", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "supports":"nodejs:0.10,nodejs:0.1,nodejs", - "version": "0.10", - "sampleRepo": "https://github.com/openshift/nodejs-ex.git" - }, - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "perl", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "openshift/perl-516-centos7", - "tags": [ - { - "name": "latest" - }, - { - "name": "5.16", - "annotations": { - "description": "Build and run Perl 5.16 applications", - "iconClass": "icon-perl", - "tags": "builder,perl", - "supports":"perl:5.16,perl", - "version": "5.16", - "sampleRepo": "https://github.com/openshift/dancer-ex.git" - }, - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "php", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "openshift/php-55-centos7", - "tags": [ - { - "name": "latest" - }, - { - "name": "5.5", - "annotations": { - "description": "Build and run PHP 5.5 applications", - "iconClass": "icon-php", - "tags": "builder,php", - "supports":"php:5.5,php", - "version": "5.5", - "sampleRepo": "https://github.com/openshift/cakephp-ex.git" - }, - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "python", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "openshift/python-33-centos7", - "tags": [ - { - "name": "latest" - }, - { - "name": "3.3", - "annotations": { - "description": "Build and run Python 3.3 applications", - "iconClass": "icon-python", - "tags": "builder,python", - "supports":"python:3.3,python", - "version": "3.3", - "sampleRepo": "https://github.com/openshift/django-ex.git" - }, - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "wildfly", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "openshift/wildfly-81-centos7", - "tags": [ - { - "name": "latest" - }, - { - "name": "8.1", - "annotations": { - "description": "Build and run Java applications on Wildfly 8.1", - "iconClass": "icon-wildfly", - "tags": "builder,wildfly,java", - "supports":"wildfly:8.1,jee,java", - "version": "8.1", - "sampleRepo": "https://github.com/bparees/openshift-jee-sample.git" - }, - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "mysql", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "openshift/mysql-55-centos7", - "tags": [ - { - "name": "latest" - }, - { - "name": "5.5", - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "postgresql", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "openshift/postgresql-92-centos7", - "tags": [ - { - "name": "latest" - }, - { - "name": "9.2", - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "mongodb", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "openshift/mongodb-24-centos7", - "tags": [ - { - "name": "latest" - }, - { - "name": "2.4", - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "jenkins", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "openshift/jenkins-1-centos7", - "tags": [ - { - "name": "latest" - }, - { - "name": "1", - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - } - ] -} diff --git a/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-centos7.json b/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-centos7.json index 1a78b1279..268d680f4 100644 --- a/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-centos7.json +++ b/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-centos7.json @@ -11,13 +11,10 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "openshift/ruby-20-centos7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "2.0" - } + "name": "latest" }, { "name": "2.0", @@ -30,23 +27,8 @@ "sampleRepo": "https://github.com/openshift/ruby-ex.git" }, "from": { - "Kind": "DockerImage", - "Name": "openshift/ruby-20-centos7:latest" - } - }, - { - "name": "2.2", - "annotations": { - "description": "Build and run Ruby 2.2 applications", - "iconClass": "icon-ruby", - "tags": "builder,ruby", - "supports": "ruby:2.2,ruby", - "version": "2.2", - "sampleRepo": "https://github.com/openshift/ruby-ex.git" - }, - "from": { - "Kind": "DockerImage", - "Name": "centos/ruby-22-centos7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -60,13 +42,10 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "openshift/nodejs-010-centos7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "0.10" - } + "name": "latest" }, { "name": "0.10", @@ -79,8 +58,8 @@ "sampleRepo": "https://github.com/openshift/nodejs-ex.git" }, "from": { - "Kind": "DockerImage", - "Name": "openshift/nodejs-010-centos7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -94,13 +73,10 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "openshift/perl-516-centos7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "5.16" - } + "name": "latest" }, { "name": "5.16", @@ -113,25 +89,9 @@ "sampleRepo": "https://github.com/openshift/dancer-ex.git" }, "from": { - "Kind": "DockerImage", - "Name": "openshift/perl-516-centos7:latest" - } - }, - { - "name": "5.20", - "annotations": { - "description": "Build and run Perl 5.20 applications", - "iconClass": "icon-perl", - "tags": "builder,perl", - "supports":"perl:5.20,perl", - "version": "5.20", - "sampleRepo": "https://github.com/openshift/dancer-ex.git" - }, - "from": { - "Kind": "DockerImage", - "Name": "centos/perl-520-centos7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } - } ] } @@ -144,13 +104,10 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "openshift/php-55-centos7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "5.5" - } + "name": "latest" }, { "name": "5.5", @@ -163,23 +120,8 @@ "sampleRepo": "https://github.com/openshift/cakephp-ex.git" }, "from": { - "Kind": "DockerImage", - "Name": "openshift/php-55-centos7:latest" - } - }, - { - "name": "5.6", - "annotations": { - "description": "Build and run PHP 5.6 applications", - "iconClass": "icon-php", - "tags": "builder,php", - "supports":"php:5.6,php", - "version": "5.6", - "sampleRepo": "https://github.com/openshift/cakephp-ex.git" - }, - "from": { - "Kind": "DockerImage", - "Name": "centos/php-56-centos7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -193,13 +135,10 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "openshift/python-33-centos7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "3.3" - } + "name": "latest" }, { "name": "3.3", @@ -212,38 +151,8 @@ "sampleRepo": "https://github.com/openshift/django-ex.git" }, "from": { - "Kind": "DockerImage", - "Name": "openshift/python-33-centos7:latest" - } - }, - { - "name": "2.7", - "annotations": { - "description": "Build and run Python 2.7 applications", - "iconClass": "icon-python", - "tags": "builder,python", - "supports":"python:2.7,python", - "version": "2.7", - "sampleRepo": "https://github.com/openshift/django-ex.git" - }, - "from": { - "Kind": "DockerImage", - "Name": "centos/python-27-centos7:latest" - } - }, - { - "name": "3.4", - "annotations": { - "description": "Build and run Python 3.4 applications", - "iconClass": "icon-python", - "tags": "builder,python", - "supports":"python:3.4,python", - "version": "3.4", - "sampleRepo": "https://github.com/openshift/django-ex.git" - }, - "from": { - "Kind": "DockerImage", - "Name": "centos/python-34-centos7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -257,13 +166,10 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "openshift/wildfly-81-centos7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "8.1" - } + "name": "latest" }, { "name": "8.1", @@ -276,8 +182,8 @@ "sampleRepo": "https://github.com/bparees/openshift-jee-sample.git" }, "from": { - "Kind": "DockerImage", - "Name": "openshift/wildfly-81-centos7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -291,26 +197,16 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "openshift/mysql-55-centos7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "5.5" - } + "name": "latest" }, { "name": "5.5", "from": { - "Kind": "DockerImage", - "Name": "openshift/mysql-55-centos7:latest" - } - }, - { - "name": "5.6", - "from": { - "Kind": "DockerImage", - "Name": "centos/mysql-56-centos7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -324,26 +220,16 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "openshift/postgresql-92-centos7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "9.2" - } + "name": "latest" }, { "name": "9.2", "from": { - "Kind": "DockerImage", - "Name": "openshift/postgresql-92-centos7:latest" - } - }, - { - "name": "9.4", - "from": { - "Kind": "DockerImage", - "Name": "centos/postgresql-94-centos7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -357,26 +243,16 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "openshift/mongodb-24-centos7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "2.4" - } + "name": "latest" }, { "name": "2.4", "from": { - "Kind": "DockerImage", - "Name": "openshift/mongodb-24-centos7:latest" - } - }, - { - "name": "2.6", - "from": { - "Kind": "DockerImage", - "Name": "centos/mongodb-26-centos7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -390,19 +266,16 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "openshift/jenkins-1-centos7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "1" - } + "name": "latest" }, { "name": "1", "from": { - "Kind": "DockerImage", - "Name": "openshift/jenkins-1-centos7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] diff --git a/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-rhel7-v1-0.json b/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-rhel7-v1-0.json deleted file mode 100644 index aa62ebd53..000000000 --- a/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-rhel7-v1-0.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "kind": "ImageStreamList", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "ruby", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "registry.access.redhat.com/openshift3/ruby-20-rhel7", - "tags": [ - { - "name": "latest" - }, - { - "name": "2.0", - "annotations": { - "description": "Build and run Ruby 2.0 applications", - "iconClass": "icon-ruby", - "tags": "builder,ruby", - "supports": "ruby:2.0,ruby", - "version": "2.0", - "sampleRepo": "https://github.com/openshift/ruby-ex.git" - }, - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "nodejs", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "registry.access.redhat.com/openshift3/nodejs-010-rhel7", - "tags": [ - { - "name": "latest" - }, - { - "name": "0.10", - "annotations": { - "description": "Build and run NodeJS 0.10 applications", - "iconClass": "icon-nodejs", - "tags": "builder,nodejs", - "supports":"nodejs:0.10,nodejs:0.1,nodejs", - "version": "0.10", - "sampleRepo": "https://github.com/openshift/nodejs-ex.git" - }, - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "perl", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "registry.access.redhat.com/openshift3/perl-516-rhel7", - "tags": [ - { - "name": "latest" - }, - { - "name": "5.16", - "annotations": { - "description": "Build and run Perl 5.16 applications", - "iconClass": "icon-perl", - "tags": "builder,perl", - "supports":"perl:5.16,perl", - "version": "5.16", - "sampleRepo": "https://github.com/openshift/dancer-ex.git" - }, - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "php", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "registry.access.redhat.com/openshift3/php-55-rhel7", - "tags": [ - { - "name": "latest" - }, - { - "name": "5.5", - "annotations": { - "description": "Build and run PHP 5.5 applications", - "iconClass": "icon-php", - "tags": "builder,php", - "supports":"php:5.5,php", - "version": "5.5", - "sampleRepo": "https://github.com/openshift/cakephp-ex.git" - }, - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "python", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "registry.access.redhat.com/openshift3/python-33-rhel7", - "tags": [ - { - "name": "latest" - }, - { - "name": "3.3", - "annotations": { - "description": "Build and run Python 3.3 applications", - "iconClass": "icon-python", - "tags": "builder,python", - "supports":"python:3.3,python", - "version": "3.3", - "sampleRepo": "https://github.com/openshift/django-ex.git" - }, - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "mysql", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "registry.access.redhat.com/openshift3/mysql-55-rhel7", - "tags": [ - { - "name": "latest" - }, - { - "name": "5.5", - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "postgresql", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "registry.access.redhat.com/openshift3/postgresql-92-rhel7", - "tags": [ - { - "name": "latest" - }, - { - "name": "9.2", - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "mongodb", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "registry.access.redhat.com/openshift3/mongodb-24-rhel7", - "tags": [ - { - "name": "latest" - }, - { - "name": "2.4", - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "jenkins", - "creationTimestamp": null - }, - "spec": { - "dockerImageRepository": "registry.access.redhat.com/openshift3/jenkins-1-rhel7", - "tags": [ - { - "name": "latest" - }, - { - "name": "1", - "from": { - "Kind": "ImageStreamTag", - "Name": "latest" - } - } - ] - } - } - ] -} diff --git a/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-rhel7.json b/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-rhel7.json index d2a8cfb1d..aa62ebd53 100644 --- a/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-rhel7.json +++ b/roles/openshift_examples/files/examples/v1.0/image-streams/image-streams-rhel7.json @@ -11,13 +11,10 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "registry.access.redhat.com/openshift3/ruby-20-rhel7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "2.0" - } + "name": "latest" }, { "name": "2.0", @@ -30,23 +27,8 @@ "sampleRepo": "https://github.com/openshift/ruby-ex.git" }, "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/openshift3/ruby-20-rhel7:latest" - } - }, - { - "name": "2.2", - "annotations": { - "description": "Build and run Ruby 2.2 applications", - "iconClass": "icon-ruby", - "tags": "builder,ruby", - "supports": "ruby:2.2,ruby", - "version": "2.2", - "sampleRepo": "https://github.com/openshift/ruby-ex.git" - }, - "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/rhscl/ruby-22-rhel7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -60,13 +42,10 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "registry.access.redhat.com/openshift3/nodejs-010-rhel7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "0.10" - } + "name": "latest" }, { "name": "0.10", @@ -79,8 +58,8 @@ "sampleRepo": "https://github.com/openshift/nodejs-ex.git" }, "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/openshift3/nodejs-010-rhel7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -94,13 +73,10 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "registry.access.redhat.com/openshift3/perl-516-rhel7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "5.16" - } + "name": "latest" }, { "name": "5.16", @@ -113,25 +89,9 @@ "sampleRepo": "https://github.com/openshift/dancer-ex.git" }, "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/openshift3/perl-516-rhel7:latest" - } - }, - { - "name": "5.20", - "annotations": { - "description": "Build and run Perl 5.20 applications", - "iconClass": "icon-perl", - "tags": "builder,perl", - "supports":"perl:5.20,perl", - "version": "5.20", - "sampleRepo": "https://github.com/openshift/dancer-ex.git" - }, - "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/rhscl/perl-520-rhel7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } - } ] } @@ -144,13 +104,10 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "registry.access.redhat.com/openshift3/php-55-rhel7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "5.5" - } + "name": "latest" }, { "name": "5.5", @@ -163,23 +120,8 @@ "sampleRepo": "https://github.com/openshift/cakephp-ex.git" }, "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/openshift3/php-55-rhel7:latest" - } - }, - { - "name": "5.6", - "annotations": { - "description": "Build and run PHP 5.6 applications", - "iconClass": "icon-php", - "tags": "builder,php", - "supports":"php:5.6,php", - "version": "5.6", - "sampleRepo": "https://github.com/openshift/cakephp-ex.git" - }, - "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/rhscl/php-56-rhel7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -193,13 +135,10 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "registry.access.redhat.com/openshift3/python-33-rhel7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "3.3" - } + "name": "latest" }, { "name": "3.3", @@ -212,38 +151,8 @@ "sampleRepo": "https://github.com/openshift/django-ex.git" }, "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/openshift3/python-33-rhel7:latest" - } - }, - { - "name": "2.7", - "annotations": { - "description": "Build and run Python 2.7 applications", - "iconClass": "icon-python", - "tags": "builder,python", - "supports":"python:2.7,python", - "version": "2.7", - "sampleRepo": "https://github.com/openshift/django-ex.git" - }, - "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/rhscl/python-27-rhel7:latest" - } - }, - { - "name": "3.4", - "annotations": { - "description": "Build and run Python 3.4 applications", - "iconClass": "icon-python", - "tags": "builder,python", - "supports":"python:3.4,python", - "version": "3.4", - "sampleRepo": "https://github.com/openshift/django-ex.git" - }, - "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/rhscl/python-34-rhel7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -257,26 +166,16 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "registry.access.redhat.com/openshift3/mysql-55-rhel7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "5.5" - } + "name": "latest" }, { "name": "5.5", "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/openshift3/mysql-55-rhel7:latest" - } - }, - { - "name": "5.6", - "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/rhscl/mysql-56-rhel7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -290,26 +189,16 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "registry.access.redhat.com/openshift3/postgresql-92-rhel7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "9.2" - } + "name": "latest" }, { "name": "9.2", "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/openshift3/postgresql-92-rhel7:latest" - } - }, - { - "name": "9.4", - "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/rhscl/postgresql-94-rhel7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -323,26 +212,16 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "registry.access.redhat.com/openshift3/mongodb-24-rhel7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "2.4" - } + "name": "latest" }, { "name": "2.4", "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/openshift3/mongodb-24-rhel7:latest" - } - }, - { - "name": "2.6", - "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/rhscl/mongodb-26-rhel7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] @@ -356,19 +235,16 @@ "creationTimestamp": null }, "spec": { + "dockerImageRepository": "registry.access.redhat.com/openshift3/jenkins-1-rhel7", "tags": [ { - "name": "latest", - "from": { - "Kind": "ImageStreamTag", - "Name": "1" - } + "name": "latest" }, { "name": "1", "from": { - "Kind": "DockerImage", - "Name": "registry.access.redhat.com/openshift3/jenkins-1-rhel7:latest" + "Kind": "ImageStreamTag", + "Name": "latest" } } ] diff --git a/roles/openshift_examples/files/examples/v1.0/infrastructure-templates/enterprise/metrics-deployer.yaml b/roles/openshift_examples/files/examples/v1.0/infrastructure-templates/enterprise/metrics-deployer.yaml index d823b2587..ddd9f2f75 100644 --- a/roles/openshift_examples/files/examples/v1.0/infrastructure-templates/enterprise/metrics-deployer.yaml +++ b/roles/openshift_examples/files/examples/v1.0/infrastructure-templates/enterprise/metrics-deployer.yaml @@ -81,11 +81,11 @@ parameters: - description: 'Specify prefix for metrics components; e.g. for "openshift/origin-metrics-deployer:v1.1", set prefix "openshift/origin-"' name: IMAGE_PREFIX - value: "hawkular/" + value: "registry.access.redhat.com/openshift3/" - description: 'Specify version for metrics components; e.g. for "openshift/origin-metrics-deployer:v1.1", set version "v1.1"' name: IMAGE_VERSION - value: "0.7.0-SNAPSHOT" + value: "3.1.0" - description: "Internal URL for the master, for authentication retrieval" name: MASTER_URL diff --git a/roles/openshift_examples/files/examples/v1.0/infrastructure-templates/origin/metrics-deployer.yaml b/roles/openshift_examples/files/examples/v1.0/infrastructure-templates/origin/metrics-deployer.yaml index d823b2587..3e9bcde5b 100644 --- a/roles/openshift_examples/files/examples/v1.0/infrastructure-templates/origin/metrics-deployer.yaml +++ b/roles/openshift_examples/files/examples/v1.0/infrastructure-templates/origin/metrics-deployer.yaml @@ -81,11 +81,11 @@ parameters: - description: 'Specify prefix for metrics components; e.g. for "openshift/origin-metrics-deployer:v1.1", set prefix "openshift/origin-"' name: IMAGE_PREFIX - value: "hawkular/" + value: "docker.io/openshift/origin-" - description: 'Specify version for metrics components; e.g. for "openshift/origin-metrics-deployer:v1.1", set version "v1.1"' name: IMAGE_VERSION - value: "0.7.0-SNAPSHOT" + value: "latest" - description: "Internal URL for the master, for authentication retrieval" name: MASTER_URL diff --git a/roles/openshift_examples/files/examples/v1.1/db-templates/README.md b/roles/openshift_examples/files/examples/v1.1/db-templates/README.md new file mode 100644 index 000000000..b39abf8b9 --- /dev/null +++ b/roles/openshift_examples/files/examples/v1.1/db-templates/README.md @@ -0,0 +1,100 @@ +OpenShift 3 Database Examples +============================= + +This directory contains example JSON templates to deploy databases in OpenShift. +They can be used to immediately instantiate a database and expose it as a +service in the current project, or to add a template that can be later used from +the Web Console or the CLI. + +The examples can also be tweaked to create new templates. + + +## Ephemeral x Persistent + +For each supported database, there are two template files. + +Files named `*-ephemeral-template.json` use +"[emptyDir](https://docs.openshift.org/latest/dev_guide/volumes.html)" volumes +for data storage, which means that data is lost after a pod restart. +This is tolerable for experimenting, but not suitable for production use. + +The other templates, named `*-persistent-template.json`, use [persistent volume +claims](https://docs.openshift.org/latest/architecture/additional_concepts/storage.html#persistent-volume-claims) +to request persistent storage provided by [persistent +volumes](https://docs.openshift.org/latest/architecture/additional_concepts/storage.html#persistent-volumes), +that must have been created upfront. + + +## Usage + +### Instantiating a new database service + +Use these instructions if you want to quickly deploy a new database service in +your current project. Instantiate a new database service with this command: + + $ oc new-app /path/to/template.json + +Replace `/path/to/template.json` with an appropriate path, that can be either a +local path or an URL. Example: + + $ oc new-app https://raw.githubusercontent.com/openshift/origin/master/examples/db-templates/mongodb-ephemeral-template.json + --> Deploying template mongodb-ephemeral for "https://raw.githubusercontent.com/openshift/origin/master/examples/db-templates/mongodb-ephemeral-template.json" + With parameters: + DATABASE_SERVICE_NAME=mongodb + MONGODB_USER=userJNX # generated + MONGODB_PASSWORD=tnEDilMVrgjp5AI2 # generated + MONGODB_DATABASE=sampledb + MONGODB_ADMIN_PASSWORD=8bYEs8OlNYhVyMBs # generated + --> Creating resources ... + Service "mongodb" created + DeploymentConfig "mongodb" created + --> Success + Run 'oc status' to view your app. + +The parameters listed in the output above can be tweaked by specifying values in +the command line with the `-p` option: + + $ oc new-app examples/db-templates/mongodb-ephemeral-template.json -p DATABASE_SERVICE_NAME=mydb -p MONGODB_USER=default + --> Deploying template mongodb-ephemeral for "examples/db-templates/mongodb-ephemeral-template.json" + With parameters: + DATABASE_SERVICE_NAME=mydb + MONGODB_USER=default + MONGODB_PASSWORD=RPvMbWlQFOevSowQ # generated + MONGODB_DATABASE=sampledb + MONGODB_ADMIN_PASSWORD=K7tIjDxDHHYCvFrJ # generated + --> Creating resources ... + Service "mydb" created + DeploymentConfig "mydb" created + --> Success + Run 'oc status' to view your app. + +Note that the persistent template requires an existing persistent volume, +otherwise the deployment won't ever succeed. + + +### Adding a database as a template + +Use these instructions if, instead of instantiating a service right away, you +want to load the template into an OpenShift project so that it can be used +later. Create the template with this command: + + $ oc create -f /path/to/template.json + +Replace `/path/to/template.json` with an appropriate path, that can be either a +local path or an URL. Example: + + $ oc create -f https://raw.githubusercontent.com/openshift/origin/master/examples/db-templates/mongodb-ephemeral-template.json + template "mongodb-ephemeral" created + +The new template is now available to use in the Web Console or with `oc +new-app`. + + +## More information + +The usage of each supported database image is further documented in the links +below: + +- [MySQL](https://docs.openshift.org/latest/using_images/db_images/mysql.html) +- [PostgreSQL](https://docs.openshift.org/latest/using_images/db_images/postgresql.html) +- [MongoDB](https://docs.openshift.org/latest/using_images/db_images/mongodb.html) diff --git a/roles/openshift_examples/files/examples/v1.1/db-templates/mongodb-ephemeral-template.json b/roles/openshift_examples/files/examples/v1.1/db-templates/mongodb-ephemeral-template.json index 6b90fa54e..11767862d 100644 --- a/roles/openshift_examples/files/examples/v1.1/db-templates/mongodb-ephemeral-template.json +++ b/roles/openshift_examples/files/examples/v1.1/db-templates/mongodb-ephemeral-template.json @@ -55,7 +55,7 @@ { "type": "ImageChange", "imageChangeParams": { - "automatic": true, + "automatic": false, "containerNames": [ "mongodb" ], diff --git a/roles/openshift_examples/files/examples/v1.1/db-templates/mysql-ephemeral-template.json b/roles/openshift_examples/files/examples/v1.1/db-templates/mysql-ephemeral-template.json index b384a5992..84911d2d6 100644 --- a/roles/openshift_examples/files/examples/v1.1/db-templates/mysql-ephemeral-template.json +++ b/roles/openshift_examples/files/examples/v1.1/db-templates/mysql-ephemeral-template.json @@ -55,7 +55,7 @@ { "type": "ImageChange", "imageChangeParams": { - "automatic": true, + "automatic": false, "containerNames": [ "mysql" ], diff --git a/roles/openshift_examples/files/examples/v1.1/db-templates/postgresql-ephemeral-template.json b/roles/openshift_examples/files/examples/v1.1/db-templates/postgresql-ephemeral-template.json index 60d6b8519..9ee9364a9 100644 --- a/roles/openshift_examples/files/examples/v1.1/db-templates/postgresql-ephemeral-template.json +++ b/roles/openshift_examples/files/examples/v1.1/db-templates/postgresql-ephemeral-template.json @@ -55,7 +55,7 @@ { "type": "ImageChange", "imageChangeParams": { - "automatic": true, + "automatic": false, "containerNames": [ "postgresql" ], diff --git a/roles/openshift_examples/files/examples/v1.1/image-streams/image-streams-centos7.json b/roles/openshift_examples/files/examples/v1.1/image-streams/image-streams-centos7.json index 1a78b1279..51805d729 100644 --- a/roles/openshift_examples/files/examples/v1.1/image-streams/image-streams-centos7.json +++ b/roles/openshift_examples/files/examples/v1.1/image-streams/image-streams-centos7.json @@ -16,7 +16,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "2.0" + "Name": "2.2" } }, { @@ -99,7 +99,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "5.16" + "Name": "5.20" } }, { @@ -149,7 +149,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "5.5" + "Name": "5.6" } }, { @@ -198,7 +198,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "3.3" + "Name": "3.4" } }, { @@ -296,7 +296,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "5.5" + "Name": "5.6" } }, { @@ -329,7 +329,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "9.2" + "Name": "9.4" } }, { @@ -362,7 +362,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "2.4" + "Name": "2.6" } }, { diff --git a/roles/openshift_examples/files/examples/v1.1/image-streams/image-streams-rhel7.json b/roles/openshift_examples/files/examples/v1.1/image-streams/image-streams-rhel7.json index d2a8cfb1d..3092ee486 100644 --- a/roles/openshift_examples/files/examples/v1.1/image-streams/image-streams-rhel7.json +++ b/roles/openshift_examples/files/examples/v1.1/image-streams/image-streams-rhel7.json @@ -16,7 +16,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "2.0" + "Name": "2.2" } }, { @@ -99,7 +99,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "5.16" + "Name": "5.20" } }, { @@ -149,7 +149,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "5.5" + "Name": "5.6" } }, { @@ -198,7 +198,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "3.3" + "Name": "3.4" } }, { @@ -262,7 +262,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "5.5" + "Name": "5.6" } }, { @@ -295,7 +295,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "9.2" + "Name": "9.4" } }, { @@ -328,7 +328,7 @@ "name": "latest", "from": { "Kind": "ImageStreamTag", - "Name": "2.4" + "Name": "2.6" } }, { diff --git a/roles/openshift_examples/files/examples/v1.1/infrastructure-templates/enterprise/metrics-deployer.yaml b/roles/openshift_examples/files/examples/v1.1/infrastructure-templates/enterprise/metrics-deployer.yaml index d823b2587..ddd9f2f75 100644 --- a/roles/openshift_examples/files/examples/v1.1/infrastructure-templates/enterprise/metrics-deployer.yaml +++ b/roles/openshift_examples/files/examples/v1.1/infrastructure-templates/enterprise/metrics-deployer.yaml @@ -81,11 +81,11 @@ parameters: - description: 'Specify prefix for metrics components; e.g. for "openshift/origin-metrics-deployer:v1.1", set prefix "openshift/origin-"' name: IMAGE_PREFIX - value: "hawkular/" + value: "registry.access.redhat.com/openshift3/" - description: 'Specify version for metrics components; e.g. for "openshift/origin-metrics-deployer:v1.1", set version "v1.1"' name: IMAGE_VERSION - value: "0.7.0-SNAPSHOT" + value: "3.1.0" - description: "Internal URL for the master, for authentication retrieval" name: MASTER_URL diff --git a/roles/openshift_examples/files/examples/v1.1/infrastructure-templates/origin/metrics-deployer.yaml b/roles/openshift_examples/files/examples/v1.1/infrastructure-templates/origin/metrics-deployer.yaml index d823b2587..3e9bcde5b 100644 --- a/roles/openshift_examples/files/examples/v1.1/infrastructure-templates/origin/metrics-deployer.yaml +++ b/roles/openshift_examples/files/examples/v1.1/infrastructure-templates/origin/metrics-deployer.yaml @@ -81,11 +81,11 @@ parameters: - description: 'Specify prefix for metrics components; e.g. for "openshift/origin-metrics-deployer:v1.1", set prefix "openshift/origin-"' name: IMAGE_PREFIX - value: "hawkular/" + value: "docker.io/openshift/origin-" - description: 'Specify version for metrics components; e.g. for "openshift/origin-metrics-deployer:v1.1", set version "v1.1"' name: IMAGE_VERSION - value: "0.7.0-SNAPSHOT" + value: "latest" - description: "Internal URL for the master, for authentication retrieval" name: MASTER_URL diff --git a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/cakephp-mysql.json b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/cakephp-mysql.json index da5679444..52143da2d 100644 --- a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/cakephp-mysql.json +++ b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/cakephp-mysql.json @@ -83,7 +83,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "openshift", - "name": "php:5.5" + "name": "php:5.6" } } }, @@ -98,6 +98,9 @@ "type": "ImageChange" }, { + "type": "ConfigChange" + }, + { "type": "GitHub", "github": { "secret": "${GITHUB_WEBHOOK_SECRET}" @@ -250,6 +253,20 @@ }, "triggers": [ { + "type": "ImageChange", + "imageChangeParams": { + "automatic": false, + "containerNames": [ + "mysql" + ], + "from": { + "kind": "ImageStreamTag", + "namespace": "openshift", + "name": "mysql:5.6" + } + } + }, + { "type": "ConfigChange" } ], @@ -268,7 +285,7 @@ "containers": [ { "name": "mysql", - "image": "${MYSQL_IMAGE}", + "image": "mysql", "ports": [ { "containerPort": 3306 @@ -347,11 +364,6 @@ "from": "[a-zA-Z0-9]{16}" }, { - "name": "MYSQL_IMAGE", - "description": "Image to use for mysql", - "value": "openshift/mysql-55-centos7" - }, - { "name": "CAKEPHP_SECRET_TOKEN", "description": "Set this to a long random string", "generate": "expression", diff --git a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/cakephp.json b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/cakephp.json index f426e1dd6..b77dc0c51 100644 --- a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/cakephp.json +++ b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/cakephp.json @@ -83,7 +83,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "openshift", - "name": "php:5.5" + "name": "php:5.6" } } }, @@ -98,6 +98,9 @@ "type": "ImageChange" }, { + "type": "ConfigChange" + }, + { "type": "GitHub", "github": { "secret": "${GITHUB_WEBHOOK_SECRET}" diff --git a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/dancer-mysql.json b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/dancer-mysql.json index 55f655102..edc6a1f3f 100644 --- a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/dancer-mysql.json +++ b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/dancer-mysql.json @@ -83,7 +83,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "openshift", - "name": "perl:5.16" + "name": "perl:5.20" } } }, @@ -98,6 +98,9 @@ "type": "ImageChange" }, { + "type": "ConfigChange" + }, + { "type": "GitHub", "github": { "secret": "${GITHUB_WEBHOOK_SECRET}" @@ -224,6 +227,20 @@ }, "triggers": [ { + "type": "ImageChange", + "imageChangeParams": { + "automatic": false, + "containerNames": [ + "mysql" + ], + "from": { + "kind": "ImageStreamTag", + "namespace": "openshift", + "name": "mysql:5.6" + } + } + }, + { "type": "ConfigChange" } ], @@ -242,7 +259,7 @@ "containers": [ { "name": "mysql", - "image": "${MYSQL_IMAGE}", + "image": "mysql", "ports": [ { "containerPort": 3306 @@ -329,11 +346,6 @@ "value": "sampledb" }, { - "name": "MYSQL_IMAGE", - "description": "Image to use for mysql", - "value": "openshift/mysql-55-centos7" - }, - { "name": "PERL_APACHE2_RELOAD", "description": "Set this to \"true\" to enable automatic reloading of modified Perl modules", "value": "" diff --git a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/dancer.json b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/dancer.json index 3ee19be83..409252d82 100644 --- a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/dancer.json +++ b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/dancer.json @@ -83,7 +83,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "openshift", - "name": "perl:5.16" + "name": "perl:5.20" } } }, @@ -98,6 +98,9 @@ "type": "ImageChange" }, { + "type": "ConfigChange" + }, + { "type": "GitHub", "github": { "secret": "${GITHUB_WEBHOOK_SECRET}" diff --git a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/django-postgresql.json b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/django-postgresql.json index 749064e98..c4c55ddd8 100644 --- a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/django-postgresql.json +++ b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/django-postgresql.json @@ -83,7 +83,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "openshift", - "name": "python:3.3" + "name": "python:3.4" } } }, @@ -98,6 +98,9 @@ "type": "ImageChange" }, { + "type": "ConfigChange" + }, + { "type": "GitHub", "github": { "secret": "${GITHUB_WEBHOOK_SECRET}" @@ -231,6 +234,20 @@ }, "triggers": [ { + "type": "ImageChange", + "imageChangeParams": { + "automatic": false, + "containerNames": [ + "postgresql" + ], + "from": { + "kind": "ImageStreamTag", + "namespace": "openshift", + "name": "postgresql:9.4" + } + } + }, + { "type": "ConfigChange" } ], @@ -249,7 +266,7 @@ "containers": [ { "name": "postgresql", - "image": "${POSTGRESQL_IMAGE}", + "image": "postgresql", "ports": [ { "containerPort": 5432 @@ -328,11 +345,6 @@ "from": "[a-zA-Z0-9]{16}" }, { - "name": "POSTGRESQL_IMAGE", - "description": "Image to use for postgresql", - "value": "openshift/postgresql-92-centos7" - }, - { "name": "APP_CONFIG", "description": "Relative path to Gunicorn configuration file (optional)" }, diff --git a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/django.json b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/django.json index 143a942ab..75b6798b5 100644 --- a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/django.json +++ b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/django.json @@ -83,7 +83,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "openshift", - "name": "python:3.3" + "name": "python:3.4" } } }, @@ -98,6 +98,9 @@ "type": "ImageChange" }, { + "type": "ConfigChange" + }, + { "type": "GitHub", "github": { "secret": "${GITHUB_WEBHOOK_SECRET}" diff --git a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/jenkins-ephemeral-template.json b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/jenkins-ephemeral-template.json index 14bd032af..0b016373f 100644 --- a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/jenkins-ephemeral-template.json +++ b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/jenkins-ephemeral-template.json @@ -7,7 +7,7 @@ "annotations": { "description": "Jenkins service, without persistent storage. WARNING: Any data stored will be lost upon pod destruction. Only use this template for testing", "iconClass": "icon-jenkins", - "tags": "database,jenkins" + "tags": "instant-app,jenkins" } }, "objects": [ @@ -70,6 +70,21 @@ }, "triggers": [ { + "type": "ImageChange", + "imageChangeParams": { + "automatic": false, + "containerNames": [ + "jenkins" + ], + "from": { + "kind": "ImageStreamTag", + "name": "jenkins:latest", + "namespace": "openshift" + }, + "lastTriggeredImage": "" + } + }, + { "type": "ConfigChange" } ], @@ -133,11 +148,6 @@ "value": "jenkins" }, { - "name": "JENKINS_IMAGE", - "description": "Jenkins Docker image to use", - "value": "openshift/jenkins-1-centos7" - }, - { "name": "JENKINS_PASSWORD", "description": "Password for the Jenkins user", "generate": "expression", diff --git a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/jenkins-persistent-template.json b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/jenkins-persistent-template.json index fa31de486..98f0cea95 100644 --- a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/jenkins-persistent-template.json +++ b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/jenkins-persistent-template.json @@ -7,7 +7,7 @@ "annotations": { "description": "Jenkins service, with persistent storage.", "iconClass": "icon-jenkins", - "tags": "database,jenkins" + "tags": "instant-app,jenkins" } }, "objects": [ @@ -87,6 +87,21 @@ }, "triggers": [ { + "type": "ImageChange", + "imageChangeParams": { + "automatic": true, + "containerNames": [ + "jenkins" + ], + "from": { + "kind": "ImageStreamTag", + "name": "jenkins:latest", + "namespace": "openshift" + }, + "lastTriggeredImage": "" + } + }, + { "type": "ConfigChange" } ], @@ -156,11 +171,6 @@ "value": "password" }, { - "name": "JENKINS_IMAGE", - "description": "Jenkins Docker image to use", - "value": "openshift/jenkins-1-centos7" - }, - { "name": "VOLUME_CAPACITY", "description": "Volume space available for data, e.g. 512Mi, 2Gi", "value": "512Mi", diff --git a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/nodejs-mongodb.json b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/nodejs-mongodb.json index 8760b074c..21f943da7 100644 --- a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/nodejs-mongodb.json +++ b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/nodejs-mongodb.json @@ -98,6 +98,9 @@ "type": "ImageChange" }, { + "type": "ConfigChange" + }, + { "type": "GitHub", "github": { "secret": "${GITHUB_WEBHOOK_SECRET}" @@ -229,6 +232,20 @@ }, "triggers": [ { + "type": "ImageChange", + "imageChangeParams": { + "automatic": false, + "containerNames": [ + "mongodb" + ], + "from": { + "kind": "ImageStreamTag", + "namespace": "openshift", + "name": "mongodb:2.6" + } + } + }, + { "type": "ConfigChange" } ], @@ -247,7 +264,7 @@ "containers": [ { "name": "mongodb", - "image": "${MONGODB_IMAGE}", + "image": "mongodb", "ports": [ { "containerPort": 27017 @@ -336,11 +353,6 @@ "description": "Password for the database admin user", "generate": "expression", "from": "[a-zA-Z0-9]{16}" - }, - { - "name": "MONGODB_IMAGE", - "description": "Image to use for mongodb", - "value": "openshift/mongodb-24-centos7" } ] } diff --git a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/nodejs.json b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/nodejs.json index e047266e3..1e301c076 100644 --- a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/nodejs.json +++ b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/nodejs.json @@ -98,6 +98,9 @@ "type": "ImageChange" }, { + "type": "ConfigChange" + }, + { "type": "GitHub", "github": { "secret": "${GITHUB_WEBHOOK_SECRET}" diff --git a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/rails-postgresql.json b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/rails-postgresql.json index b98282528..5dcbbc729 100644 --- a/roles/openshift_examples/files/examples/v1.1/quickstart-templates/rails-postgresql.json +++ b/roles/openshift_examples/files/examples/v1.1/quickstart-templates/rails-postgresql.json @@ -83,7 +83,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "openshift", - "name": "ruby:2.0" + "name": "ruby:2.2" } } }, @@ -98,6 +98,9 @@ "type": "ImageChange" }, { + "type": "ConfigChange" + }, + { "type": "GitHub", "github": { "secret": "${GITHUB_WEBHOOK_SECRET}" @@ -262,6 +265,20 @@ }, "triggers": [ { + "type": "ImageChange", + "imageChangeParams": { + "automatic": false, + "containerNames": [ + "postgresql" + ], + "from": { + "kind": "ImageStreamTag", + "namespace": "openshift", + "name": "postgresql:9.4" + } + } + }, + { "type": "ConfigChange" } ], @@ -280,7 +297,7 @@ "containers": [ { "name": "postgresql", - "image": "${POSTGRESQL_IMAGE}", + "image": "postgresql", "ports": [ { "containerPort": 5432 @@ -384,14 +401,9 @@ "value": "root" }, { - "name": "POSTGRESQL_IMAGE", - "description": "Image to use for postgresql", - "value": "openshift/postgresql-92-centos7" - }, - { "name": "POSTGRESQL_MAX_CONNECTIONS", "description": "database max connections", - "value": "10" + "value": "100" }, { "name": "POSTGRESQL_SHARED_BUFFERS", diff --git a/roles/openshift_expand_partition/README.md b/roles/openshift_expand_partition/README.md index cd394e1ba..aed4ec871 100644 --- a/roles/openshift_expand_partition/README.md +++ b/roles/openshift_expand_partition/README.md @@ -8,7 +8,7 @@ partition, and then expanding the file system on the partition. * A machine with a disk that is not fully utilized -* cloud-utils-growpart rpm (either installed or avialable via yum) +* cloud-utils-growpart rpm (either installed or avialable via yum or dnf) * The partition you are expanding needs to be at the end of the partition list diff --git a/roles/openshift_expand_partition/tasks/main.yml b/roles/openshift_expand_partition/tasks/main.yml index 8bc399070..84d859553 100644 --- a/roles/openshift_expand_partition/tasks/main.yml +++ b/roles/openshift_expand_partition/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Ensure growpart is installed - yum: pkg=cloud-utils-growpart state=present + action: "{{ ansible_pkg_mgr }} name=cloud-utils-growpart state=present" - name: Grow the partitions command: "growpart {{oep_drive}} {{oep_partition}}" diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 6006bfa9d..e557853b1 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -528,9 +528,9 @@ def set_aggregate_facts(facts): internal_hostnames.add(facts['common']['hostname']) internal_hostnames.add(facts['common']['ip']) + cluster_domain = facts['common']['dns_domain'] + if 'master' in facts: - # FIXME: not sure why but facts['dns']['domain'] fails - cluster_domain = 'cluster.local' if 'cluster_hostname' in facts['master']: all_hostnames.add(facts['master']['cluster_hostname']) if 'cluster_public_hostname' in facts['master']: @@ -623,7 +623,7 @@ def set_deployment_facts_if_unset(facts): service_type = 'atomic-openshift' if deployment_type == 'origin': service_type = 'origin' - elif deployment_type in ['enterprise', 'online']: + elif deployment_type in ['enterprise']: service_type = 'openshift' facts['common']['service_type'] = service_type if 'config_base' not in facts['common']: @@ -985,7 +985,7 @@ class OpenShiftFacts(object): Raises: OpenShiftFactsUnsupportedRoleError: """ - known_roles = ['common', 'master', 'node', 'master_sdn', 'node_sdn', 'dns', 'etcd'] + known_roles = ['common', 'master', 'node', 'master_sdn', 'node_sdn', 'etcd'] def __init__(self, role, filename, local_facts, additive_facts_to_overwrite=False): self.changed = False @@ -1053,9 +1053,11 @@ class OpenShiftFacts(object): common = dict(use_openshift_sdn=True, ip=ip_addr, public_ip=ip_addr, deployment_type='origin', hostname=hostname, - public_hostname=hostname) + public_hostname=hostname, use_manageiq=False) common['client_binary'] = 'oc' if os.path.isfile('/usr/bin/oc') else 'osc' common['admin_binary'] = 'oadm' if os.path.isfile('/usr/bin/oadm') else 'osadm' + common['dns_domain'] = 'cluster.local' + common['install_examples'] = True defaults['common'] = common if 'master' in roles: @@ -1074,9 +1076,8 @@ class OpenShiftFacts(object): if 'node' in roles: node = dict(labels={}, annotations={}, portal_net='172.30.0.0/16', - iptables_sync_period='5s') + iptables_sync_period='5s', set_node_ip=False) defaults['node'] = node - return defaults def guess_host_provider(self): diff --git a/roles/openshift_facts/tasks/main.yml b/roles/openshift_facts/tasks/main.yml index 913f0dc78..832f7ad84 100644 --- a/roles/openshift_facts/tasks/main.yml +++ b/roles/openshift_facts/tasks/main.yml @@ -7,9 +7,7 @@ - ansible_version | version_compare('1.9.0.1', 'ne') - name: Ensure PyYaml is installed - yum: pkg={{ item }} state=installed - with_items: - - PyYAML + action: "{{ ansible_pkg_mgr }} name=PyYAML state=present" - name: Gather Cluster facts openshift_facts: diff --git a/roles/openshift_manageiq/tasks/main.yaml b/roles/openshift_manageiq/tasks/main.yaml new file mode 100644 index 000000000..2d3187e21 --- /dev/null +++ b/roles/openshift_manageiq/tasks/main.yaml @@ -0,0 +1,50 @@ +--- +- name: Copy Configuration to temporary conf + command: > + cp {{ openshift.common.config_base }}/master/admin.kubeconfig {{manage_iq_tmp_conf}} + changed_when: false + +- name: Add Managment Infrastructure project + command: > + {{ openshift.common.admin_binary }} new-project + management-infra + --description="Management Infrastructure" + --config={{manage_iq_tmp_conf}} + register: osmiq_create_mi_project + failed_when: "'already exists' not in osmiq_create_mi_project.stderr and osmiq_create_mi_project.rc != 0" + changed_when: osmiq_create_mi_project.rc == 0 + +- name: Create Service Account + shell: > + echo {{ manageiq_service_account | to_json | quote }} | + {{ openshift.common.client_binary }} create + -n management-infra + --config={{manage_iq_tmp_conf}} + -f - + register: osmiq_create_service_account + failed_when: "'already exists' not in osmiq_create_service_account.stderr and osmiq_create_service_account.rc != 0" + changed_when: osmiq_create_service_account.rc == 0 + +- name: Create Cluster Role + shell: > + echo {{ manageiq_cluster_role | to_json | quote }} | + {{ openshift.common.client_binary }} create + --config={{manage_iq_tmp_conf}} + -f - + register: osmiq_create_cluster_role + failed_when: "'already exists' not in osmiq_create_cluster_role.stderr and osmiq_create_cluster_role.rc != 0" + changed_when: osmiq_create_cluster_role.rc == 0 + +- name: Configure role/user permissions + command: > + {{ openshift.common.admin_binary }} {{item}} + --config={{manage_iq_tmp_conf}} + with_items: "{{manage_iq_tasks}}" + register: osmiq_perm_task + failed_when: "'already exists' not in osmiq_perm_task.stderr and osmiq_perm_task.rc != 0" + changed_when: osmiq_perm_task.rc == 0 + +- name: Clean temporary configuration file + command: > + rm -f {{manage_iq_tmp_conf}} + changed_when: false diff --git a/roles/openshift_manageiq/vars/main.yml b/roles/openshift_manageiq/vars/main.yml new file mode 100644 index 000000000..77e1c304b --- /dev/null +++ b/roles/openshift_manageiq/vars/main.yml @@ -0,0 +1,24 @@ +manageiq_cluster_role: + apiVersion: v1 + kind: ClusterRole + metadata: + name: management-infra-admin + rules: + - resources: + - pods/proxy + verbs: + - '*' + +manageiq_service_account: + apiVersion: v1 + kind: ServiceAccount + metadata: + name: management-admin + +manage_iq_tmp_conf: /tmp/manageiq_admin.kubeconfig + +manage_iq_tasks: + - policy add-role-to-user -n management-infra admin -z management-admin + - policy add-role-to-user -n management-infra management-infra-admin -z management-admin + - policy add-cluster-role-to-user cluster-reader system:serviceaccount:management-infra:management-admin + - policy add-scc-to-user privileged system:serviceaccount:management-infra:management-admin diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index 185bfb8f3..bd3d8f90c 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -1,13 +1,16 @@ --- -# TODO: add validation for openshift_master_identity_providers # TODO: add ability to configure certificates given either a local file to # point to or certificate contents, set in default cert locations. -- assert: - that: - - openshift_master_oauth_grant_method in openshift_master_valid_grant_methods - when: openshift_master_oauth_grant_method is defined +# Authentication Variable Validation +# TODO: validate the different identity provider kinds as well +- fail: + msg: > + Invalid OAuth grant method: {{ openshift_master_oauth_grant_method }} + when: openshift_master_oauth_grant_method is defined and openshift_master_oauth_grant_method not in openshift_master_valid_grant_methods + +# HA Variable Validation - fail: msg: "openshift_master_cluster_method must be set to either 'native' or 'pacemaker' for multi-master installations" when: openshift_master_ha | bool and ((openshift_master_cluster_method is not defined) or (openshift_master_cluster_method is defined and openshift_master_cluster_method not in ["native", "pacemaker"])) @@ -75,17 +78,10 @@ controller_lease_ttl: "{{ osm_controller_lease_ttl | default(None) }}" - name: Install Master package - yum: pkg={{ openshift.common.service_type }}-master{{ openshift_version }} state=present - register: install_result + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-master{{ openshift_version }} state=present" -# TODO: These values need to be configurable -- name: Set dns facts +- name: Re-gather package dependent master facts openshift_facts: - role: dns - local_facts: - ip: "{{ openshift_master_cluster_vip | default(openshift.common.ip, true) | default(None) }}" - domain: cluster.local - when: openshift.master.embedded_dns - name: Create config parent directory if it does not exist file: @@ -114,8 +110,8 @@ - restart master controllers - name: Install httpd-tools if needed - yum: pkg=httpd-tools state=present - when: item.kind == 'HTPasswdPasswordIdentityProvider' + action: "{{ ansible_pkg_mgr }} name=httpd-tools state=present" + when: (item.kind == 'HTPasswdPasswordIdentityProvider') with_items: openshift.master.identity_providers - name: Ensure htpasswd directory exists @@ -172,6 +168,9 @@ - restart master - restart master api +- set_fact: + translated_identity_providers: "{{ openshift.master.identity_providers | translate_idps('v1') }}" + # TODO: add the validate parameter when there is a validation command to run - name: Create master config template: @@ -256,7 +255,7 @@ when: openshift_master_ha | bool and openshift.master.cluster_method == 'native' - name: Install cluster packages - yum: pkg=pcs state=present + action: "{{ ansible_pkg_mgr }} name=pcs state=present" when: openshift_master_ha | bool and openshift.master.cluster_method == 'pacemaker' register: install_result diff --git a/roles/openshift_master/templates/master.yaml.v1.j2 b/roles/openshift_master/templates/master.yaml.v1.j2 index 2a37c06d9..cadb02fa3 100644 --- a/roles/openshift_master/templates/master.yaml.v1.j2 +++ b/roles/openshift_master/templates/master.yaml.v1.j2 @@ -83,7 +83,7 @@ kubernetesMasterConfig: {% endif %} apiServerArguments: {{ api_server_args if api_server_args is defined else 'null' }} controllerArguments: {{ controller_args if controller_args is defined else 'null' }} - masterCount: {{ openshift.master.master_count }} + masterCount: {{ openshift.master.master_count if openshift.master.cluster_method | default(None) == 'native' else 1 }} masterIP: {{ openshift.common.ip }} podEvictionTimeout: "" proxyClientInfo: @@ -107,7 +107,24 @@ networkConfig: {% endif %} # serviceNetworkCIDR must match kubernetesMasterConfig.servicesSubnet serviceNetworkCIDR: {{ openshift.master.portal_net }} -{% include 'v1_partials/oauthConfig.j2' %} +oauthConfig: + assetPublicURL: {{ openshift.master.public_console_url }}/ + grantConfig: + method: {{ openshift.master.oauth_grant_method }} + identityProviders: +{% for line in translated_identity_providers.splitlines() %} + {{ line }} +{% endfor %} + masterCA: ca.crt + masterPublicURL: {{ openshift.master.public_api_url }} + masterURL: {{ openshift.master.api_url }} + sessionConfig: + sessionMaxAgeSeconds: {{ openshift.master.session_max_seconds }} + sessionName: {{ openshift.master.session_name }} + sessionSecretsFile: {{ openshift.master.session_secrets_file }} + tokenConfig: + accessTokenMaxAgeSeconds: {{ openshift.master.access_token_max_seconds }} + authorizeTokenMaxAgeSeconds: {{ openshift.master.auth_token_max_seconds }} pauseControllers: false policyConfig: bootstrapPolicyFile: {{ openshift_master_policy }} diff --git a/roles/openshift_master/templates/v1_partials/oauthConfig.j2 b/roles/openshift_master/templates/v1_partials/oauthConfig.j2 deleted file mode 100644 index 8a4f5a746..000000000 --- a/roles/openshift_master/templates/v1_partials/oauthConfig.j2 +++ /dev/null @@ -1,93 +0,0 @@ -{% macro identity_provider_config(identity_provider) %} - apiVersion: v1 - kind: {{ identity_provider.kind }} -{% if identity_provider.kind == 'HTPasswdPasswordIdentityProvider' %} - file: {{ identity_provider.filename }} -{% elif identity_provider.kind == 'BasicAuthPasswordIdentityProvider' %} - url: {{ identity_provider.url }} -{% for key in ('ca', 'certFile', 'keyFile') %} -{% if key in identity_provider %} - {{ key }}: "{{ identity_provider[key] }}" -{% endif %} -{% endfor %} -{% elif identity_provider.kind == 'LDAPPasswordIdentityProvider' %} - attributes: -{% for attribute_key in identity_provider.attributes %} - {{ attribute_key }}: -{% for attribute_value in identity_provider.attributes[attribute_key] %} - - {{ attribute_value }} -{% endfor %} -{% endfor %} -{% for key in ('bindDN', 'bindPassword', 'ca') %} - {{ key }}: "{{ identity_provider[key] }}" -{% endfor %} -{% for key in ('insecure', 'url') %} - {{ key }}: {{ identity_provider[key] }} -{% endfor %} -{% elif identity_provider.kind == 'RequestHeaderIdentityProvider' %} - headers: {{ identity_provider.headers }} -{% if 'clientCA' in identity_provider %} - clientCA: {{ identity_provider.clientCA }} -{% endif %} -{% elif identity_provider.kind == 'GitHubIdentityProvider' %} - clientID: {{ identity_provider.clientID }} - clientSecret: {{ identity_provider.clientSecret }} -{% elif identity_provider.kind == 'GoogleIdentityProvider' %} - clientID: {{ identity_provider.clientID }} - clientSecret: {{ identity_provider.clientSecret }} -{% if 'hostedDomain' in identity_provider %} - hostedDomain: {{ identity_provider.hostedDomain }} -{% endif %} -{% elif identity_provider.kind == 'OpenIDIdentityProvider' %} - clientID: {{ identity_provider.clientID }} - clientSecret: {{ identity_provider.clientSecret }} - claims: - id: identity_provider.claims.id -{% for claim_key in ('preferredUsername', 'name', 'email') %} -{% if claim_key in identity_provider.claims %} - {{ claim_key }}: {{ identity_provider.claims[claim_key] }} -{% endif %} -{% endfor %} - urls: - authorize: {{ identity_provider.urls.authorize }} - token: {{ identity_provider.urls.token }} -{% if 'userInfo' in identity_provider.urls %} - userInfo: {{ identity_provider.userInfo }} -{% endif %} -{% if 'extraScopes' in identity_provider %} - extraScopes: -{% for scope in identity_provider.extraScopes %} - - {{ scope }} -{% endfor %} -{% endif %} -{% if 'extraAuthorizeParameters' in identity_provider %} - extraAuthorizeParameters: -{% for param_key, param_value in identity_provider.extraAuthorizeParameters.iteritems() %} - {{ param_key }}: {{ param_value }} -{% endfor %} -{% endif %} -{% endif %} -{% endmacro %} -oauthConfig: - assetPublicURL: {{ openshift.master.public_console_url }}/ - grantConfig: - method: {{ openshift.master.oauth_grant_method }} - identityProviders: -{% for identity_provider in openshift.master.identity_providers %} - - name: {{ identity_provider.name }} - challenge: {{ identity_provider.challenge }} - login: {{ identity_provider.login }} - provider: -{{ identity_provider_config(identity_provider) }} -{%- endfor %} - masterCA: ca.crt - masterPublicURL: {{ openshift.master.public_api_url }} - masterURL: {{ openshift.master.api_url }} - sessionConfig: - sessionMaxAgeSeconds: {{ openshift.master.session_max_seconds }} - sessionName: {{ openshift.master.session_name }} - sessionSecretsFile: {{ openshift.master.session_secrets_file }} - tokenConfig: - accessTokenMaxAgeSeconds: {{ openshift.master.access_token_max_seconds }} - authorizeTokenMaxAgeSeconds: {{ openshift.master.auth_token_max_seconds }} -{# Comment to preserve newline after authorizeTokenMaxAgeSeconds #} diff --git a/roles/openshift_master_ca/tasks/main.yml b/roles/openshift_master_ca/tasks/main.yml index 314f068e7..0db95a4eb 100644 --- a/roles/openshift_master_ca/tasks/main.yml +++ b/roles/openshift_master_ca/tasks/main.yml @@ -1,7 +1,6 @@ --- - name: Install the base package for admin tooling - yum: pkg={{ openshift.common.service_type }}{{ openshift_version }} state=present - register: install_result + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version }} state=present" - name: Reload generated facts openshift_facts: diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index d11bc5123..eef7bec9a 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -1,12 +1,6 @@ --- # TODO: allow for overriding default ports where possible - fail: - msg: This role requres that osn_cluster_dns_domain is set - when: osn_cluster_dns_domain is not defined or not osn_cluster_dns_domain -- fail: - msg: This role requres that osn_cluster_dns_ip is set - when: osn_cluster_dns_ip is not defined or not osn_cluster_dns_ip -- fail: msg: "SELinux is disabled, This deployment type requires that SELinux is enabled." when: (not ansible_selinux or ansible_selinux.status != 'enabled') and deployment_type in ['enterprise', 'online', 'atomic-enterprise', 'openshift-enterprise'] @@ -20,6 +14,10 @@ hostname: "{{ openshift_hostname | default(none) }}" public_hostname: "{{ openshift_public_hostname | default(none) }}" deployment_type: "{{ openshift_deployment_type }}" + # TODO: Replace this with a lookup or filter plugin. + dns_ip: "{{ openshift_dns_ip + | default(openshift_master_cluster_vip + | default(None if openshift.common.version_greater_than_3_1_or_1_1 | bool else openshift_node_first_master_ip | default(None, true), true), true) }}" - role: node local_facts: annotations: "{{ openshift_node_annotations | default(none) }}" @@ -34,16 +32,15 @@ schedulable: "{{ openshift_schedulable | default(openshift_scheduleable) | default(None) }}" sdn_mtu: "{{ openshift_node_sdn_mtu | default(None) }}" storage_plugin_deps: "{{ osn_storage_plugin_deps | default(None) }}" + set_node_ip: "{{ openshift_set_node_ip | default(None) }}" # We have to add tuned-profiles in the same transaction otherwise we run into depsolving # problems because the rpms don't pin the version properly. - name: Install Node package - yum: pkg={{ openshift.common.service_type }}-node{{ openshift_version }},tuned-profiles-{{ openshift.common.service_type }}-node{{ openshift_version }} state=present - register: node_install_result + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-node{{ openshift_version }},tuned-profiles-{{ openshift.common.service_type }}-node{{ openshift_version }} state=present" - name: Install sdn-ovs package - yum: pkg={{ openshift.common.service_type }}-sdn-ovs{{ openshift_version }} state=present - register: sdn_install_result + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-sdn-ovs{{ openshift_version }} state=present" when: openshift.common.use_openshift_sdn # TODO: add the validate parameter when there is a validation command to run diff --git a/roles/openshift_node/tasks/storage_plugins/ceph.yml b/roles/openshift_node/tasks/storage_plugins/ceph.yml index b6936618a..10d0990a0 100644 --- a/roles/openshift_node/tasks/storage_plugins/ceph.yml +++ b/roles/openshift_node/tasks/storage_plugins/ceph.yml @@ -1,5 +1,3 @@ --- - name: Install Ceph storage plugin dependencies - yum: - pkg: ceph-common - state: installed + action: "{{ ansible_pkg_mgr }} name=ceph-common state=present"
\ No newline at end of file diff --git a/roles/openshift_node/tasks/storage_plugins/glusterfs.yml b/roles/openshift_node/tasks/storage_plugins/glusterfs.yml index 5cd4a6041..1080646ee 100644 --- a/roles/openshift_node/tasks/storage_plugins/glusterfs.yml +++ b/roles/openshift_node/tasks/storage_plugins/glusterfs.yml @@ -1,8 +1,6 @@ --- - name: Install GlusterFS storage plugin dependencies - yum: - pkg: glusterfs-fuse - state: installed + action: "{{ ansible_pkg_mgr }} name=glusterfs-fuse state=present" - name: Set sebooleans to allow gluster storage plugin access from containers seboolean: @@ -14,4 +12,4 @@ - 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" + 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/openshift_node/templates/node.yaml.v1.j2 b/roles/openshift_node/templates/node.yaml.v1.j2 index 7d2f506e3..23bd81f91 100644 --- a/roles/openshift_node/templates/node.yaml.v1.j2 +++ b/roles/openshift_node/templates/node.yaml.v1.j2 @@ -1,7 +1,9 @@ allowDisabledDocker: false apiVersion: v1 -dnsDomain: {{ osn_cluster_dns_domain }} -dnsIP: {{ osn_cluster_dns_ip }} +dnsDomain: {{ openshift.common.dns_domain }} +{% if 'dns_ip' in openshift.common %} +dnsIP: {{ openshift.common.dns_ip }} +{% endif %} dockerConfig: execHandlerName: "" iptablesSyncPeriod: "{{ openshift.node.iptables_sync_period }}" @@ -23,7 +25,9 @@ networkConfig: {% if openshift.common.use_openshift_sdn %} networkPluginName: {{ openshift.common.sdn_network_plugin_name }} {% endif %} +{% if openshift.node.set_node_ip | bool %} nodeIP: {{ openshift.common.ip }} +{% endif %} nodeName: {{ openshift.common.hostname | lower }} podManifestConfig: servingInfo: diff --git a/roles/openshift_repos/files/fedora-origin/repos/maxamillion-fedora-openshift-fedora.repo b/roles/openshift_repos/files/fedora-origin/repos/maxamillion-fedora-openshift-fedora.repo new file mode 100644 index 000000000..bc0435d82 --- /dev/null +++ b/roles/openshift_repos/files/fedora-origin/repos/maxamillion-fedora-openshift-fedora.repo @@ -0,0 +1,8 @@ +[maxamillion-fedora-openshift] +name=Copr repo for fedora-openshift owned by maxamillion +baseurl=https://copr-be.cloud.fedoraproject.org/results/maxamillion/fedora-openshift/fedora-$releasever-$basearch/ +skip_if_unavailable=True +gpgcheck=1 +gpgkey=https://copr-be.cloud.fedoraproject.org/results/maxamillion/fedora-openshift/pubkey.gpg +enabled=1 +enabled_metadata=1
\ No newline at end of file diff --git a/roles/openshift_repos/handlers/main.yml b/roles/openshift_repos/handlers/main.yml new file mode 100644 index 000000000..198fc7d6e --- /dev/null +++ b/roles/openshift_repos/handlers/main.yml @@ -0,0 +1,3 @@ +--- +- name: refresh cache + command: "{{ ansible_pkg_mgr }} clean all" diff --git a/roles/openshift_repos/tasks/main.yaml b/roles/openshift_repos/tasks/main.yaml index aa696ae12..9faf0dfd9 100644 --- a/roles/openshift_repos/tasks/main.yaml +++ b/roles/openshift_repos/tasks/main.yaml @@ -11,36 +11,58 @@ that: openshift.common.deployment_type in known_openshift_deployment_types - name: Ensure libselinux-python is installed - yum: - pkg: libselinux-python - state: present + action: "{{ ansible_pkg_mgr }} name=libselinux-python state=present" - name: Create any additional repos that are defined template: src: yum_repo.j2 dest: /etc/yum.repos.d/openshift_additional.repo when: openshift_additional_repos | length > 0 + notify: refresh cache - name: Remove the additional repos if no longer defined file: dest: /etc/yum.repos.d/openshift_additional.repo state: absent when: openshift_additional_repos | length == 0 + notify: refresh cache -- name: Remove any yum repo files for other deployment types +- name: Remove any yum repo files for other deployment types RHEL/CentOS file: path: "/etc/yum.repos.d/{{ item | basename }}" state: absent with_fileglob: - '*/repos/*' - when: not (item | search("/files/" ~ openshift_deployment_type ~ "/repos")) + when: not (item | search("/files/" ~ openshift_deployment_type ~ "/repos")) and + (ansible_os_family == "RedHat" and ansible_distribution != "Fedora") + notify: refresh cache + +- name: Remove any yum repo files for other deployment types Fedora + file: + path: "/etc/yum.repos.d/{{ item | basename }}" + state: absent + with_fileglob: + - '*/repos/*' + when: not (item | search("/files/fedora-" ~ openshift_deployment_type ~ "/repos")) and + (ansible_distribution == "Fedora") + notify: refresh cache - name: Configure gpg keys if needed copy: src={{ item }} dest=/etc/pki/rpm-gpg/ with_fileglob: - "{{ openshift_deployment_type }}/gpg_keys/*" + notify: refresh cache -- name: Configure yum repositories +- name: Configure yum repositories RHEL/CentOS copy: src={{ item }} dest=/etc/yum.repos.d/ with_fileglob: - "{{ openshift_deployment_type }}/repos/*" + notify: refresh cache + when: (ansible_os_family == "RedHat" and ansible_distribution != "Fedora") + +- name: Configure yum repositories Fedora + copy: src={{ item }} dest=/etc/yum.repos.d/ + with_fileglob: + - "fedora-{{ openshift_deployment_type }}/repos/*" + notify: refresh cache + when: (ansible_distribution == "Fedora") diff --git a/roles/openshift_serviceaccounts/tasks/main.yml b/roles/openshift_serviceaccounts/tasks/main.yml index d93a25a21..e558a83a2 100644 --- a/roles/openshift_serviceaccounts/tasks/main.yml +++ b/roles/openshift_serviceaccounts/tasks/main.yml @@ -13,7 +13,9 @@ changed_when: "'serviceaccounts \"{{ item }}\" already exists' not in _sa_result.stderr and _sa_result.rc == 0" - name: Get current security context constraints - shell: "{{ openshift.common.client_binary }} get scc privileged -o yaml > /tmp/scc.yaml" + shell: > + {{ openshift.common.client_binary }} get scc privileged -o yaml + --output-version=v1 > /tmp/scc.yaml - name: Add security context constraint for {{ item }} lineinfile: @@ -23,4 +25,4 @@ with_items: accounts - name: Apply new scc rules for service accounts - command: "{{ openshift.common.client_binary }} update -f /tmp/scc.yaml" + command: "{{ openshift.common.client_binary }} update -f /tmp/scc.yaml --api-version=v1" diff --git a/roles/openshift_storage_nfs_lvm/tasks/nfs.yml b/roles/openshift_storage_nfs_lvm/tasks/nfs.yml index 65ae069df..cf1ba6f25 100644 --- a/roles/openshift_storage_nfs_lvm/tasks/nfs.yml +++ b/roles/openshift_storage_nfs_lvm/tasks/nfs.yml @@ -1,7 +1,7 @@ --- - name: Install NFS server - yum: name=nfs-utils state=present - + action: "{{ ansible_pkg_mgr }} name=nfs-utils state=present" + - name: Start rpcbind service: name=rpcbind state=started enabled=yes diff --git a/roles/os_env_extras/tasks/main.yaml b/roles/os_env_extras/tasks/main.yaml index 96b12ad5b..cbf5c37f5 100644 --- a/roles/os_env_extras/tasks/main.yaml +++ b/roles/os_env_extras/tasks/main.yaml @@ -12,6 +12,4 @@ dest: /root/.vimrc - name: Bash Completion - yum: - pkg: bash-completion - state: installed + action: "{{ ansible_pkg_mgr }} name=bash-completion state=present"
\ No newline at end of file diff --git a/roles/os_firewall/tasks/firewall/firewalld.yml b/roles/os_firewall/tasks/firewall/firewalld.yml index 5089eb3e0..ba12c6b0c 100644 --- a/roles/os_firewall/tasks/firewall/firewalld.yml +++ b/roles/os_firewall/tasks/firewall/firewalld.yml @@ -1,8 +1,6 @@ --- - name: Install firewalld packages - yum: - name: firewalld - state: present + action: "{{ ansible_pkg_mgr }} name=firewalld state=present" register: install_result - name: Check if iptables-services is installed diff --git a/roles/os_firewall/tasks/firewall/iptables.yml b/roles/os_firewall/tasks/firewall/iptables.yml index 9af9d8d29..d3a5b1fa7 100644 --- a/roles/os_firewall/tasks/firewall/iptables.yml +++ b/roles/os_firewall/tasks/firewall/iptables.yml @@ -1,8 +1,6 @@ --- - name: Install iptables packages - yum: - name: "{{ item }}" - state: present + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: - iptables - iptables-services diff --git a/roles/os_update_latest/tasks/main.yml b/roles/os_update_latest/tasks/main.yml index 4a2c3d47a..2532059c0 100644 --- a/roles/os_update_latest/tasks/main.yml +++ b/roles/os_update_latest/tasks/main.yml @@ -1,3 +1,3 @@ --- - name: Update all packages - yum: name=* state=latest + action: "{{ ansible_pkg_mgr }} name=* state=latest"
\ No newline at end of file diff --git a/roles/os_zabbix/tasks/main.yml b/roles/os_zabbix/tasks/main.yml index 59c89bb02..d0b307a3d 100644 --- a/roles/os_zabbix/tasks/main.yml +++ b/roles/os_zabbix/tasks/main.yml @@ -8,15 +8,35 @@ register: templates - include_vars: template_heartbeat.yml + tags: + - heartbeat - include_vars: template_os_linux.yml + tags: + - linux - include_vars: template_docker.yml + tags: + - docker - include_vars: template_openshift_master.yml + tags: + - openshift_master - include_vars: template_openshift_node.yml + tags: + - openshift_node - include_vars: template_ops_tools.yml + tags: + - ops_tools - include_vars: template_app_zabbix_server.yml + tags: + - zabbix_server - include_vars: template_app_zabbix_agent.yml + tags: + - zabbix_agent - include_vars: template_performance_copilot.yml + tags: + - pcp - include_vars: template_aws.yml + tags: + - aws - name: Include Template Heartbeat include: ../../lib_zabbix/tasks/create_template.yml @@ -25,6 +45,8 @@ server: "{{ ozb_server }}" user: "{{ ozb_user }}" password: "{{ ozb_password }}" + tags: + - heartbeat - name: Include Template os_linux include: ../../lib_zabbix/tasks/create_template.yml @@ -33,6 +55,8 @@ server: "{{ ozb_server }}" user: "{{ ozb_user }}" password: "{{ ozb_password }}" + tags: + - linux - name: Include Template docker include: ../../lib_zabbix/tasks/create_template.yml @@ -41,6 +65,8 @@ server: "{{ ozb_server }}" user: "{{ ozb_user }}" password: "{{ ozb_password }}" + tags: + - docker - name: Include Template Openshift Master include: ../../lib_zabbix/tasks/create_template.yml @@ -49,6 +75,8 @@ server: "{{ ozb_server }}" user: "{{ ozb_user }}" password: "{{ ozb_password }}" + tags: + - openshift_master - name: Include Template Openshift Node include: ../../lib_zabbix/tasks/create_template.yml @@ -57,6 +85,8 @@ server: "{{ ozb_server }}" user: "{{ ozb_user }}" password: "{{ ozb_password }}" + tags: + - openshift_node - name: Include Template Ops Tools include: ../../lib_zabbix/tasks/create_template.yml @@ -65,6 +95,8 @@ server: "{{ ozb_server }}" user: "{{ ozb_user }}" password: "{{ ozb_password }}" + tags: + - ops_tools - name: Include Template App Zabbix Server include: ../../lib_zabbix/tasks/create_template.yml @@ -73,6 +105,8 @@ server: "{{ ozb_server }}" user: "{{ ozb_user }}" password: "{{ ozb_password }}" + tags: + - zabbix_server - name: Include Template App Zabbix Agent include: ../../lib_zabbix/tasks/create_template.yml @@ -81,6 +115,8 @@ server: "{{ ozb_server }}" user: "{{ ozb_user }}" password: "{{ ozb_password }}" + tags: + - zabbix_agent - name: Include Template Performance Copilot include: ../../lib_zabbix/tasks/create_template.yml @@ -89,6 +125,8 @@ server: "{{ ozb_server }}" user: "{{ ozb_user }}" password: "{{ ozb_password }}" + tags: + - pcp - name: Include Template AWS include: ../../lib_zabbix/tasks/create_template.yml @@ -97,3 +135,5 @@ server: "{{ ozb_server }}" user: "{{ ozb_user }}" password: "{{ ozb_password }}" + tags: + - aws diff --git a/roles/os_zabbix/vars/template_openshift_master.yml b/roles/os_zabbix/vars/template_openshift_master.yml index 512adad4c..514d6fd24 100644 --- a/roles/os_zabbix/vars/template_openshift_master.yml +++ b/roles/os_zabbix/vars/template_openshift_master.yml @@ -7,6 +7,12 @@ g_template_openshift_master: - Openshift Master key: create_app + - key: openshift.master.registry.healthz + description: "Shows the health status of the cluster's docker registry" + type: int + applications: + - Openshift Master + - key: openshift.master.process.count description: Shows number of master processes running type: int @@ -62,6 +68,36 @@ g_template_openshift_master: applications: - Openshift Master + - key: openshift.master.pv.total.count + description: Total number of Persistent Volumes in the Openshift Cluster + type: int + applications: + - Openshift Master + + - key: openshift.master.pv.available.count + description: Total number of Available Persistent Volumes in the Openshift Cluster + type: int + applications: + - Openshift Master + + - key: openshift.master.pv.released.count + description: Total number of Released Persistent Volumes in the Openshift Cluster + type: int + applications: + - Openshift Master + + - key: openshift.master.pv.bound.count + description: Total number of Bound Persistent Volumes in the Openshift Cluster + type: int + applications: + - Openshift Master + + - key: openshift.master.pv.failed.count + description: Total number of Failed Persistent Volumes in the Openshift Cluster + type: int + applications: + - Openshift Master + - key: openshift.master.etcd.create.success description: Show number of successful create actions type: int @@ -195,26 +231,6 @@ g_template_openshift_master: - Openshift Master Metrics ztriggers: - - name: 'Application creation has failed on {HOST.NAME}' - expression: '{Template Openshift Master:create_app.last(#1)}=1 and {Template Openshift Master:create_app.last(#2)}=1' - 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 API PING check is failing on {HOST.NAME}' - expression: '{Template Openshift Master:openshift.master.api.ping.max(#3)}<1' - url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' - priority: high - - - name: 'Openshift Master metric PING check is failing on {HOST.NAME}' - expression: '{Template Openshift Master:openshift.master.metric.ping.max(#3)}<1' - url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' - priority: avg - - 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' @@ -225,6 +241,16 @@ g_template_openshift_master: url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' priority: high + - name: 'Low number of etcd watchers on {HOST.NAME}' + expression: '{Template Openshift Master:openshift.master.etcd.watchers.last(#1)}<10 and {Template Openshift Master:openshift.master.etcd.watchers.last(#2)}<10' + url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_etcd.asciidoc' + priority: avg + + - name: 'Etcd ping failed on {HOST.NAME}' + expression: '{Template Openshift Master:openshift.master.etcd.ping.last(#1)}=0 and {Template Openshift Master:openshift.master.etcd.ping.last(#2)}=0' + url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_etcd.asciidoc' + priority: high + - name: 'Number of users for Openshift Master on {HOST.NAME}' expression: '{Template Openshift Master:openshift.master.user.count.last()}=0' url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' @@ -235,12 +261,72 @@ g_template_openshift_master: url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' priority: info - - name: 'Low number of etcd watchers on {HOST.NAME}' - expression: '{Template Openshift Master:openshift.master.etcd.watchers.last(#1)}<10 and {Template Openshift Master:openshift.master.etcd.watchers.last(#2)}<10' - url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_etcd.asciidoc' + # Put triggers that depend on other triggers here (deps must be created first) + - name: 'Application creation has failed on {HOST.NAME}' + expression: '{Template Openshift Master:create_app.last(#1)}=1 and {Template Openshift Master:create_app.last(#2)}=1' + url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_create_app.asciidoc' + dependencies: + - 'Openshift Master process not running on {HOST.NAME}' priority: avg - - name: 'Etcd ping failed on {HOST.NAME}' - expression: '{Template Openshift Master:openshift.master.etcd.ping.last(#1)}=0 and {Template Openshift Master:openshift.master.etcd.ping.last(#2)}=0' - url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_etcd.asciidoc' + - 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' + dependencies: + - 'Openshift Master process not running on {HOST.NAME}' + priority: high + + - name: 'Openshift Master API PING check is failing on {HOST.NAME}' + expression: '{Template Openshift Master:openshift.master.api.ping.max(#3)}<1' + url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' + dependencies: + - 'Openshift Master process not running on {HOST.NAME}' + priority: high + + - name: 'Openshift Master metric PING check is failing on {HOST.NAME}' + expression: '{Template Openshift Master:openshift.master.metric.ping.max(#3)}<1' + url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' + dependencies: + - 'Openshift Master process not running on {HOST.NAME}' + priority: avg + + - name: 'Docker Registry check failed on {HOST.NAME}' + expression: '{Template Openshift Master:openshift.master.registry.healthz.max(#2)}<1' + url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' + dependencies: + - 'Openshift Master process not running on {HOST.NAME}' priority: high + + zgraphs: + - name: Openshift Master API Server Latency Pods LIST Quantiles + width: 900 + height: 200 + graph_items: + - item_name: openshift.master.apiserver.latency.summary.pods.quantile.list.5 + color: red + - item_name: openshift.master.apiserver.latency.summary.pods.quantile.list.9 + color: blue + - item_name: openshift.master.apiserver.latency.summary.pods.quantile.list.99 + color: orange + + - name: Openshift Master API Server Latency Pods WATCHLIST Quantiles + width: 900 + height: 200 + graph_items: + - item_name: openshift.master.apiserver.latency.summary.pods.quantile.watchlist.5 + color: red + - item_name: openshift.master.apiserver.latency.summary.pods.quantile.watchlist.9 + color: blue + - item_name: openshift.master.apiserver.latency.summary.pods.quantile.watchlist.99 + color: orange + + - name: Openshift Master Scheduler End to End Latency Quantiles + width: 900 + height: 200 + graph_items: + - item_name: openshift.master.scheduler.e2e.scheduling.latency.quantile.5 + color: red + - item_name: openshift.master.scheduler.e2e.scheduling.latency.quantile.9 + color: blue + - item_name: openshift.master.scheduler.e2e.scheduling.latency.quantile.99 + color: orange diff --git a/roles/os_zabbix/vars/template_os_linux.yml b/roles/os_zabbix/vars/template_os_linux.yml index 04665be62..c6e557f12 100644 --- a/roles/os_zabbix/vars/template_os_linux.yml +++ b/roles/os_zabbix/vars/template_os_linux.yml @@ -258,26 +258,34 @@ g_template_os_linux: - Network ztriggerprototypes: - - name: 'Filesystem: {#OSO_FILESYS} has less than 15% free disk space on {HOST.NAME}' - expression: '{Template OS Linux:disc.filesys.full[{#OSO_FILESYS}].last()}>85' - url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_filesys_full.asciidoc' - priority: warn - - name: 'Filesystem: {#OSO_FILESYS} has less than 10% free disk space on {HOST.NAME}' expression: '{Template OS Linux:disc.filesys.full[{#OSO_FILESYS}].last()}>90' url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_filesys_full.asciidoc' priority: high - - name: 'Filesystem: {#OSO_FILESYS} has less than 10% free inodes on {HOST.NAME}' - expression: '{Template OS Linux:disc.filesys.inodes.pused[{#OSO_FILESYS}].last()}>90' + # This has a dependency on the previous trigger + # Trigger Prototypes do not work in 2.4. They will work in Zabbix 3.0 + - name: 'Filesystem: {#OSO_FILESYS} has less than 15% free disk space on {HOST.NAME}' + expression: '{Template OS Linux:disc.filesys.full[{#OSO_FILESYS}].last()}>85' url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_filesys_full.asciidoc' priority: warn + dependencies: + - 'Filesystem: {#OSO_FILESYS} has less than 10% free disk space on {HOST.NAME}' - name: 'Filesystem: {#OSO_FILESYS} has less than 5% free inodes on {HOST.NAME}' expression: '{Template OS Linux:disc.filesys.inodes.pused[{#OSO_FILESYS}].last()}>95' url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_filesys_full.asciidoc' priority: high + # This has a dependency on the previous trigger + # Trigger Prototypes do not work in 2.4. They will work in Zabbix 3.0 + - name: 'Filesystem: {#OSO_FILESYS} has less than 10% free inodes on {HOST.NAME}' + expression: '{Template OS Linux:disc.filesys.inodes.pused[{#OSO_FILESYS}].last()}>90' + url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_filesys_full.asciidoc' + priority: warn + dependencies: + - 'Filesystem: {#OSO_FILESYS} has less than 5% free inodes on {HOST.NAME}' + ztriggers: - name: 'Too many TOTAL processes on {HOST.NAME}' expression: '{Template OS Linux:proc.nprocs.last()}>5000' diff --git a/roles/tito/tasks/main.yml b/roles/tito/tasks/main.yml index f7b4ef363..3cf9e2bfd 100644 --- a/roles/tito/tasks/main.yml +++ b/roles/tito/tasks/main.yml @@ -1,4 +1,2 @@ --- -- yum: - name: tito - state: present +- action: "{{ ansible_pkg_mgr }} name=tito state=present" diff --git a/roles/yum_repos/README.md b/roles/yum_repos/README.md index 51ecd5d34..908ab4972 100644 --- a/roles/yum_repos/README.md +++ b/roles/yum_repos/README.md @@ -6,7 +6,7 @@ This role allows easy deployment of yum repository config files. Requirements ------------ -Yum +Yum or dnf Role Variables -------------- |