Skip to content

Instantly share code, notes, and snippets.

@Spredzy
Created June 14, 2017 11:42
Show Gist options
  • Save Spredzy/53ff6d0058230ed844a9b974028f2ae6 to your computer and use it in GitHub Desktop.
Save Spredzy/53ff6d0058230ed844a9b974028f2ae6 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
- name: Display job informations
debug:
msg: '{{ 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'
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