ansible.js 750 B

123456789101112131415161718192021222324252627282930313233
  1. import { Manager } from '@/utils/manager'
  2. export default class ansible {
  3. constructor (ansiblePlaybookId) {
  4. this.state = {}
  5. this.ansiblePlaybookId = ansiblePlaybookId
  6. this.managerAnsibleplaybooks = new Manager('ansibleplaybooks')
  7. }
  8. stop () {
  9. if (this.ansiblePlaybookId) {
  10. return this.managerAnsibleplaybooks.performAction({
  11. id: this.ansiblePlaybookId,
  12. action: 'stop',
  13. })
  14. }
  15. }
  16. run () {
  17. if (this.ansiblePlaybookId) {
  18. return this.managerAnsibleplaybooks.performAction({
  19. id: this.ansiblePlaybookId,
  20. action: 'run',
  21. })
  22. }
  23. }
  24. get () {
  25. if (this.ansiblePlaybookId) {
  26. return this.managerAnsibleplaybooks.get({ id: this.ansiblePlaybookId })
  27. }
  28. }
  29. }