Jelajahi Sumber

Merge branch 'master' into openstack-docs

Tomas Sedovic 7 tahun lalu
induk
melakukan
255bda6812

+ 0 - 2
playbooks/provisioning/openstack/README.md

@@ -90,7 +90,6 @@ $ sudo docker run -it -v ~/.ssh:/mnt/.ssh:Z \
      redhatcop/control-host-openstack bash
 ```
 
-
 This will create the container, add your SSH key and source your
 `keystonerc`. It should be set up for the installation.
 
@@ -202,7 +201,6 @@ If you're using multiple inventories, make sure you pass the path to
 the right one to `-i`.
 
 
-
 ### 4. Installing OpenShift
 
 We will use the `openshift-ansible` project to install openshift on

+ 26 - 3
playbooks/provisioning/openstack/advanced-configuration.md

@@ -622,7 +622,9 @@ If you'd like to limit the run to one particular host, you can do so as follows:
 ansible-playbook -i inventory/ openshift-ansible-contrib/playbooks/provisioning/openstack/custom-actions/custom-playbook.yml -l app-node-0.openshift.example.com
 ```
 
-You can also create your own custom playbook. Here's one example that adds additional YUM repositories:
+You can also create your own custom playbook. Here are a few examples:
+
+#### Adding additional YUM repositories
 
 ```
 ---
@@ -646,13 +648,34 @@ This example runs against app nodes. The list of options include:
   - masters
   - infra_hosts
 
+
+
+#### Attaching additional RHN pools
+
+```
+---
+- hosts: cluster_hosts
+  tasks:
+  - name: Attach additional RHN pool
+    become: true
+    command: "/usr/bin/subscription-manager attach --pool=<pool ID>"
+    register: attach_rhn_pool_result
+    until: attach_rhn_pool_result.rc == 0
+    retries: 10
+    delay: 1
+```
+
+This playbook runs against all cluster nodes. In order to help prevent slow connectivity
+problems, the task is retried 10 times in case of initial failure.
+Note that in order for this example to work in your deployment, your servers must use the RHEL image.
+
 Please consider contributing your custom playbook back to openshift-ansible-contrib!
 
 A library of custom post-provision actions exists in `openshift-ansible-contrib/playbooks/provisioning/openstack/custom-actions`. Playbooks include:
 
-### add-yum-repos.yml
+* [add-yum-repos.yml](https://github.com/openshift/openshift-ansible-contrib/blob/master/playbooks/provisioning/openstack/custom-actions/add-yum-repos.yml): adds a list of custom yum repositories to every node in the cluster
+* [add-rhn-pools.yml](https://github.com/openshift/openshift-ansible-contrib/blob/master/playbooks/provisioning/openstack/custom-actions/add-rhn-pools.yml): attaches a list of additional RHN pools to every node in the cluster
 
-[add-yum-repos.yml](https://github.com/openshift/openshift-ansible-contrib/blob/master/playbooks/provisioning/openstack/custom-actions/add-yum-repos.yml) adds a list of custom yum repositories to every node in the cluster.
 
 ## Install OpenShift
 

+ 13 - 0
playbooks/provisioning/openstack/custom-actions/add-rhn-pools.yml

@@ -0,0 +1,13 @@
+---
+- hosts: cluster_hosts
+  vars:
+    rhn_pools: []
+  tasks:
+  - name: Attach additional RHN pools
+    become: true
+    with_items: "{{ rhn_pools }}"
+    command: "/usr/bin/subscription-manager attach --pool={{ item }}"
+    register: attach_rhn_pools_result
+    until: attach_rhn_pools_result.rc == 0
+    retries: 10
+    delay: 1

+ 5 - 0
playbooks/provisioning/openstack/sample-inventory/group_vars/all.yml

@@ -62,6 +62,11 @@ openstack_default_flavor: "m1.medium"
 #docker_lb_volume_size: "5"
 docker_volume_size: "15"
 
+## Specify server group policies for master and infra nodes. Nova must be configured to
+## enable these policies. 'anti-affinity' will ensure that each VM is launched on a
+## different physical host.
+#openstack_master_server_group_policies: [anti-affinity]
+#openstack_infra_server_group_policies: [anti-affinity]
 
 ## Create a Cinder volume and use it for the OpenShift registry.
 ## NOTE: the openstack credentials and hosted registry options must be set in OSEv3.yml!

+ 2 - 0
playbooks/provisioning/openstack/stack_params.yaml

@@ -36,6 +36,8 @@ num_masters: "{{ openstack_num_masters }}"
 num_nodes: "{{ openstack_num_nodes }}"
 num_infra: "{{ openstack_num_infra }}"
 num_dns: "{{ openstack_num_dns | default(1) }}"
+master_server_group_policies: "{{ openstack_master_server_group_policies | default([]) | to_yaml }}"
+infra_server_group_policies: "{{ openstack_infra_server_group_policies | default([]) | to_yaml }}"
 master_volume_size: "{{ docker_master_volume_size | default(docker_volume_size) }}"
 infra_volume_size: "{{ docker_infra_volume_size | default(docker_volume_size) }}"
 node_volume_size: "{{ docker_node_volume_size | default(docker_volume_size) }}"

+ 22 - 0
roles/openstack-stack/templates/heat_stack.yaml.j2

@@ -536,6 +536,20 @@ resources:
       - interface
 {% endif %}
 
+{% if master_server_group_policies|length > 0 %}
+  master_server_group:
+    type: OS::Nova::ServerGroup
+    properties:
+      name: master_server_group
+      policies: {{ master_server_group_policies }}
+{% endif %}
+{% if infra_server_group_policies|length > 0 %}
+  infra_server_group:
+    type: OS::Nova::ServerGroup
+    properties:
+      name: infra_server_group
+      policies: {{ infra_server_group_policies }}
+{% endif %}
 {% if num_masters|int > 1 %}
   loadbalancer:
     type: OS::Heat::ResourceGroup
@@ -643,6 +657,10 @@ resources:
           floating_network: {{ external_network }}
 {% endif %}
           volume_size: {{ master_volume_size }}
+{% if master_server_group_policies|length > 0 %}
+          scheduler_hints:
+            group: { get_resource: master_server_group }
+{% endif %}
 {% if not provider_network %}
     depends_on:
       - interface
@@ -766,6 +784,10 @@ resources:
           floating_network: {{ external_network }}
 {% endif %}
           volume_size: {{ infra_volume_size }}
+{% if infra_server_group_policies|length > 0 %}
+          scheduler_hints:
+            group: { get_resource: infra_server_group }
+{% endif %}
 {% if not provider_network %}
     depends_on:
       - interface

+ 6 - 0
roles/openstack-stack/templates/heat_stack_server.yaml.j2

@@ -98,6 +98,11 @@ parameters:
     description: OpenShift Node Labels
     default: {"region": "default" }
 
+  scheduler_hints:
+    type: json
+    description: Server scheduler hints.
+    default: {}
+
 outputs:
 
   name:
@@ -154,6 +159,7 @@ resources:
         host-type: { get_param: type }
         sub-host-type:    { get_param: subtype }
         node_labels: { get_param: node_labels }
+      scheduler_hints: { get_param: scheduler_hints }
 
 {% if use_trunk_ports|default(false)|bool %}
   trunk-port:

+ 6 - 0
roles/openstack-stack/templates/heat_stack_server_nofloating.yaml.j2

@@ -89,6 +89,11 @@ parameters:
     description: OpenShift Node Labels
     default: {"region": "default" }
 
+  scheduler_hints:
+    type: json
+    description: Server scheduler hints.
+    default: {}
+
 outputs:
 
   name:
@@ -131,6 +136,7 @@ resources:
         host-type: { get_param: type }
         sub-host-type:    { get_param: subtype }
         node_labels: { get_param: node_labels }
+      scheduler_hints: { get_param: scheduler_hints }
 
 {% if use_trunk_ports|default(false)|bool %}
   trunk-port: