diff options
-rw-r--r-- | README_OSE.md | 2 | ||||
-rw-r--r-- | README_origin.md | 2 | ||||
-rw-r--r-- | README_vagrant.md | 2 | ||||
-rw-r--r-- | playbooks/aws/openshift-cluster/terminate.yml | 9 | ||||
-rw-r--r-- | playbooks/common/openshift-cluster/update_repos_and_packages.yml | 5 | ||||
-rw-r--r-- | playbooks/gce/openshift-cluster/terminate.yml | 15 | ||||
-rw-r--r-- | playbooks/libvirt/openshift-cluster/launch.yml | 2 | ||||
-rw-r--r-- | playbooks/libvirt/openshift-cluster/terminate.yml | 17 | ||||
-rw-r--r-- | playbooks/libvirt/openshift-cluster/vars.yml | 9 | ||||
-rw-r--r-- | playbooks/openstack/openshift-cluster/terminate.yml | 25 | ||||
-rw-r--r-- | roles/openshift_common/README.md | 2 | ||||
-rw-r--r-- | roles/openshift_facts/tasks/main.yml | 1 | ||||
-rw-r--r-- | roles/openshift_master/README.md | 2 | ||||
-rw-r--r-- | roles/openshift_node/README.md | 2 | ||||
-rw-r--r-- | roles/openshift_repos/README.md | 2 | ||||
-rw-r--r-- | roles/rhel_subscribe/tasks/enterprise.yml | 5 | ||||
-rw-r--r-- | roles/rhel_subscribe/tasks/main.yml | 29 | ||||
-rw-r--r-- | roles/rhel_unsubscribe/tasks/main.yml | 5 |
18 files changed, 123 insertions, 13 deletions
diff --git a/README_OSE.md b/README_OSE.md index 471fdcf9e..31173e5d6 100644 --- a/README_OSE.md +++ b/README_OSE.md @@ -46,7 +46,7 @@ subscription-manager repos --disable="*" subscription-manager repos \ --enable="rhel-7-server-rpms" \ --enable="rhel-7-server-extras-rpms" \ ---enable="rhel-server-7-ose-beta-rpms" +--enable="rhel-7-server-ose-3.0-rpms" ``` * Configuration of router is not automated yet * Configuration of docker-registry is not automated yet diff --git a/README_origin.md b/README_origin.md index 2ccedf4d5..fb0931132 100644 --- a/README_origin.md +++ b/README_origin.md @@ -35,7 +35,7 @@ subscription-manager repos --disable="*" subscription-manager repos \ --enable="rhel-7-server-rpms" \ --enable="rhel-7-server-extras-rpms" \ ---enable="rhel-server-7-ose-beta-rpms" +--enable="rhel-7-server-ose-3.0-rpms" ``` * Configuration of router is not automated yet * Configuration of docker-registry is not automated yet diff --git a/README_vagrant.md b/README_vagrant.md index e3b3b5551..26ec52c0a 100644 --- a/README_vagrant.md +++ b/README_vagrant.md @@ -1,7 +1,7 @@ Requirements ------------ - vagrant (tested against version 1.7.2) -- vagrant-hostmaster plugin (tested against version 1.5.0) +- vagrant-hostmanager plugin (tested against version 1.5.0) - vagrant-libvirt (tested against version 0.0.26) - Only required if using libvirt instead of virtualbox diff --git a/playbooks/aws/openshift-cluster/terminate.yml b/playbooks/aws/openshift-cluster/terminate.yml index 9c3703aba..3a08ed966 100644 --- a/playbooks/aws/openshift-cluster/terminate.yml +++ b/playbooks/aws/openshift-cluster/terminate.yml @@ -13,6 +13,15 @@ ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}" with_items: groups[scratch_group] | default([]) | difference(['localhost']) +- name: Unsubscribe VMs + hosts: oo_hosts_to_terminate + roles: + - role: rhel_unsubscribe + when: deployment_type == "enterprise" and + ansible_distribution == "RedHat" and + lookup('oo_option', 'rhel_skip_subscription') | default(rhsub_skip, True) | + default('no', True) | lower in ['no', 'false'] + - name: Terminate instances hosts: localhost connection: local diff --git a/playbooks/common/openshift-cluster/update_repos_and_packages.yml b/playbooks/common/openshift-cluster/update_repos_and_packages.yml index e92c6f1ee..190e2d862 100644 --- a/playbooks/common/openshift-cluster/update_repos_and_packages.yml +++ b/playbooks/common/openshift-cluster/update_repos_and_packages.yml @@ -3,5 +3,10 @@ vars: openshift_deployment_type: "{{ deployment_type }}" roles: + - role: rhel_subscribe + when: deployment_type == "enterprise" and + ansible_distribution == "RedHat" and + lookup('oo_option', 'rhel_skip_subscription') | default(rhsub_skip, True) | + default('no', True) | lower in ['no', 'false'] - openshift_repos - os_update_latest diff --git a/playbooks/gce/openshift-cluster/terminate.yml b/playbooks/gce/openshift-cluster/terminate.yml index abe6a4c95..098b0df73 100644 --- a/playbooks/gce/openshift-cluster/terminate.yml +++ b/playbooks/gce/openshift-cluster/terminate.yml @@ -8,7 +8,7 @@ - set_fact: scratch_group=tag_env-host-type-{{ cluster_id }}-openshift-node - add_host: name: "{{ item }}" - groups: oo_nodes_to_terminate + groups: oo_hosts_to_terminate, oo_nodes_to_terminate ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}" ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}" with_items: groups[scratch_group] | default([]) | difference(['localhost']) | difference(groups.status_terminated) @@ -16,11 +16,22 @@ - set_fact: scratch_group=tag_env-host-type-{{ cluster_id }}-openshift-master - add_host: name: "{{ item }}" - groups: oo_masters_to_terminate + groups: oo_hosts_to_terminate, oo_masters_to_terminate ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}" ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}" with_items: groups[scratch_group] | default([]) | difference(['localhost']) | difference(groups.status_terminated) +- name: Unsubscribe VMs + hosts: oo_hosts_to_terminate + vars_files: + - vars.yml + roles: + - role: rhel_unsubscribe + when: deployment_type == "enterprise" and + ansible_distribution == "RedHat" and + lookup('oo_option', 'rhel_skip_subscription') | default(rhsub_skip, True) | + default('no', True) | lower in ['no', 'false'] + - include: ../openshift-node/terminate.yml vars: gce_service_account_email: "{{ lookup('env', 'gce_service_account_email_address') }}" diff --git a/playbooks/libvirt/openshift-cluster/launch.yml b/playbooks/libvirt/openshift-cluster/launch.yml index a7ddc1e7e..6badcb325 100644 --- a/playbooks/libvirt/openshift-cluster/launch.yml +++ b/playbooks/libvirt/openshift-cluster/launch.yml @@ -13,7 +13,7 @@ image_name: "{{ deployment_vars[deployment_type].image.name }}" tasks: - fail: msg="Deployment type not supported for libvirt provider yet" - when: deployment_type in ['online', 'enterprise'] + when: deployment_type == 'online' - include: tasks/configure_libvirt.yml diff --git a/playbooks/libvirt/openshift-cluster/terminate.yml b/playbooks/libvirt/openshift-cluster/terminate.yml index b173a09dd..8f00812a9 100644 --- a/playbooks/libvirt/openshift-cluster/terminate.yml +++ b/playbooks/libvirt/openshift-cluster/terminate.yml @@ -15,6 +15,23 @@ ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}" with_items: groups[cluster_group] | default([]) +- name: Unsubscribe VMs + hosts: oo_hosts_to_terminate + vars_files: + - vars.yml + roles: + - role: rhel_unsubscribe + when: deployment_type == "enterprise" and + ansible_distribution == "RedHat" and + lookup('oo_option', 'rhel_skip_subscription') | default(rhsub_skip, True) | + default('no', True) | lower in ['no', 'false'] + +- name: Terminate instance(s) + hosts: localhost + gather_facts: no + vars_files: + - vars.yml + tasks: - name: Destroy VMs virt: name: '{{ item[0] }}' diff --git a/playbooks/libvirt/openshift-cluster/vars.yml b/playbooks/libvirt/openshift-cluster/vars.yml index e3c8cd8d0..c77a0797e 100644 --- a/playbooks/libvirt/openshift-cluster/vars.yml +++ b/playbooks/libvirt/openshift-cluster/vars.yml @@ -24,9 +24,12 @@ deployment_vars: sudo: no enterprise: image: - url: - name: - sha256: + url: "{{ lookup('oo_option', 'image_url') | + default('https://access.cdn.redhat.com//content/origin/files/sha256/ff/ff8198653cfd9c39411fc57077451ac291b3a605d305e905932fd6d5b1890bf3/rhel-guest-image-7.1-20150224.0.x86_64.qcow2', True) }}" + name: "{{ lookup('oo_option', 'image_name') | + default('rhel-guest-image-7.1-20150224.0.x86_64.qcow2', True) }}" + sha256: "{{ lookup('oo_option', 'image_sha256') | + default('ff8198653cfd9c39411fc57077451ac291b3a605d305e905932fd6d5b1890bf3', True) }}" ssh_user: openshift sudo: yes # origin: diff --git a/playbooks/openstack/openshift-cluster/terminate.yml b/playbooks/openstack/openshift-cluster/terminate.yml index fc4ec3c88..62df2be73 100644 --- a/playbooks/openstack/openshift-cluster/terminate.yml +++ b/playbooks/openstack/openshift-cluster/terminate.yml @@ -5,6 +5,31 @@ vars_files: - vars.yml tasks: + - set_fact: cluster_group=tag_env_{{ cluster_id }} + - add_host: + name: "{{ item }}" + groups: oo_hosts_to_terminate + ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}" + ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}" + with_items: groups[cluster_group] | default([]) + +- name: Unsubscribe VMs + hosts: oo_hosts_to_terminate + vars_files: + - vars.yml + roles: + - role: rhel_unsubscribe + when: deployment_type == "enterprise" and + ansible_distribution == "RedHat" and + lookup('oo_option', 'rhel_skip_subscription') | default(rhsub_skip, True) | + default('no', True) | lower in ['no', 'false'] + +- hosts: localhost + connection: local + gather_facts: no + vars_files: + - vars.yml + tasks: - name: Delete the OpenStack Stack command: 'heat stack-delete openshift-ansible-{{ cluster_id }}-stack' register: stack_delete_result diff --git a/roles/openshift_common/README.md b/roles/openshift_common/README.md index 14c2037e4..eb4ef26e8 100644 --- a/roles/openshift_common/README.md +++ b/roles/openshift_common/README.md @@ -7,7 +7,7 @@ Requirements ------------ A RHEL 7.1 host pre-configured with access to the rhel-7-server-rpms, -rhel-7-server-extra-rpms, and rhel-7-server-ose-beta-rpms repos. +rhel-7-server-extra-rpms, and rhel-7-server-ose-3.0-rpms repos. Role Variables -------------- diff --git a/roles/openshift_facts/tasks/main.yml b/roles/openshift_facts/tasks/main.yml index d71e6d019..b2cda3a85 100644 --- a/roles/openshift_facts/tasks/main.yml +++ b/roles/openshift_facts/tasks/main.yml @@ -4,6 +4,7 @@ that: - ansible_version | version_compare('1.8.0', 'ge') - ansible_version | version_compare('1.9.0', 'ne') + - ansible_version | version_compare('1.9.0.1', 'ne') - name: Gather OpenShift facts openshift_facts: diff --git a/roles/openshift_master/README.md b/roles/openshift_master/README.md index 3178e318c..19f77d145 100644 --- a/roles/openshift_master/README.md +++ b/roles/openshift_master/README.md @@ -7,7 +7,7 @@ Requirements ------------ A RHEL 7.1 host pre-configured with access to the rhel-7-server-rpms, -rhel-7-server-extras-rpms, and rhel-server-7-ose-beta-rpms repos. +rhel-7-server-extras-rpms, and rhel-7-server-ose-3.0-rpms repos. Role Variables -------------- diff --git a/roles/openshift_node/README.md b/roles/openshift_node/README.md index c3c17b848..5edb3b8dd 100644 --- a/roles/openshift_node/README.md +++ b/roles/openshift_node/README.md @@ -9,7 +9,7 @@ Requirements One or more OpenShift Master servers. A RHEL 7.1 host pre-configured with access to the rhel-7-server-rpms, -rhel-7-server-extras-rpms, and rhel-server-7-ose-beta-rpms repos. +rhel-7-server-extras-rpms, and rhel-7-server-ose-3.0-rpms repos. Role Variables -------------- diff --git a/roles/openshift_repos/README.md b/roles/openshift_repos/README.md index 6bbedd839..95b155b29 100644 --- a/roles/openshift_repos/README.md +++ b/roles/openshift_repos/README.md @@ -7,7 +7,7 @@ Requirements ------------ A RHEL 7.1 host pre-configured with access to the rhel-7-server-rpms, -rhel-7-server-extra-rpms, and rhel-7-server-ose-beta-rpms repos. +rhel-7-server-extra-rpms, and rhel-7-server-ose-3.0-rpms repos. Role Variables -------------- diff --git a/roles/rhel_subscribe/tasks/enterprise.yml b/roles/rhel_subscribe/tasks/enterprise.yml new file mode 100644 index 000000000..fc4d44745 --- /dev/null +++ b/roles/rhel_subscribe/tasks/enterprise.yml @@ -0,0 +1,5 @@ +--- +- name: Enable RHEL repositories + command: subscription-manager repos \ + --enable="rhel-7-server-rpms" \ + --enable="rhel-7-server-ose-3.0-rpms" diff --git a/roles/rhel_subscribe/tasks/main.yml b/roles/rhel_subscribe/tasks/main.yml new file mode 100644 index 000000000..8fb2fc042 --- /dev/null +++ b/roles/rhel_subscribe/tasks/main.yml @@ -0,0 +1,29 @@ +--- +# TODO: Enhance redhat_subscription module +# to make it able to attach to a pool +# to make it able to enable repositories + +- set_fact: + rhel_subscription_user: "{{ lookup('oo_option', 'rhel_subscription_user') | default(rhsub_user, True) | default(omit, True) }}" + rhel_subscription_pass: "{{ lookup('oo_option', 'rhel_subscription_pass') | default(rhsub_pass, True) | default(omit, True) }}" + +- fail: + msg: "This role is only supported for Red Hat hosts" + when: ansible_distribution != 'RedHat' + +- fail: + msg: Either rsub_user or the rhel_subscription_user env variable are required for this role. + when: rhel_subscription_user is not defined + +- fail: + msg: Either rsub_pass or the rhel_subscription_pass env variable are required for this role. + when: rhel_subscription_pass is not defined + +- name: RedHat subscriptions + redhat_subscription: + username: "{{ rhel_subscription_user }}" + password: "{{ rhel_subscription_pass }}" + autosubscribe: yes + +- include: enterprise.yml + when: deployment_type == 'enterprise' diff --git a/roles/rhel_unsubscribe/tasks/main.yml b/roles/rhel_unsubscribe/tasks/main.yml new file mode 100644 index 000000000..2aeb09d83 --- /dev/null +++ b/roles/rhel_unsubscribe/tasks/main.yml @@ -0,0 +1,5 @@ +--- +- name: Remove RedHat subscriptions + redhat_subscription: + state: absent + when: ansible_distribution == "RedHat" |