wide-midnight-78598
03/31/2022, 2:57 PMansible_sources
), or just use a files
or resources
field? While ansible execution files are largely yaml, there can be any extension of files which are used as resources or references. There is a semantic difference to be had, but not a practical or functional one I feel.
For example, I can do something like the following:
files(
name="myansiblesources",
sources=["**/*"],
)
or
ansible_sources(
name="myansiblesources",
sources=["**/*"],
)
ansible_deployment(
name="helloansible",
dependencies=[":myansiblesources"],
playbook="playbook.yml",
#inventory="", # TODO: Could this be setup like the Docker registries? in pants.toml
#tags="", # TODO: Might need a different name to not overlap
#timeout="",
)
Or, I could get even more specific by calling out the YAML files and then the supplementary files to help with formatting/linting I guess...
In summary, I'm not sure about the API 🙂
I'm going forward to get something functional, but in terms of something maximally usable/pragmatic + pants-likefast-nail-55400
03/31/2022, 3:08 PMansible_sources
? That solution would not preclude you from introducing separate targets later (or having a field that references addresses of `files`/`resources` targets later).curved-television-6568
03/31/2022, 3:08 PMwide-midnight-78598
03/31/2022, 3:21 PMproud-dentist-22844
03/31/2022, 4:09 PMansible-lint
, for example, you need to pass a list of playbooks and/ore roles, not raw tasks or vars files.
Some content types to think about:
• role
(a directory with a certain structure that includes yaml files in certain paths (but would not include something like linter config in the root of the role)
• playbook
yaml and some directories of yaml files alongside it (tasks
, group_vars
, …)
• modules
/ plugins
are python code, so they’ll probably need to be covered by python targets that are depended on by your ansible_sources targets.
• collection
can include all other kinds of ansible content in a certain structure
• inventory
can be yaml, ini, an executable script, or a directory of inventory files.
If you need ideas here’s the list that ansible-lint uses (sadly it doesn’t support collections yet): https://github.com/ansible/ansible-lint/blob/main/src/ansiblelint/config.py#L8-L35proud-dentist-22844
03/31/2022, 4:09 PMwide-midnight-78598
03/31/2022, 4:15 PMargs
otherwise the target API just balloons.
My immediate thought is that, we can pull in `files`/`resources` /`ansible_sources` or whatever as dependencies, and let regular ansible take over as much as possible. The target will mostly be about configuring the deploy
commandwide-midnight-78598
03/31/2022, 4:15 PMproud-dentist-22844
03/31/2022, 4:18 PMwide-midnight-78598
03/31/2022, 4:20 PMcareful-address-89803
03/31/2022, 6:05 PMcopy
with src: "{{ service_name }}.service"
), and there's nothing stopping src: "/home/me/.ssh/id_ed25519.pub"
. Hot take, maybe we shouldn't support that, and enforce a more constrained structure.wide-midnight-78598
03/31/2022, 7:17 PMwide-midnight-78598
03/31/2022, 7:17 PMwide-midnight-78598
04/01/2022, 4:05 AMproud-dentist-22844
04/01/2022, 5:24 AMproud-dentist-22844
04/01/2022, 5:26 AMwide-midnight-78598
04/01/2022, 6:22 AMproud-dentist-22844
04/01/2022, 5:26 PMpants
as an entry point for running lint/fmt (ansible-lint
) test (molecule
) and package (ansible-galaxy collection build
) and possibly deploy (ansible-galaxy collection publish
). (I'm one of the maintainers for these repos)
For these repos, I can't imagine a time when I would have pants
actually run a playbook.fast-nail-55400
04/01/2022, 5:29 PMfmt
/ lint
but leaves applying plans to terraform
and not Pants.wide-midnight-78598
04/01/2022, 8:42 PMfast-nail-55400
04/01/2022, 8:47 PMwide-midnight-78598
04/01/2022, 11:31 PMpip install dopeplugin
kinda thing.
I'm re-vamping a bunch of repos, and a lot of plugins I'm writing have absolutely no utility to the population, but are important for me across projects and repos
I would assume that functionality should be possible, as it's just registering another pluginfast-nail-55400
04/02/2022, 12:00 AMfast-nail-55400
04/02/2022, 12:01 AM[GLOBAL].plugins
option can be set to a Python requirement. For example, in the Pants source we set "toolchain.pants.plugin==0.17.0"
wide-midnight-78598
04/02/2022, 3:00 AMcareful-address-89803
04/05/2022, 3:27 AMwide-midnight-78598
04/05/2022, 4:16 AMcareful-address-89803
04/06/2022, 3:22 PMhundreds-father-404
04/06/2022, 3:23 PMFor python, I think Pants just uses a single universe for all dependencies, so it should be fine to put Galaxy dependencies in the root as well?Now with multiple resolves, you have a universe per resolve
wide-midnight-78598
04/06/2022, 4:21 PMhundreds-father-404
04/06/2022, 4:49 PMwide-midnight-78598
04/06/2022, 4:50 PMcurved-television-6568
04/06/2022, 6:29 PMhundreds-father-404
04/06/2022, 7:16 PM