Skip to content

Commit 110240d

Browse files
committed
Add pre-deploy validations
Add some variable validations, to prevent deployment issues later: * standalone_host matches with ansible_host * control_plane_ip is different from public_api * standalone_role file actually exists
1 parent 51d4e98 commit 110240d

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ usage:
2222
@echo
2323
@echo 'Individual install phase targets:'
2424
@echo ' local_requirements: Install Ansible requirements required to run dev-install'
25+
@echo ' validations: Run some validations before the deployment'
2526
@echo ' prepare_host: Host configuration required before installing standalone, including rhos-release'
2627
@echo ' network: Host networking configuration required before installing standalone'
2728
@echo ' install_stack: Install TripleO standalone'
@@ -50,12 +51,16 @@ $(overrides):
5051
#
5152

5253
.PHONY: osp_full
53-
osp_full: local_requirements prepare_host network install_stack prepare_stack
54+
osp_full: local_requirements validations prepare_host network install_stack prepare_stack
5455

5556
.PHONY: local_requirements
5657
local_requirements: inventory.yaml $(overrides)
5758
$(ANSIBLE_CMD) playbooks/local_requirements.yaml
5859

60+
.PHONY: validations
61+
validations: inventory.yaml $(overrides)
62+
$(ANSIBLE_CMD) playbooks/validations.yaml
63+
5964
.PHONY: prepare_host
6065
prepare_host: inventory.yaml $(overrides)
6166
$(ANSIBLE_CMD) playbooks/prepare_host.yaml

playbooks/validations.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
- hosts: standalone
3+
gather_facts: false
4+
vars_files: vars/defaults.yaml
5+
6+
tasks:
7+
8+
- name: Check if inventory matches with standalone_host
9+
assert:
10+
that:
11+
- standalone_host == ansible_host
12+
fail_msg: >
13+
Your inventory does not match with standalone_host set to '{{ standalone_host }}'
14+
and ansible_host in the inventory set to '{{ ansible_host }}', which could
15+
lead to a deployment on the wrong host
16+
success_msg: 'standalone_host matches with ansible_host, target is valid'
17+
18+
- name: Check if control plane IP is different from the public IP
19+
assert:
20+
that:
21+
- control_plane_ip != public_api
22+
fail_msg: >
23+
You must set different IP addresses for control_plane_ip and public_api otherwise
24+
the deployment of OpenStack will fail.
25+
success_msg: 'control plane IP is different from the public IP'
26+
27+
- name: Check that Standalone role file exists
28+
stat:
29+
path: "{{ standalone_role }}"
30+
register: standalone_role_stat_result
31+
failed_when: not standalone_role_stat_result.stat.exists

0 commit comments

Comments
 (0)