{"action":"opened","issue":{"url":"https://api.github.com/repos/hashicorp/nomad/issues/2725","repository_url":"https://api.github.com/repos/hashicorp/nomad","labels_url":"https://api.github.com/repos/hashicorp/nomad/issues/2725/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/nomad/issues/2725/comments","events_url":"https://api.github.com/repos/hashicorp/nomad/issues/2725/events","html_url":"https://github.com/hashicorp/nomad/issues/2725","id":237838614,"number":2725,"title":"Recursively template files","user":{"login":"gpaggi","id":7922425,"avatar_url":"https://avatars2.githubusercontent.com/u/7922425?v=3","gravatar_id":"","url":"https://api.github.com/users/gpaggi","html_url":"https://github.com/gpaggi","followers_url":"https://api.github.com/users/gpaggi/followers","following_url":"https://api.github.com/users/gpaggi/following{/other_user}","gists_url":"https://api.github.com/users/gpaggi/gists{/gist_id}","starred_url":"https://api.github.com/users/gpaggi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gpaggi/subscriptions","organizations_url":"https://api.github.com/users/gpaggi/orgs","repos_url":"https://api.github.com/users/gpaggi/repos","events_url":"https://api.github.com/users/gpaggi/events{/privacy}","received_events_url":"https://api.github.com/users/gpaggi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-22T13:03:41Z","updated_at":"2017-06-22T13:03:41Z","closed_at":null,"body":"It would be extremely helpful to be able to have Nomad recursively template all files in a source directory when both source and destinations are directories.\r\n\r\nI'm working on a use case where I have ten(s) of templates that I'm retrieving from github and they all need to be rendered by Nomad in a destination directory; this translates into tens of `template` blocks in my task. I use the same templates in multiple Nomad jobs and I need to edit all HCLs every time I want to add a new template.\r\n\r\nExample of possible solution that would render all files in \"local/templates/\" into \"local/service/\":\r\n\r\n```\r\n[...]\r\ntask \"service\" {\r\n            driver = \"docker\"\r\n            config {\r\n                image = \"xxx\"\r\n                network_mode = \"host\"\r\n                tty = true\r\n\r\n                volumes = [\r\n                    \"local/service/:/etc/service\",\r\n                ]\r\n\r\n            }\r\n             artifact {\r\n                source = \"git::ssh://git@github.com/test/templates\"\r\n                destination = \"local/templates\"\r\n                options {\r\n                    sshkey = \"xxx\"\r\n                }\r\n            }\r\n            template {\r\n                source = \"local/templates/\"\r\n                destination = \"local/service/\"\r\n            }\r\n```\r\n\r\nAt the moment this fails with:\r\n```\r\nfailed to build task's template manager: failed to read template: read /var/lib/nomad/alloc/4d6222ab-d17a-a1e0-8dce-8394b294621f/service/local/templates: is a directory\r\n```\r\n\r\nThanks!"}}
{"actor":{"display_login":"gpaggi"}}