Class: Api::V2::AnsiblePlaybooksController
- Inherits:
-
BaseController
- Object
- BaseController
- Api::V2::AnsiblePlaybooksController
- Includes:
- Api::Version2, ForemanAnsible::ProxyAPI
- Defined in:
- app/controllers/api/v2/ansible_playbooks_controller.rb
Overview
API controller for Ansible Roles
Instance Method Summary collapse
- #action_permission ⇒ Object
- #fetch ⇒ Object
- #plan_ansible_sync(proxy_id, playbooks_names) ⇒ Object
- #sync ⇒ Object
Instance Method Details
#action_permission ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'app/controllers/api/v2/ansible_playbooks_controller.rb', line 32 def case params[:action] when 'sync', 'fetch' :import else super end end |
#fetch ⇒ Object
27 28 29 30 |
# File 'app/controllers/api/v2/ansible_playbooks_controller.rb', line 27 def fetch fetched = fetch_playbooks_names render :json => { :results => { :playbooks_names => fetched } } end |
#plan_ansible_sync(proxy_id, playbooks_names) ⇒ Object
41 42 43 |
# File 'app/controllers/api/v2/ansible_playbooks_controller.rb', line 41 def plan_ansible_sync(proxy_id, playbooks_names) ForemanTasks.async_task(ImportPlaybooksJob::Async::SyncPlaybooks, proxy_id, playbooks_names) end |
#sync ⇒ Object
20 21 22 |
# File 'app/controllers/api/v2/ansible_playbooks_controller.rb', line 20 def sync @task = plan_ansible_sync(@proxy.id, playbooks_names) end |