Ask Your Question

How to call Teamcity API through Puppet Module

asked 2016-09-19 07:36:11 -0500

ChetAn P gravatar image

Hi All,

I have Puppet Master and Windows agent server. I have installed Teamcity CI application, I have to make the Teamcity below REST api automation through Puppet . Below are the API that I want to in Puppet Module, How we can do ?

  1. curl -u admin:password \ -X POST \ -d 'test-project1' \ -H 'Content-Type: text/plain' \ http://teamcity:8111/httpAuth/app/res...

  2. curl -u admin:password \ -H "Content-Type: application/xml" \ -d @vcs-root.xml \ -X POST \ http://teamcity:8111/httpAuth/app/res...

I have question, How to make it automatically through Puppet ?

edit retag flag offensive close merge delete


What are you trying to do automatically? Have a puppet module pull from the latest from CI? Report something to CI, Trigger something? Have your CI trigger puppet? Sorry for my Teamcity rest endpoint ignorance.

DarylW gravatar imageDarylW ( 2016-09-19 08:18:19 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-09-19 13:30:57 -0500

lupin gravatar image

updated 2016-09-19 13:31:49 -0500

You can wrap that curl command inside an Exec resource.i.e

exec { 'post_to_proj':
   commands => "'/<path_to>/curl -u admin:password -X POST \ -d test-project1  -H 'Content-Type: text/plain' http://teamcity:8111/httpAuth/app/<uri>'",
   onlyif => '<condition>',

The downside of this approach is you need to make sure that the value of onlyif parameter prevent the commands executing unnecessarily.

edit flag offensive delete link more


Hi All, Is there any way to call REST API in Puppet Module ? If yes, How ? with one example.

ChetAn P gravatar imageChetAn P ( 2016-09-20 07:13:28 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-09-19 07:36:11 -0500

Seen: 31 times

Last updated: Sep 19 '16