Comments (5)
Further conversation between myself and @samvarankashyap revealed a semi-solid yaml format in the PinFile which will use hooks. There will be four basic types of hooks:
- pre-provision (likely called `pre-up')
- pre-teardown (likely called `pre-down')
- post-teardown (likely called `post-down')
- post-provision (likely called `post-up')
The last will allow additional state functionality. The concept being that if an inventory is being generated, a hook may wish to take output data, and massage it before allowing inventory generation to happen. It's possible other hooks will allow for additonal states in the future as well.
Below is an example PinFile
, which conveys the use of the hooks. Below that, is a possible directory tree of this feature.
# global hooks to be used by name
hooks:
post-up:
- name: check_ssh
type: ansible
targets:
- check_ssh.yml
# PinFile target for openstack
openstack:
topology: openstack_server.yml
layout: openshift-cluster.yml
hooks:
post-up:
name: do_something
type: golang
action_manager: golang_manager
actions:
- do_this.go
name: manipulate_inventory
state: before_invgen
type: ansible
path: my_ansible_stuff
actions:
- add_many_global_vars_so_i_dont_have_to_create_it_in_a_layout.yml
vars_file: amgvsidhtciial.yml
name: check_ssh
name: build_openshift_cluster
type: ansible
actions:
- setup.yml
- origin_from_source.yml
- openshift_ansible_from_source.yml
- deploy_aosi.yml
- run_e2e_tests.yml
pre-down:
name: teardown_jenkins
type: python
actions:
- TOPO="{{ topology }}" /usr/bin/python2.7 paws group -n my_test.yml
Within a PinfFile, hooks can be either global or local to a target. Global ones are declared with the hooks
heading and can be used in any target. Additionally, built-in hooks will likely exist.
Interpolation of the topology, layout, output, inventory, and other variables will be available to specific hooks. Determinations about when data is available should be clear (eg. outputs are not generated until after provisioning completes).
Actions are performed based upon their provided type. If no type is listed, a shell action will be default. Actions do not generally cause linchpin to exit. Rather, the error message is displayed, and processing moves forward. However, exit-on-error: True
can be passed to a specific action. If said action indeed errors, linchpin will exit with an appropriate error code. If exit-on-error: False
(default) is set, linchpin will continue on as if no error happened. Assuming linchpin exits properly, the error code will be 0 (success) in that case.
Built-in actions are of three types:
- shell (default)
- Ansible
- python
Action Managers can be created and loaded via a proxy class (ironically called ActionManager) to allow processing of actions beyond the built-in types. The example yaml above shows an action_manager named golang_manager
. This could allow for scripts written in go to be imported and executed natively.
Below is an example linchpin layout, including already existing files and paths, plus new ones to accommodate the hooks functionality being described in this issue.
lp_workspace/
├── hooks
│ ├── ansible
│ │ ├── build_openshift_cluster
│ │ │ ├── deploy_aosi.yml
│ │ │ ├── openshift_ansible_from_source.yml
│ │ │ ├── origin_from_source.yml
│ │ │ ├── run_e2e_tests.yml
│ │ │ └── setup.yml
│ │ ├── _global
│ │ │ ├── check_ssh.yml
│ │ │ └── vars
│ │ └── managers
│ ├── golang
│ │ └── managers
│ │ └── golang_manager.go
│ ├── my_ansible_stuff
│ │ ├── manipulate_inventory
│ │ │ └── add_many_global_vars_so_i_dont_have_to_create_it_in_a_layout.yml
│ │ └── vars
│ │ └── amgvsidhtciial.yml
│ └── python
│ └── teardown_jenkins
│ └── teardown_jenkins_slave.py
├── inventories
├── layout
├── outputs
├── PinFile
└── topology
This is a ROUGH DRAFT of the concept, and needs continued care and feeding to improve the design. If you have thoughts or additional suggestions, please feel free to comment here, or join us on #linchpin on the Freenode IRC network.
from linchpin.
/cc @mprahl @danalanerh - any idea if this would handle our sleep
/ wait_for
problems?
from linchpin.
@ralphbean I think this could work, but it's only a marginal improvement over running the playbook separately in Jenkins.
from linchpin.
from linchpin.
from linchpin.
Related Issues (20)
- AWS EC2 provisioning fails when `count` is not set
- Example link deprecated
- no_monitor option cannot be set in linchpin.conf
- Error message showing up during linchpin container build HOT 1
- Linchpin installation fails on centos8 due to openstacksdk error
- Linchpin 1.7.2 failing on openstack provisioning on python 2.7 release
- Linchpin 2.0 fails on latest version of tinydb 4.0
- Packaging process disabled HOT 7
- Beaker payload definition - Add support for reservesys XML element
- Failed to provision openstack port with os_port due to missing network param
- can't successfully buildh linchpin container followed by official documentation HOT 7
- failed: [localhost] (item=None) => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false} HOT 4
- TypeError: get() got an unexpected keyword argument 'eid' HOT 5
- Can't successfully destroy provisioned VM based on contrainfra/linchpin HOT 4
- Support and document how to create blank libvirt VMs HOT 5
- 'linchpin_mock' is undefined HOT 5
- Failed to destroy beaker machine HOT 9
- [OpenStack] Additional Volumes should be cleaned when I hit linchpin destroy HOT 4
- Provisioning from beaker is failed on fedora 33 HOT 3
- Possible Improvement Scope: Leftover Installation in the Ansible test scripts HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linchpin.