Repository navigation
WIP(universe): add ansible module - #1653
PaulBarrie wants to merge 1 commit into
Conversation
|
Thanks for this awesome contribution! 😇 I'll take some time to test it on my side later in the afternoon, did you manage to run them locally successfully ? |
|
Hi @PaulBarrie,
You need to change your test that way: If you do that, the tests will pass locally: |
grouville
left a comment
There was a problem hiding this comment.
As said in the main comment before. The package is not at the proper location.
I would first move it and make the changes requested from the first comment. Then after do these changes in the code.
Overall, it's very good work. These changes will improve things, but it's a strong base
There was a problem hiding this comment.
Good question, shouldn't be :)
There was a problem hiding this comment.
Are all these packages necessary to install Ansible ? Can you please show me related doc ?
There was a problem hiding this comment.
Remember got issues to install (and run) ansible without these packages with pip (to get the specified version on alpine). I will dig deeper on this topic.
There was a problem hiding this comment.
Instead of making it optional
configFile?: string @dagger(input)
Why not defaulting to either
configFile: *#DefaultAnsibleConfig | string @dagger(input)
This would remove the necessity of:
_configFileContent: #DefaultAnsibleConfig
if setup.configFile != _|_ {
_configFileContent: setup.configFile
}
```
There was a problem hiding this comment.
Yes much better :)
There was a problem hiding this comment.
By convention, we almost never name our variables in capital
There was a problem hiding this comment.
Since the naming convention seems to be Pascal case for variables and since "ssh" is an acronym, should I rather name it Ssh or ssh?
There was a problem hiding this comment.
I would go with the second one
There was a problem hiding this comment.
Having these vars as a single string seems weird (first impression). Why not making it a list of strings ?
extraVars: *null | string @dagger(input)
to
extraVars: [string] @dagger(input)
You then check the len
There was a problem hiding this comment.
Seems better indeed, just have to concatenate list afterward.
There was a problem hiding this comment.
From what I understand here, you're just mounting the config.ansibleConfig file using the env vars ?
There is the op.#Writefile that you can directly leverage. You will then be able to skip this step.
op.#WriteFile & {
content: file.content
mode: file.mode
"dest": dest
}
There was a problem hiding this comment.
Actually it mounts the inventory file at the location specified into the config file.
|
✔️ Deploy Preview for devel-docs-dagger-io ready! 🔨 Explore the source changes: 0b22291 🔍 Inspect the deploy log: https://app.netlify.com/sites/devel-docs-dagger-io/deploys/6217ca1bd82ab300075bf895 😎 Browse the preview: https://deploy-preview-1653--devel-docs-dagger-io.netlify.app |
|
Hi @grouville :) Thanks for your review ! Took some of your comments, some are still underway. I gave you permissions on my fork. |
Perfect 😇 |
Signed-off-by: paulb <[email protected]>
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
This PR was closed because it has been stalled for 7 days with no activity. |
|
Hi @PaulBarrie , we just added an experimental namespace to universe.dagger.io, to allow merging contributions such as yours sooner, without rushing it to an official status. See #1991 and #1962 for what we've done for the Pulumi package contributed by @rawkode. If you're still interested, we'd love to get your contribution merged (in your own experimental namespace) so that other developers can try it right away, and iterate from there, in the hope of getting to an official ansible package eventually. Let me know and we can give you next steps (it's easy, mostly renaming your files to a new location). Thanks and sorry for the slow response the first time around! |
|
Hi @shykes, |
This PR aims to implement an universe module in order to run ansible playbooks with dagger.
There are two steps in order to run a playbook:
#Ansiblestruct which installs ansible in the required version and load the specified config file#Playbookstruct which runs the playbook with the specified optionsI didn't find another way to load a default config variable than storing it in a long string variable. Maybe storing it in a gist and curl it might be lighter?
There might some Ansible use cases which are not handled by the module. Let me know if you see some options which should be added.
I'm not sure at all about the tests: I've added a
@testat the end of theuniverse.batsbut idk if there are other things to add in order to properly run tests on the module.Moreover, up to now the test just check that the expected output of the Ansible playbook. Should it also test that the right config and inventory are loaded?