Skip to content

Commit f431ff8

Browse files
authored
Merge pull request #321 from markllama/ansible-debugging
Ansible debugging - switches allow stop before Ansible config generation and execution
2 parents cbae446 + 7d10cc6 commit f431ff8

3 files changed

Lines changed: 49 additions & 18 deletions

File tree

fragments/bastion-ansible.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ else
152152
update_etc_hosts "$lb_ip" "$lb_hostname"
153153
fi
154154

155-
[ "$skip_ansible" == "True" ] && exit 0
155+
[ "$prepare_ansible" == "False" ] && exit 0
156156

157157
mkdir -p /var/lib/ansible/group_vars
158158
mkdir -p /var/lib/ansible/host_vars
@@ -209,11 +209,16 @@ else
209209
/var/lib/ansible/playbooks/main.yml"
210210
fi
211211

212-
if ! $cmd > $logfile 2>&1; then
213-
tail -20 $logfile >&2
214-
echo "Failed to run '$cmd', full log is in $(hostname):$logfile" >&2
215-
exit 1
212+
if [ "$execute_ansible" == True ] ; then
213+
if ! $cmd > $logfile 2>&1; then
214+
tail -20 $logfile >&2
215+
echo "Failed to run '$cmd', full log is in $(hostname):$logfile" >&2
216+
exit 1
217+
else
218+
[ -e ${ANSDIR}.deployed ] && rm -rf ${ANSDIR}.deployed
219+
mv ${ANSDIR}.started ${ANSDIR}.deployed
220+
fi
216221
else
217-
[ -e ${ANSDIR}.deployed ] && rm -rf ${ANSDIR}.deployed
218-
mv ${ANSDIR}.started ${ANSDIR}.deployed
222+
echo "INFO: ansible execution disabled"
223+
echo "INFO: command = $cmd"
219224
fi

node.yaml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,24 @@ parameters:
285285
True = Enable deployment of the OpenShift router
286286
type: boolean
287287

288-
# OpenShift installer (ansible) parameters
289-
skip_ansible:
288+
# OpenShift configuration: ansible controls
289+
# These are for debugging.
290+
# Setting prepare_ansible=false will stop the stack before creating
291+
# installation config files
292+
prepare_ansible:
293+
type: boolean
290294
description: >
291-
Disable host based installation/configuration
295+
Create ansible configuration files for openshift-ansible playbooks
296+
default: true
297+
298+
# Setting execute_ansible=false will stop the stack before running
299+
# the ansible playbooks to install openshift, but *after* the configuration
300+
# files are generated
301+
execute_ansible:
292302
type: boolean
303+
description: >
304+
Run the ansible playbooks to install openshift
305+
default: true
293306

294307
# OpenStack access parameters
295308
# These allow the OpenShift service to view and use OpenStack resources
@@ -660,8 +673,10 @@ resources:
660673
default: {get_param: prepare_registry}
661674
- name: deploy_router
662675
default: {get_param: deploy_router}
663-
- name: skip_ansible
664-
default: {get_param: skip_ansible}
676+
- name: prepare_ansible
677+
default: {get_param: prepare_ansible}
678+
- name: execute_ansible
679+
default: {get_param: execute_ansible}
665680
- name: os_auth_url
666681
default: {get_param: os_auth_url}
667682
- name: os_username

openshift.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
heat_template_version: 2014-10-16
22

3-
43
description: >
54
Deploy Atomic/OpenShift 3 on OpenStack.
65
7-
86
parameters:
97

108
# What version of OpenShift Container Platform to install
@@ -324,11 +322,23 @@ parameters:
324322
default: false
325323

326324
# OpenShift configuration: ansible controls
327-
skip_ansible:
325+
# These are for debugging.
326+
# Setting prepare_ansible=false will stop the stack before creating
327+
# installation config files
328+
prepare_ansible:
328329
type: boolean
329330
description: >
330-
Do not install Openshift using Ansible.
331-
default: false
331+
Create ansible configuration files for openshift-ansible playbooks
332+
default: true
333+
334+
# Setting execute_ansible=false will stop the stack before running
335+
# the ansible playbooks to install openshift, but *after* the configuration
336+
# files are generated
337+
execute_ansible:
338+
type: boolean
339+
description: >
340+
Run the ansible playbooks to install openshift
341+
default: true
332342

333343
openshift_ansible_git_url:
334344
type: string
@@ -718,7 +728,8 @@ resources:
718728
master_ip: {get_attr: [openshift_masters, resource.0.ip_address]}
719729
lb_hostname: {get_attr: [loadbalancer, hostname]}
720730
router_vip: {get_attr: [ipfailover, router_vip]}
721-
skip_ansible: {get_param: skip_ansible}
731+
prepare_ansible: {get_param: prepare_ansible}
732+
execute_ansible: {get_param: execute_ansible}
722733
extra_openshift_ansible_params: {get_param: extra_openshift_ansible_params}
723734

724735
# Define the network access policy for openshift nodes

0 commit comments

Comments
 (0)