Programmatic usage & Ansible integration #377
Replies: 11 comments
-
there is ansible cloudformation module which I haven't tried http://docs.ansible.com/ansible/latest/modules/cloudformation_module.html |
Beta Was this translation helpful? Give feedback.
-
I'm not looking to reimplement sceptre in Ansible (even though that would probably be possible); we use Ansible ultimately for CM and not IaC. That said there are still opportunities for integration, and to keep vars DRY I need to build a bridge between the Ansible runtime, sceptre inputs, cloudformation outputs. Sceptre already shines at basically being a replacement client/UX for cloudformation, insists on project layouts that are scalable and easy to understand, and provides a bunch of niceties like the hooks/custom resolvers. Cloudforming with Ansible directly would trash a lot of those good things by default, removing the powerful conventions that parameter/template files must be positioned in predictable locations, and especially the client UX, because Ansible cannot stream stdout in realtime. |
Beta Was this translation helpful? Give feedback.
-
@mattvonrocketstein current |
Beta Was this translation helpful? Give feedback.
-
@nmyster do we think that the v1/v2 split means my previous question has no answer? To paraphrase: what is the best way to accomplish [basic programmatic usage] in a way that will be stable across many sceptre versions in the recent past and moving forward? |
Beta Was this translation helpful? Give feedback.
-
@mattvonrocketstein V2 will unfortunately introduce breaking changes. If you want to have your code work for previous versions then it is probably best to write something branching off This is something we would probably include int the |
Beta Was this translation helpful? Give feedback.
-
I'm still interested in the question of basic programmatic usage, but I'm more familiar at this point with writing Sceptre hooks, and rather than driving Sceptre from Ansible I can see it would possible to drive Ansible from Sceptre. Here's a few more possible integrations I'm brain storming about. I have code for much of this, I'm now looking for feedback about whether I ultimately might need to fork, or if there is interest in mainstreaming it. Because 1. Pulling Sceptre Stack Outputs into Ansible. This is possible by just capturing stdout from sceptre CLI 2. Ansible as a Sceptre Hook. . Inside a stack config, things would look something like this:
Here the familiar (and fully rendered) contents of Sceptre's 3. Ansible Embedded directly in Sceptre Many Ansible modules by themselves could be useful directly as sceptre hooks, but to avoid making a hook for each it's possible to just allow Sceptre to use embedded Ansible. In that scenario, things could look something like this:
|
Beta Was this translation helpful? Give feedback.
-
Definitely happy for this to progress but it's not something I'll be able to help with it the near-mid term. I think it would be reasonable to introduce this as a new feature or plugin somewhere in post v2.0 release if there is enough interest etc. Re Regarding version 2, currently in |
Beta Was this translation helpful? Give feedback.
-
@mattvonrocketstein has your thinking evolved any more on this as time has gone on? V2 is now out and provides a cleaner api if you are wanting to look at this from that angle again? |
Beta Was this translation helpful? Give feedback.
-
I still have code for a lot of what I described, and I'd still like to contribute upstream, but it's probably too early for me to move to v2. Maybe the question now becomes, what is the best-practice way to interact with sceptre programmatically in v2, and can I backport at least a compatible interface to v1 (even if the implementation is very different)? |
Beta Was this translation helpful? Give feedback.
-
Has this progressed? I'm interested in the ability to create ephemeral infrastructure without having to create a new folder and files. So having a folder in config, something like 'dev-like'. And Ansible or Jenkins to take a copy of that and find/replace some values and folder name. |
Beta Was this translation helpful? Give feedback.
-
Sceptre can be used programmatically already. V3 which is still a WIP separates all file handling from core sceptre functionality. Eg in v3 sceptre core instantiates with an object and that can be from file system or created manually or programmatically. There is no date for go live with v3 |
Beta Was this translation helpful? Give feedback.
-
I'm interested in building an ansible module for sceptre. This requires me to work with sceptre's API, because I won't benefit from my usage of custom sceptre resolvers if I just naively grab the config yaml from the file system.
Here's some working code I came up with, but I noticed that the imports would be broken with the current development version of sceptre, and the docs specifically mention not to directly use
sceptre.cli
.So where did
get_env()
go in current master, and what is the best way to accomplish this in a way that will be stable across many sceptre versions in the recent past and moving forward? If I can get some guidance on this I'll follow up with a pull request to the docs.. I think what I'm trying to do is the first thing everyone who is interested in the API will want to do.Beta Was this translation helpful? Give feedback.
All reactions