Skip to content

Commit c2f6154

Browse files
Check Kayobe version playbook
1 parent 45da429 commit c2f6154

File tree

6 files changed

+52
-0
lines changed

6 files changed

+52
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
- name: Check kayobe version
3+
hosts: localhost
4+
gather_facts: false
5+
vars:
6+
requirements_path: "{{ kayobe_config_path }}/../../requirements.txt"
7+
tasks:
8+
- name: Get installed kayobe commit
9+
ansible.builtin.shell:
10+
cmd: pip freeze | grep kayobe | cut -d @ -f 3 -s
11+
register: kayobe_git_commit
12+
13+
- name: Clone kayobe
14+
ansible.builtin.git:
15+
repo: https://github.com/stackhpc/kayobe.git
16+
dest: /tmp/kayobe-git
17+
version: stackhpc/{{ openstack_release }}
18+
19+
- name: Get tag from kayobe commit
20+
ansible.builtin.command:
21+
cmd: git describe --tags {{ kayobe_git_commit.stdout }}
22+
chdir: /tmp/kayobe-git
23+
register: kayobe_current_version
24+
25+
- name: Get latest Kayobe version
26+
ansible.builtin.shell:
27+
cmd: grep -o kayobe@stackhpc\/.*$ {{ requirements_path }} | cut -d @ -f 2
28+
register: kayobe_latest_version
29+
30+
- name: Check installed kayobe version is the latest
31+
ansible.builtin.assert:
32+
that: "kayobe_latest_version.stdout in kayobe_current_version.stdout"
33+
fail_msg: |
34+
Kayobe must be updated to the latest version before continuing.
35+
36+
Current Kayobe version: {{ kayobe_current_version.stdout }}
37+
Latest Kayobe version: {{ kayobe_latest_version.stdout }}
38+
39+
Recreate the Kayobe environment, or install the latest version
40+
by running: pip install --force-reinstall -r {{ requirements_path }}
41+
success_msg: |
42+
Kayobe running at version: {{ kayobe_current_version.stdout }}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../ansible/check-kayobe-version.yml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../ansible/check-kayobe-version.yml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../ansible/check-kayobe-version.yml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../ansible/check-kayobe-version.yml
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
features:
3+
- |
4+
Ansible playbook to check the installed Kayobe version against
5+
the version defined in Kayobe configuration. This playbook will
6+
run on Kayobe bootstrap, host and service operations.

0 commit comments

Comments
 (0)