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:

  1. do checkout on machine runs ansible (local_action) , use copy module
  2. do checkout on remote node (with git module), copy files desired location command: cp src dest creates=dest (perhaps handler - when repo has changes pulled)
  3. 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?
  4. 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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -