Skip to content

Instantly share code, notes, and snippets.

@Spredzy
Created June 14, 2017 12:46
Show Gist options
  • Save Spredzy/d0e5e7a018ff48b018a7b4d5de7329d7 to your computer and use it in GitHub Desktop.
Save Spredzy/d0e5e7a018ff48b018a7b4d5de7329d7 to your computer and use it in GitHub Desktop.
# Initial Step:
#
# Schedule a new job giving a specific topic and specifying the remote CI.
# The return of this action contains all the data associated with the job,
# we hence register those data for later consumptions
#
- hosts: localhost
tasks:
- name: Schedule a new job
dci_job:
topic: 'OSP10'
remoteci: lab-arnX
register: job_informations
# New state
#
# User is free to do whaterver she needs before entering pre-run state.
# Usually this is used to sync the components the job is relying on.
#
- name: 'New state commands'
hosts: localhost
vars:
dci_status: 'new'
tasks:
- block:
- name: echo 'New'
shell: echo 'New'
rescue:
- name: Fail properly
fail:
msg: 'Something went wrong with the installation'
# Pre-run state
#
# User is free to do whaterver she needs before entering pre-run state.
# Usually this is used to spawn the undercloud vm
#
- name: 'Pre-run state commands'
hosts: localhost
vars:
dci_status: 'pre-run'
tasks:
- block:
- name: echo 'Pre-run'
shell: echo 'pre-run'
rescue:
- name: Fail properly
fail:
msg: 'Something went wrong with the installation'
# Running state
#
# User is free to do whaterver she needs before entering running state.
# Usually this is used to provision the undercloud and the overcloud
#
- name: 'Running state commands'
hosts: localhost
vars:
dci_status: 'running'
tasks:
- block:
- name: echo 'Running'
shell: echo 'Running'
rescue:
- name: Fail properly
fail:
msg: 'Something went wrong with the installation'
# Post-run state
#
# User is free to do whaterver she needs before entering post-run state.
# Usually this is used to run tests on the overcloud
#
- name: 'Post-run state commands'
hosts: localhost
vars:
dci_status: 'post-run'
dci_comment: 'Post-run state commands'
tasks:
- block:
- name: echo 'Post-run'
shell: echo 'Post-run'
- name: Upload test results
dci_file:
name: '{{ item.name }}'
path: '{{ item.path }}'
job_id: '{{ job_informations.id }}'
mime: 'application/junit'
with_items:
- {'name': 'Rally', 'path': 'rally.junit'}
- {'name': 'Tempest', 'path': 'tempest.junit'}
- {'name': 'Certification', 'path': 'cert.junit'}
rescue:
- name: Fail properly
fail:
msg: 'Something went wrong with the installation'
# Success state
#
# User is free to do whaterver she needs before entering pre-run state.
# Usually this is used to teardown the plateform
#
- name: 'Success state commands'
hosts: localhost
vars:
dci_status: 'success'
tasks:
- name: echo 'Success'
shell: echo 'Succes'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment