Refactor, implement inventory, add examples
This commit is contained in:
parent
d16df7616f
commit
54b6fd0377
17 changed files with 373 additions and 483 deletions
29
examples/install-aws-cli.scm
Normal file
29
examples/install-aws-cli.scm
Normal file
|
@ -0,0 +1,29 @@
|
|||
(use-modules
|
||||
(ice-9 filesystem)
|
||||
(ordo))
|
||||
|
||||
(define* (install-aws-cli conn #:key (url "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip") update? install-dir bin-dir)
|
||||
(let ((tmp-dir (run conn "mktemp" "-d" #:return car #:check? #t)))
|
||||
(dynamic-wind
|
||||
(const #t)
|
||||
(lambda ()
|
||||
(let ((zipfile (file-name-join* tmp-dir (file-basename url))))
|
||||
(run conn "wget" "-O" zipfile url #:check? #t)
|
||||
(run conn "unzip" zipfile "-d" tmp-dir #:check? #t)
|
||||
(run conn (file-name-join* tmp-dir "aws" "install")
|
||||
(when install-dir `("-i" ,install-dir))
|
||||
(when bin-dir `("-b" ,bin-dir))
|
||||
(when update? "-u")
|
||||
#:check? #t)))
|
||||
(lambda ()
|
||||
(run conn "rm" "-rf" tmp-dir #:check? #t)))))
|
||||
|
||||
(playbook "Test Playbook"
|
||||
(play "Test play"
|
||||
#:host "localhost"
|
||||
(task "Install AWS CLI"
|
||||
(lambda (c)
|
||||
(install-aws-cli c
|
||||
#:update? #t
|
||||
#:install-dir (file-name-join* ($ #:fact.home-dir) ".local" "aws-cli")
|
||||
#:bin-dir (file-name-join* ($ #:fact.home-dir) ".local" "bin"))))))
|
14
examples/inventory.scm
Normal file
14
examples/inventory.scm
Normal file
|
@ -0,0 +1,14 @@
|
|||
(use-modules (ordo inventory)
|
||||
(ordo connection))
|
||||
|
||||
(add-host! "little-rascal"
|
||||
(local-connection)
|
||||
#:linux #:guix)
|
||||
|
||||
(add-host! "screw-loose"
|
||||
(ssh-connection "core" "screw-loose")
|
||||
#:linux #:coreos)
|
||||
|
||||
(add-host! "limiting-factor"
|
||||
(ssh-connection "core" "limiting-factor")
|
||||
#:linux #:coreos)
|
Loading…
Add table
Add a link
Reference in a new issue