summaryrefslogtreecommitdiffstats
path: root/playbooks
diff options
context:
space:
mode:
authorTlacenka <tlacencin@gmail.com>2017-10-12 18:09:39 +0200
committerTomas Sedovic <tomas@sedovic.cz>2017-10-12 18:09:39 +0200
commit79b5ef66d15b19a232dbf92e246713cf18f3cc8c (patch)
tree9d96f61637684130e7b5942248c114fe865db99a /playbooks
parent89b84815daec3b4d8876a979f15c36500b835c11 (diff)
downloadopenshift-79b5ef66d15b19a232dbf92e246713cf18f3cc8c.tar.gz
openshift-79b5ef66d15b19a232dbf92e246713cf18f3cc8c.tar.bz2
openshift-79b5ef66d15b19a232dbf92e246713cf18f3cc8c.tar.xz
openshift-79b5ef66d15b19a232dbf92e246713cf18f3cc8c.zip
Attach additional RHN Pools (post-provision custom action) (#753)
* README, add-rhn-pools.yml: Add new custom post-provision playbook that attaches additional RHN pools - also mention this example in the contrib README * added become true * README update
Diffstat (limited to 'playbooks')
-rw-r--r--playbooks/provisioning/openstack/README.md28
-rw-r--r--playbooks/provisioning/openstack/custom-actions/add-rhn-pools.yml13
2 files changed, 37 insertions, 4 deletions
diff --git a/playbooks/provisioning/openstack/README.md b/playbooks/provisioning/openstack/README.md
index b96c9c9db..fe87f68f4 100644
--- a/playbooks/provisioning/openstack/README.md
+++ b/playbooks/provisioning/openstack/README.md
@@ -524,7 +524,9 @@ 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:
+You can also create your own custom playbook. Here are a few examples:
+
+#### Adding additional YUM repositories
```
---
@@ -548,13 +550,31 @@ 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-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
### Install OpenShift
diff --git a/playbooks/provisioning/openstack/custom-actions/add-rhn-pools.yml b/playbooks/provisioning/openstack/custom-actions/add-rhn-pools.yml
new file mode 100644
index 000000000..d17c1e335
--- /dev/null
+++ b/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