diff options
Diffstat (limited to 'roles')
56 files changed, 525 insertions, 1217 deletions
diff --git a/roles/ansible/tasks/main.yml b/roles/ansible/tasks/main.yml index f79273824..2a6ac7713 100644 --- a/roles/ansible/tasks/main.yml +++ b/roles/ansible/tasks/main.yml @@ -2,16 +2,7 @@ # Install ansible client - name: Install Ansible - yum: - pkg: ansible - state: installed - when: ansible_pkg_mgr == "yum" - -- name: Install Ansible - dnf: - pkg: ansible - state: installed - when: ansible_pkg_mgr == "dnf" + 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 8410e7c90..b90e7dfd6 100644 --- a/roles/cockpit/tasks/main.yml +++ b/roles/cockpit/tasks/main.yml @@ -1,25 +1,11 @@ --- - name: Install cockpit-ws - yum: - name: "{{ item }}" - state: present + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: - cockpit-ws - cockpit-shell - cockpit-bridge - "{{ cockpit_plugins }}" - when: ansible_pkg_mgr == "yum" - -- name: Install cockpit-ws - dnf: - name: "{{ item }}" - state: present - with_items: - - cockpit-ws - - cockpit-shell - - cockpit-bridge - - "{{ cockpit_plugins }}" - when: ansible_pkg_mgr == "dnf" - name: Enable cockpit-ws service: diff --git a/roles/copr_cli/tasks/main.yml b/roles/copr_cli/tasks/main.yml index f8496199d..4bfd551d3 100644 --- a/roles/copr_cli/tasks/main.yml +++ b/roles/copr_cli/tasks/main.yml @@ -1,10 +1,2 @@ --- -- yum: - name: copr-cli - state: present - when: ansible_pkg_mgr == "yum" - -- dnf: - name: copr-cli - state: present - when: ansible_pkg_mgr == "dnf" +- action: "{{ ansible_pkg_mgr }} name=copr-cli state=present" diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 857674454..e94ebe3e1 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -1,13 +1,8 @@ --- # tasks file for docker - name: Install docker - yum: pkg=docker - when: ansible_pkg_mgr == "yum" - -- name: Install docker - dnf: pkg=docker - when: ansible_pkg_mgr == "dnf" - + action: "{{ ansible_pkg_mgr }} name=docker state=present" + - name: enable and start the docker service service: name=docker enabled=yes state=started diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml index efaab5f31..61892fe06 100644 --- a/roles/etcd/tasks/main.yml +++ b/roles/etcd/tasks/main.yml @@ -8,12 +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 - when: ansible_pkg_mgr == "yum" - -- name: Install etcd - dnf: pkg=etcd* state=present - when: ansible_pkg_mgr == "dnf" + action: "{{ ansible_pkg_mgr }} name=etcd-2.* state=present" - name: Validate permissions on the config dir file: diff --git a/roles/flannel/tasks/main.yml b/roles/flannel/tasks/main.yml index 86e1bc96e..1e86176ea 100644 --- a/roles/flannel/tasks/main.yml +++ b/roles/flannel/tasks/main.yml @@ -1,13 +1,7 @@ --- - name: Install flannel sudo: true - yum: pkg=flannel state=present - when: ansible_pkg_mgr == "yum" - -- name: Install flannel - sudo: true - dnf: pkg=flannel state=present - when: ansible_pkg_mgr == "dnf" + 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 43c499b4d..65c67fe8d 100644 --- a/roles/fluentd_master/tasks/main.yml +++ b/roles/fluentd_master/tasks/main.yml @@ -1,16 +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 - when: ansible_pkg_mgr == "yum" - -- name: download and install td-agent - dnf: - name: 'http://packages.treasuredata.com/2/redhat/7/x86_64/td-agent-2.2.0-0.x86_64.rpm' - state: present - when: ansible_pkg_mgr == "dnf" + 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 827a1c075..85488b55e 100644 --- a/roles/fluentd_node/tasks/main.yml +++ b/roles/fluentd_node/tasks/main.yml @@ -1,16 +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 - when: ansible_pkg_mgr == "yum" - -- name: download and install td-agent - dnf: - name: 'http://packages.treasuredata.com/2/redhat/7/x86_64/td-agent-2.2.0-0.x86_64.rpm' - state: present - when: ansible_pkg_mgr == "dnf" + 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 5d015fadd..106ab8489 100644 --- a/roles/haproxy/tasks/main.yml +++ b/roles/haproxy/tasks/main.yml @@ -1,15 +1,6 @@ --- - name: Install haproxy - yum: - pkg: haproxy - state: present - when: ansible_pkg_mgr == "yum" - -- name: Install haproxy - dnf: - pkg: haproxy - state: present - when: ansible_pkg_mgr == "dnf" + 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 3fcb9fd18..2cc35844c 100644 --- a/roles/kube_nfs_volumes/tasks/main.yml +++ b/roles/kube_nfs_volumes/tasks/main.yml @@ -1,11 +1,6 @@ --- - name: Install pyparted (RedHat/Fedora) - yum: name=pyparted,python-httplib2 state=present - when: ansible_pkg_mgr == "yum" - -- name: Install pyparted (RedHat/Fedora) - dnf: name=pyparted,python-httplib2 state=present - when: ansible_pkg_mgr == "dnf" + 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 a58a7b824..eaec28544 100644 --- a/roles/kube_nfs_volumes/tasks/nfs.yml +++ b/roles/kube_nfs_volumes/tasks/nfs.yml @@ -1,11 +1,6 @@ --- -- name: Install NFS server on Fedora/Red Hat - yum: name=nfs-utils state=present - when: ansible_pkg_mgr == "yum" - -- name: Install NFS server on Fedora/Red Hat - dnf: name=nfs-utils state=present - when: ansible_pkg_mgr == "dnf" +- 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 24693e5db..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 @@ -116,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 @@ -288,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, @@ -301,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']) @@ -315,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 @@ -457,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/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 2b99f8bcd..4a0968686 100644 --- a/roles/openshift_ansible_inventory/tasks/main.yml +++ b/roles/openshift_ansible_inventory/tasks/main.yml @@ -1,17 +1,5 @@ --- -- yum: - name: "{{ item }}" - state: present - when: ansible_pkg_mgr == "yum" - with_items: - - openshift-ansible-inventory - - openshift-ansible-inventory-aws - - openshift-ansible-inventory-gce - -- dnf: - name: "{{ item }}" - state: present - when: ansible_pkg_mgr == "dnf" +- action: "{{ ansible_pkg_mgr }} name={{ item}} state=present" with_items: - openshift-ansible-inventory - openshift-ansible-inventory-aws diff --git a/roles/openshift_common/tasks/main.yml b/roles/openshift_common/tasks/main.yml index c0982290d..c34f42838 100644 --- a/roles/openshift_common/tasks/main.yml +++ b/roles/openshift_common/tasks/main.yml @@ -14,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) }}" @@ -24,6 +25,12 @@ 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: 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.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/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/tasks/main.yml b/roles/openshift_expand_partition/tasks/main.yml index 42e7903fd..84d859553 100644 --- a/roles/openshift_expand_partition/tasks/main.yml +++ b/roles/openshift_expand_partition/tasks/main.yml @@ -1,11 +1,6 @@ --- - name: Ensure growpart is installed - yum: pkg=cloud-utils-growpart state=present - when: ansible_pkg_mgr == "yum" - -- name: Ensure growpart is installed - dnf: pkg=cloud-utils-growpart state=present - when: ansible_pkg_mgr == "dnf" + 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 8b3402729..e557853b1 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1057,6 +1057,7 @@ class OpenShiftFacts(object): 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: diff --git a/roles/openshift_facts/tasks/main.yml b/roles/openshift_facts/tasks/main.yml index 2e889d7d5..832f7ad84 100644 --- a/roles/openshift_facts/tasks/main.yml +++ b/roles/openshift_facts/tasks/main.yml @@ -7,16 +7,7 @@ - ansible_version | version_compare('1.9.0.1', 'ne') - name: Ensure PyYaml is installed - yum: pkg={{ item }} state=installed - when: ansible_pkg_mgr == "yum" - with_items: - - PyYAML - -- name: Ensure PyYaml is installed - dnf: pkg={{ item }} state=installed - when: ansible_pkg_mgr == "dnf" - with_items: - - PyYAML + action: "{{ ansible_pkg_mgr }} name=PyYAML state=present" - name: Gather Cluster facts openshift_facts: diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index 8a78f8f2a..8995863ec 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -78,14 +78,7 @@ controller_lease_ttl: "{{ osm_controller_lease_ttl | default(None) }}" - name: Install Master package - yum: pkg={{ openshift.common.service_type }}-master{{ openshift_version }} state=present - when: ansible_pkg_mgr == "yum" - register: install_result - -- name: Install Master package - dnf: pkg={{ openshift.common.service_type }}-master{{ openshift_version }} state=present - when: ansible_pkg_mgr == "dnf" - register: install_result + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-master{{ openshift_version }} state=present" - name: Re-gather package dependent master facts openshift_facts: @@ -117,13 +110,8 @@ - restart master controllers - name: Install httpd-tools if needed - yum: pkg=httpd-tools state=present - when: (ansible_pkg_mgr == "yum") and (item.kind == 'HTPasswdPasswordIdentityProvider') - with_items: openshift.master.identity_providers - -- name: Install httpd-tools if needed - dnf: pkg=httpd-tools state=present - when: (ansible_pkg_mgr == "dnf") and (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 @@ -147,13 +135,11 @@ template: src: atomic-openshift-master-api.service.j2 dest: /usr/lib/systemd/system/{{ openshift.common.service_type }}-master-api.service - force: no when: openshift_master_ha | bool and openshift_master_cluster_method == "native" - name: Create the controllers service file template: src: atomic-openshift-master-controllers.service.j2 dest: /usr/lib/systemd/system/{{ openshift.common.service_type }}-master-controllers.service - force: no when: openshift_master_ha | bool and openshift_master_cluster_method == "native" - name: Create the api env file template: @@ -254,26 +240,18 @@ master_api_service_status_changed = start_result | changed when: openshift_master_ha | bool and openshift.master.cluster_method == 'native' -# TODO: fix the ugly workaround of setting ignore_errors -# the controllers service tries to start even if it is already started - name: Start and enable master controller service: name={{ openshift.common.service_type }}-master-controllers enabled=yes state=started when: openshift_master_ha | bool and openshift.master.cluster_method == 'native' register: start_result - ignore_errors: yes - set_fact: master_controllers_service_status_changed = start_result | changed when: openshift_master_ha | bool and openshift.master.cluster_method == 'native' - name: Install cluster packages - yum: pkg=pcs state=present - when: (ansible_pkg_mgr == "yum") and openshift_master_ha | bool and openshift.master.cluster_method == 'pacemaker' - register: install_result - -- name: Install cluster packages - dnf: pkg=pcs state=present - when: (ansible_pkg_mgr == "dnf") and openshift_master_ha | bool and openshift.master.cluster_method == 'pacemaker' + action: "{{ ansible_pkg_mgr }} name=pcs state=present" + when: openshift_master_ha | bool and openshift.master.cluster_method == 'pacemaker' register: install_result - name: Start and enable cluster service diff --git a/roles/openshift_master/templates/atomic-openshift-master-controllers.service.j2 b/roles/openshift_master/templates/atomic-openshift-master-controllers.service.j2 index 8952c86ef..ef0b57ef4 100644 --- a/roles/openshift_master/templates/atomic-openshift-master-controllers.service.j2 +++ b/roles/openshift_master/templates/atomic-openshift-master-controllers.service.j2 @@ -7,7 +7,7 @@ Before={{ openshift.common.service_type }}-node.service Requires=network.target [Service] -Type=notify +Type=simple EnvironmentFile=/etc/sysconfig/{{ openshift.common.service_type }}-master-controllers Environment=GOTRACEBACK=crash ExecStart=/usr/bin/openshift start master controllers --config=${CONFIG_FILE} $OPTIONS diff --git a/roles/openshift_master_ca/tasks/main.yml b/roles/openshift_master_ca/tasks/main.yml index caac13be3..0db95a4eb 100644 --- a/roles/openshift_master_ca/tasks/main.yml +++ b/roles/openshift_master_ca/tasks/main.yml @@ -1,13 +1,6 @@ --- - name: Install the base package for admin tooling - yum: pkg={{ openshift.common.service_type }}{{ openshift_version }} state=present - when: ansible_pkg_mgr == "yum" - register: install_result - -- name: Install the base package for admin tooling - dnf: pkg={{ openshift.common.service_type }}{{ openshift_version }} state=present - when: ansible_pkg_mgr == "dnf" - 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 29e7eb532..eef7bec9a 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -14,7 +14,10 @@ hostname: "{{ openshift_hostname | default(none) }}" public_hostname: "{{ openshift_public_hostname | default(none) }}" deployment_type: "{{ openshift_deployment_type }}" - dns_ip: "{{ openshift_dns_ip | default(openshift_master_cluster_vip | default(None, true), true) }}" + # 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,24 +37,11 @@ # 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 - when: ansible_pkg_mgr == "yum" - register: node_install_result - -- name: Install Node package - dnf: pkg={{ openshift.common.service_type }}-node{{ openshift_version }},tuned-profiles-{{ openshift.common.service_type }}-node{{ openshift_version }} state=present - when: ansible_pkg_mgr == "dnf" - register: node_install_result - -- name: Install sdn-ovs package - yum: pkg={{ openshift.common.service_type }}-sdn-ovs{{ openshift_version }} state=present - register: sdn_install_result - when: ansible_pkg_mgr == "yum" and openshift.common.use_openshift_sdn + 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 - dnf: pkg={{ openshift.common.service_type }}-sdn-ovs{{ openshift_version }} state=present - register: sdn_install_result - when: ansible_pkg_mgr == "dnf" and openshift.common.use_openshift_sdn + 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 - name: Create the Node config diff --git a/roles/openshift_node/tasks/storage_plugins/ceph.yml b/roles/openshift_node/tasks/storage_plugins/ceph.yml index b5146dcac..10d0990a0 100644 --- a/roles/openshift_node/tasks/storage_plugins/ceph.yml +++ b/roles/openshift_node/tasks/storage_plugins/ceph.yml @@ -1,12 +1,3 @@ --- - name: Install Ceph storage plugin dependencies - yum: - pkg: ceph-common - state: installed - when: ansible_pkg_mgr == "yum" - -- name: Install Ceph storage plugin dependencies - dnf: - pkg: ceph-common - state: installed - when: ansible_pkg_mgr == "dnf" + 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 a357023e1..1080646ee 100644 --- a/roles/openshift_node/tasks/storage_plugins/glusterfs.yml +++ b/roles/openshift_node/tasks/storage_plugins/glusterfs.yml @@ -1,15 +1,6 @@ --- - name: Install GlusterFS storage plugin dependencies - yum: - pkg: glusterfs-fuse - state: installed - when: ansible_pkg_mgr == "yum" - -- name: Install GlusterFS storage plugin dependencies - dnf: - pkg: glusterfs-fuse - state: installed - when: ansible_pkg_mgr == "dnf" + action: "{{ ansible_pkg_mgr }} name=glusterfs-fuse state=present" - name: Set sebooleans to allow gluster storage plugin access from containers seboolean: diff --git a/roles/openshift_repos/handlers/main.yml b/roles/openshift_repos/handlers/main.yml index fed4ab2f0..198fc7d6e 100644 --- a/roles/openshift_repos/handlers/main.yml +++ b/roles/openshift_repos/handlers/main.yml @@ -1,6 +1,3 @@ --- -- name: refresh yum cache - command: yum clean all - -- name: refresh dnf cache - command: dnf clean all +- 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 c55b5df89..9faf0dfd9 100644 --- a/roles/openshift_repos/tasks/main.yaml +++ b/roles/openshift_repos/tasks/main.yaml @@ -11,30 +11,21 @@ that: openshift.common.deployment_type in known_openshift_deployment_types - name: Ensure libselinux-python is installed - yum: - pkg: libselinux-python - state: present - when: ansible_pkg_mgr == "yum" - -- name: Ensure libselinux-python is installed - dnf: - pkg: libselinux-python - state: present - when: ansible_pkg_mgr == "dnf" + 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 yum cache + 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 yum cache + notify: refresh cache - name: Remove any yum repo files for other deployment types RHEL/CentOS file: @@ -44,7 +35,7 @@ - '*/repos/*' when: not (item | search("/files/" ~ openshift_deployment_type ~ "/repos")) and (ansible_os_family == "RedHat" and ansible_distribution != "Fedora") - notify: refresh yum cache + notify: refresh cache - name: Remove any yum repo files for other deployment types Fedora file: @@ -54,24 +45,24 @@ - '*/repos/*' when: not (item | search("/files/fedora-" ~ openshift_deployment_type ~ "/repos")) and (ansible_distribution == "Fedora") - notify: refresh dnf cache + 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 yum cache + notify: refresh cache - name: Configure yum repositories RHEL/CentOS copy: src={{ item }} dest=/etc/yum.repos.d/ with_fileglob: - "{{ openshift_deployment_type }}/repos/*" - notify: refresh yum cache + 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 dnf cache + notify: refresh cache when: (ansible_distribution == "Fedora") diff --git a/roles/openshift_storage_nfs_lvm/tasks/nfs.yml b/roles/openshift_storage_nfs_lvm/tasks/nfs.yml index bf23dfe98..cf1ba6f25 100644 --- a/roles/openshift_storage_nfs_lvm/tasks/nfs.yml +++ b/roles/openshift_storage_nfs_lvm/tasks/nfs.yml @@ -1,12 +1,7 @@ --- - name: Install NFS server - yum: name=nfs-utils state=present - when: ansible_pkg_mgr == "yum" - -- name: Install NFS server - dnf: name=nfs-utils state=present - when: ansible_pkg_mgr == "dnf" - + 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 29599559c..cbf5c37f5 100644 --- a/roles/os_env_extras/tasks/main.yaml +++ b/roles/os_env_extras/tasks/main.yaml @@ -12,13 +12,4 @@ dest: /root/.vimrc - name: Bash Completion - yum: - pkg: bash-completion - state: installed - when: ansible_pkg_mgr == "yum" - -- name: Bash Completion - dnf: - pkg: bash-completion - state: installed - when: ansible_pkg_mgr == "dnf" + 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 cf2a2c733..ba12c6b0c 100644 --- a/roles/os_firewall/tasks/firewall/firewalld.yml +++ b/roles/os_firewall/tasks/firewall/firewalld.yml @@ -1,16 +1,6 @@ --- - name: Install firewalld packages - yum: - name: firewalld - state: present - when: ansible_pkg_mgr == "yum" - register: install_result - -- name: Install firewalld packages - dnf: - name: firewalld - state: present - when: ansible_pkg_mgr == "dnf" + 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 36d51504c..d3a5b1fa7 100644 --- a/roles/os_firewall/tasks/firewall/iptables.yml +++ b/roles/os_firewall/tasks/firewall/iptables.yml @@ -1,22 +1,9 @@ --- - name: Install iptables packages - yum: - name: "{{ item }}" - state: present + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: - iptables - iptables-services - when: ansible_pkg_mgr == "yum" - register: install_result - -- name: Install iptables packages - dnf: - name: "{{ item }}" - state: present - with_items: - - iptables - - iptables-services - when: ansible_pkg_mgr == "dnf" register: install_result - name: Check if firewalld is installed diff --git a/roles/os_update_latest/tasks/main.yml b/roles/os_update_latest/tasks/main.yml index 40eec8d35..2532059c0 100644 --- a/roles/os_update_latest/tasks/main.yml +++ b/roles/os_update_latest/tasks/main.yml @@ -1,8 +1,3 @@ --- - name: Update all packages - yum: name=* state=latest - when: ansible_pkg_mgr == "yum" - -- name: Update all packages - dnf: name=* state=latest - when: ansible_pkg_mgr == "dnf" + action: "{{ ansible_pkg_mgr }} name=* state=latest"
\ No newline at end of file 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" |