deployment - Using Ansible to download a single file from a private github repo to a remote host -
example scenario: config files service kept under version control on private github repo. want write playbook fetches 1 of these files on remote node , puts desired location.
i can think of several solutions this:
- do checkout on machine runs ansible (
local_action
) , usecopy
module - do checkout on remote node (with
git
module), copy files desired locationcommand: cp src dest creates=dest
(perhaps handler - when repo has changes pulled) - use url module or
command: wget https://raw.github.com/repo/.../file creates=file
in playbook download file of interest.command
module going check if file created different 1 may exist or check file exists? - use wget on machine runs ansible (
local_action
) , use copy module push remote node
what advantages/disadvantages of these. (if any) of these considered practice. best general solution this?
i'll start saying chose 2nd solution our production environment , guarantee 1 thing - works. longer version:
solution no. 1:
- simple , robust - work
- does not "contaminate" production servers irrelevant files (other configuration files)
- does not load production servers i/o github (probably negligible)
solution no. 2:
- simple , robust - work
- to reduce contamination, clone configuration repo /tmp , delete @ end of playbook
solution no. 3/4:
my guess work, feels bit strange have configuration in source control , not using source control features. advantage of these solutions can "cherry pick" configuration files want download rather cloning whole repository. reduces i/o against github cloning becomes heavier on time.
Comments
Post a Comment