local_action using remote file content

74 views
Skip to first unread message

bryan hunt

unread,
Dec 31, 2013, 9:35:05 AM12/31/13
to ansible...@googlegroups.com

Hi there,

It's my intention to write a bitbucket module for Ansible.

The use case is :

Create a local VM using vagrant, provisioned by Ansible.

Using Ansible:

1 Generate a SSH key-pair on that machine.

2 Take the freshly generated Public Key and load it into my Bitbucket account, using the bitbucket-api python module.

3 Check out a bunch of projects that I want R/W access to from within the VM.

Then I vagrant ssh into that box, and profit!

I've got most of the pieces worked out, but have a couple of questions regarding approach.

I'd like to create a proper Ansible module to handle B itb uc ket but for now I'd like to just create a quick script.

I believe local_action is the syntax to use for running commands on my local machine.

Now, I could fetch the ~/.ssh/id_pub.rsa file from the remote VM, and store it on my hard drive somewhere like /tmp/vm.id_pub.rsa,
but ideally I'd like to either pipe it into the script I'm going to write or supply it as a quoted command line argument.

Can this be done (taking the entire contents of a remote file and storing it into a variable) ?

Bryan

















Michael DeHaan

unread,
Dec 31, 2013, 10:02:56 AM12/31/13
to ansible...@googlegroups.com
Seeing you said "module", why is the hg module not sufficient for talking to bitbucket?




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Michael DeHaan <mic...@ansibleworks.com>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/

bryan hunt

unread,
Dec 31, 2013, 10:09:13 AM12/31/13
to ansible...@googlegroups.com

Not for performing VCS tasks but for talking directly to the bitbucket rest API.

http://restbrowser.bitbucket.org

In order to add the ssh keys from the freshly created VM instance.

POST https://bitbucket.org/api/1.0/users/{accountname}/ssh-keys/

Capi Etheriel

unread,
Jan 12, 2015, 11:48:47 AM1/12/15
to ansible...@googlegroups.com
did you write the module?

btw, for cloning it should be enough to support deploy keys.
Reply all
Reply to author
Forward
0 new messages