I have a project using vcsrepo in puppet to copy to a server using puppet. So the entire git project copied down. I can limit it to just latest with depth=1.
vcsrepo {$docroot:
ensure => latest,
provider => git,
source => 'git@www.github.com:my-repo.git',
revision => 'mytag'
depth => 1
etc.
}
Ideally, I would like only the /mysubdirectory from the my-repo git repo copied to $docroot directory on the server.
This example shows what I think could work: How do I clone a subdirectory only of a Git repository? But it doesn't seem to be enough puppet options.
Or is there another approach:
Essentially copy git project somewhere else on the server and then copy the files from .git directory to the $docroot. I still just want the src that is attached to the mytag in git. (I technically don't need the git features such as push or pull repository on the server).
How would I do that with puppet code?
I do not want to use exec (or equivalent).
UPDATE:
I should have started by saying I am a git and puppet newbie. The purpose and reason I am doing this is I have a git project called myproject. In the project is a subdirectory called /src. In the git repository are tags like "mytag-20170517" and mytag-201705018". When I add the property revision=>'mytag' it copies the proper files, but it brings over too many files.
myproject\
file-i-do-NOT-want-puppet-to-copy1.txt (tagged with mytag-2017-0518)
file-i-do-NOT-want-puppet-to-copy2.txt (tagged with mytag-2017-0518)
src\
file-i-DO-want-puppet-to-copy1.txt (tagged with mytag-2017-0518)
file-i-DO-want-puppet-to-copy2.txt (tagged with mytag-2017-0518)
Currently with vcsrepo it would copy ALL directories including the root files to my target server using puppet. Ideally, ONLY the files starting from /src. The files in the root of src are the files I want in the root of $docroot.
How do I solve that problem?