ansible - delete unmanaged files from directory?

前端 未结 7 1933
情深已故
情深已故 2021-01-30 06:38

I want to recursively copy over a directory and render all .j2 files in there as templates. For this I am currently using the following lines:

7条回答
  •  有刺的猬
    2021-01-30 07:22

    Apparently this isn't possible with ansible at the moment. I had a conversation with mdehaan on IRC and it boils down to ansible not having a directed acyclic graph for resources, making things like this very hard.

    Asking mdehaan for an example e.g. authoritatively managing a sudoers.d directory he came up with these things:

    14:17 < mdehaan> Robe: http://pastebin.com/yrdCZB0y
    14:19 < Robe> mdehaan: HM
    14:19 < Robe> mdehaan: that actually looks relatively sane
    14:19 < mdehaan> thanks :)
    14:19 < Robe> the problem I'm seeing is that I'd have to gather the managed files myself
    14:19 < mdehaan> you would yes
    14:19 < mdehaan> ALMOST
    14:20 < mdehaan> you could do a fileglob and ... well, it would be a little gross
    [..]
    14:32 < mdehaan> eh, theoretical syntax, nm
    14:33 < mdehaan> I could do it by writing a lookup plugin that filtered a list
    14:34 < mdehaan> http://pastebin.com/rjF7QR24
    14:34 < mdehaan> if that plugin existed, for instance, and iterated across lists in A that were also in B
    

提交回复
热议问题