Some simplifications
This commit is contained in:
parent
e22e618142
commit
8a1e1b244f
8 changed files with 78 additions and 27 deletions
34
examples/basic.scm
Normal file
34
examples/basic.scm
Normal file
|
@ -0,0 +1,34 @@
|
|||
(use-modules
|
||||
(ice-9 filesystem)
|
||||
(ice-9 pretty-print)
|
||||
(logging logger)
|
||||
(ordo)
|
||||
(ordo action filesystem))
|
||||
|
||||
(playbook
|
||||
#:name "Basic filesystem operations"
|
||||
#:plays (list
|
||||
(play
|
||||
#:name "Temporary files on localhost"
|
||||
#:host "localhost"
|
||||
#:tasks (list
|
||||
(task #:name "Create temporary directory"
|
||||
#:action (lambda () (fs:create-tmp-dir (current-connection)))
|
||||
#:register-play-var #:tmp-dir)
|
||||
|
||||
(task #:name "Create hello.txt"
|
||||
#:action (lambda () (fs:install-file (current-connection)
|
||||
(file-name-join* ($ #:tmp-dir) "hello.txt")
|
||||
#:content "Hello, world!"))
|
||||
#:register-play-var #:hello)
|
||||
|
||||
(task #:name "Stat hello.txt"
|
||||
#:action (lambda () (fs:stat (current-connection) ($ #:hello)))
|
||||
#:register-play-var #:hello-stat)
|
||||
|
||||
(task #:name "Debug variables"
|
||||
#:action (lambda ()
|
||||
(pretty-print (list #:hello ($ #:hello) #:hello-stat ($ #:hello-stat)))))
|
||||
|
||||
(task #:name "Clean up tmp dir"
|
||||
#:action (lambda () (fs:remove (current-connection) ($ #:tmp-dir) #:recurse? #t #:verbose? #t)))))))
|
|
@ -19,10 +19,15 @@
|
|||
(lambda ()
|
||||
(run conn "rm" "-rf" tmp-dir)))))
|
||||
|
||||
(playbook "Test Playbook"
|
||||
(play "Test play"
|
||||
#:host "localhost"
|
||||
(task
|
||||
(install-aws-cli #:update? #t
|
||||
#:install-dir (file-name-join* ($ #:fact.home-dir) ".local" "aws-cli")
|
||||
#:bin-dir (file-name-join* ($ #:fact.home-dir) ".local" "bin")))))
|
||||
(playbook
|
||||
#:name "Test Playbook"
|
||||
#:plays (list
|
||||
(play
|
||||
#:name "Test play"
|
||||
#:host "localhost"
|
||||
#:tasks (list
|
||||
(task #:name "Install AWS CLI"
|
||||
#:action (lambda ()
|
||||
(install-aws-cli #:update? #t
|
||||
#:install-dir (file-name-join* ($ #:fact.home-dir) ".local" "aws-cli")
|
||||
#:bin-dir (file-name-join* ($ #:fact.home-dir) ".local" "bin"))))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue