Is there a `./pants deploy {target}` somewhere? I ...
# general
w
Is there a
./pants deploy {target}
somewhere? I could swear I saw that at some point in the past - but now I feel like I'm making it up
h
There is publish, with support for
docker_image
and experimental support for PYthon via Twine https://www.pantsbuild.org/v2.10/docs/python-publish-goal
w
Ah! That's what it was, thanks! I thought I was going mad with sleep deprivation just now, I knew there was some command. I'm working on an ansible plugin, so that would fall under publish I believe (or deploy, if it existed)
c
Yeah, ansible would make more sense under a
deploy
goal, I think.
👍 2
w
Well, if there are any fellow ansible users - I'd gladly take API suggestions. I'm a simple ansible-playbook + inventory kinda guy. Meat and potatoes
h
Ha, this actually came up in a podcast episode Andreas, Stu, and I recorded yesterday for Podcast.init! That right now we don't support
deploy
, but we'd be willing to consider it
w
Oh, ha! That's pretty good timing. Deployment is a huge part of my workflow, and currently, it's the only thing I need to do "separate" from pants. Not the end of the world, but just feels a bit wasteful. Deploying docker images to servers, deploying systemd services, pexes, (soon pyox'd binaries), etc. Ansible to control all of it, and doing a simple
./pants deploy :project
would be dope
c
oh hey, I was going to start working on an Ansible plugin for pants.
publish
makes more sense for Collections, which are the package format for Ansible roles and plugins. I agree that having a tool to serve as a convenient entrypoint for Ansible playbooks would be great. It doesn't take a lot of infrastructure before there's a huge readme with the commands you need to copy-paste.
👍 2
c
Indeed,
publish
makes sense to integrate with Ansible Galaxy, while
deploy
would make sense in order to execute a playbook.
w
@careful-address-89803 How far along have you gotten? I've just created the deploy command and was starting work on the Ansible-specific API portion.
c
I haven't started yet. If you've got a repo and are open to collaborating link/DM me
👍 1
w
Nothing pushed yet, I want to get a do-nothing target in place first https://github.com/sureshjoshi/pants-plugins/tree/4-prototype-ansible-plugin
👍 1
(hopefully tonight)
@careful-address-89803 https://github.com/sureshjoshi/pants-plugins/blob/4-prototype-ansible-plugin/pants-plugins/experimental/ansible/README.md There is a do-nothing deploy command (literally does nothing), and a
check
command for the
ansible_deployment
target. It just runs ansible's syntax-check on the playbook (though, now that I'm thinking about it, perhaps that should be a lint command). Whatever. I kinda read through the Docker, Terraform, and Shell stuff to get some ideas on how Ansible should look eventually. As you mentioned earlier,
publish
would be good for getting roles up to the galaxy. Open to any/all API ideas, as right now, I'm only thinking in the workflows I use day-to-day, which are pretty narrow.
Copy code
ansible_deployment(
    name="helloansible",
    dependencies=[""],
    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="",
)
c
Excited to see ansible support shaping up.
c
with a tool with as many options as ansible, I'd make sure to provide an
extra_args
field. Collections support has a few tasks. There are also ansible-test and ansible-lint for checking. There's also a lot of work to do for finding files to include. Ansible is very helpful in finding these, checking in many places, so what's a valid/reachable file to include as a source is either a lot of work or an opinionated subset haha
👍 1