Pārlūkot izejas kodu

Add custom post-provision playbook for adding yum repos (#697)

* Add custom post-provision playbook for adding yum repos

* fixed formatting issues

* requested corrections and formatting changes
tzumainn 7 gadi atpakaļ
vecāks
revīzija
8008fd4922

+ 17 - 9
playbooks/provisioning/openstack/README.md

@@ -325,7 +325,19 @@ if requested, and DNS server, and ensures other OpenShift requirements to be met
 
 ### Running Custom Post-Provision Actions
 
-If you'd like to run post-provision actions, you can do so by creating a custom playbook. Here's one example that adds additional YUM repositories:
+A custom playbook can be run like this:
+
+```
+ansible-playbook --private-key ~/.ssh/openshift -i inventory/ openshift-ansible-contrib/playbooks/provisioning/openstack/custom-actions/custom-playbook.yml
+```
+
+If you'd like to limit the run to one particular host, you can do so as follows:
+
+```
+ansible-playbook --private-key ~/.ssh/openshift -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:
 
 ```
 ---
@@ -349,17 +361,13 @@ This example runs against app nodes. The list of options include:
   - masters
   - infra_hosts
 
-After writing your custom playbook, run it like this:
+Please consider contributing your custom playbook back to openshift-ansible-contrib!
 
-```
-ansible-playbook --private-key ~/.ssh/openshift -i myinventory/ custom-playbook.yaml
-```
+A library of custom post-provision actions exists in `openshift-ansible-contrib/playbooks/provisioning/openstack/custom-actions`. Playbooks include:
 
-If you'd like to limit the run to one particular host, you can do so as follows:
+##### add-yum-repos.yml
 
-```
-ansible-playbook --private-key ~/.ssh/openshift -i myinventory/ custom-playbook.yaml -l app-node-0.openshift.example.com
-```
+[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
 

+ 12 - 0
playbooks/provisioning/openstack/custom-actions/add-yum-repos.yml

@@ -0,0 +1,12 @@
+---
+- hosts: cluster_hosts
+  vars:
+    yum_repos: []
+  tasks:
+  # enable additional yum repos
+  - name: Add repository
+    yum_repository:
+      name: "{{ item.name }}"
+      description: "{{ item.description }}"
+      baseurl: "{{ item.baseurl }}"
+    with_items: "{{ yum_repos }}"