From 8008fd49227a750a6a5cf5cae8700f0fe0970bce Mon Sep 17 00:00:00 2001 From: tzumainn Date: Thu, 31 Aug 2017 04:38:38 -0400 Subject: 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 --- playbooks/provisioning/openstack/README.md | 26 ++++++++++++++-------- .../openstack/custom-actions/add-yum-repos.yml | 12 ++++++++++ 2 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 playbooks/provisioning/openstack/custom-actions/add-yum-repos.yml (limited to 'playbooks') diff --git a/playbooks/provisioning/openstack/README.md b/playbooks/provisioning/openstack/README.md index 2eb9aa9cd..57d5839c8 100644 --- a/playbooks/provisioning/openstack/README.md +++ b/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 diff --git a/playbooks/provisioning/openstack/custom-actions/add-yum-repos.yml b/playbooks/provisioning/openstack/custom-actions/add-yum-repos.yml new file mode 100644 index 000000000..ffebcb642 --- /dev/null +++ b/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 }}" -- cgit v1.2.3