os.yaml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. tasks:
  2. # Generic tasks
  3. bash:
  4. desc: Interactive prompt
  5. run: "bash"
  6. create-dir:
  7. desc: Add a new directory
  8. run: "mkdir -p {path}"
  9. symlink:
  10. desc: Create symlink
  11. run: |
  12. if test ! -e {to}
  13. then ln -s {from} {to}
  14. fi
  15. mount:
  16. run: mount | grep ' {path} ' &> /dev/null || mount {path}
  17. move:
  18. desc: Move a file or directory
  19. run: |
  20. if test ! -e {to}
  21. then mv {from} {to}
  22. fi
  23. copy:
  24. desc: Copy a file or directory
  25. run: |
  26. if test -f {from}
  27. then cp {from} {to}
  28. else cp -Tr {from} {to}
  29. fi
  30. remove:
  31. desc: Remove (-r) path
  32. run: "rm -r {path}"
  33. chown:
  34. desc: Chown a file or directory
  35. run: "chown -R {user}. {path}"
  36. chmod:
  37. desc: Chmod a file or directory
  38. run: "chmod -R {mode} {path}"
  39. apt-install:
  40. desc: Run apt install
  41. run: apt update && apt install -y {packages}
  42. sudo: true
  43. systemctl:
  44. desc: Call systemctl
  45. run: systemctl {action} {service}
  46. sudo: true
  47. send:
  48. desc: Send a file or a directory
  49. send: "{send}"
  50. to: "{to}"
  51. sudo-send:
  52. desc: Combine send & sudo-move
  53. multi:
  54. - task: send
  55. env:
  56. to: "/tmp/{tmppath}"
  57. - task: copy
  58. sudo: true
  59. env:
  60. from: "/tmp/{tmppath}"
  61. - task: remove
  62. env:
  63. path: "/tmp/{tmppath}"
  64. parted:
  65. desc: Create primary partition && mkfs
  66. sudo: true
  67. run: |
  68. if test ! -e {device}1
  69. then
  70. parted {device} -a optimal --script mklabel gpt mkpart primary 0% 100%
  71. sleep 1
  72. mkfs -t ext4 {device}1
  73. fi
  74. append-line:
  75. desc: Append line to file
  76. run: >-
  77. grep {guard} {file} &> /dev/null
  78. || echo {line} >> {file}
  79. add-user:
  80. desc: Add a new user
  81. run: id {user} || sudo adduser {user} --disabled-login --gecos ""