Skip to content

Commit

Permalink
Add info about Ansible playbook import
Browse files Browse the repository at this point in the history
  • Loading branch information
Lennonka committed Apr 9, 2024
1 parent f524e2b commit 702ba93
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@
= Importing all available Ansible playbooks

You can import all the available Ansible playbooks to {Project} from collections installed on {SmartProxy}.
{Project} creates job templates from the imported playbooks and places the templates in the `Ansible Playbook - Imported` job category.

If you have a custom collection, place it in `/etc/ansible/collections/ansible_collections/_My_Namespace_/_My_Collection_`.

.Prerequisites
* Ansible plugin in {Project} is enabled
* Ansible plugin is enabled.
* Your {Project} account has a role that grants the `import_ansible_playbooks` permission.

.Procedure
// Not available via Hammer/UI: https://projects.theforeman.org/issues/34318
* Import the Ansible playbooks using the following API request:
* Import the Ansible playbooks by using the following API request:
+
[options="nowrap", subs="+quotes,verbatim,attributes"]
----
# curl -X PUT 'Content-Type: application/json' https://_{foreman-example-com}_/ansible/api/v2/ansible_playbooks/sync?proxy_id=_My-{smart-proxy-context}-ID_
# curl -X PUT -H 'Content-Type: application/json' https://_{foreman-example-com}_/ansible/api/v2/ansible_playbooks/sync?proxy_id=__My_{smart-proxy-context}_ID__
----
+
You get a notification in the {ProjectWebUI} after the import completes.

.Next steps
* You can run the playbooks by executing a remote job from the created job templates.
For more information, see xref:executing-a-remote-job_{context}[].
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,32 @@
= Importing an Ansible playbook by name

You can import Ansible playbooks by name to {Project} from collections installed on {SmartProxy}.
{Project} creates a job template from the imported playbook and places the template in the `Ansible Playbook - Imported` job category.

If you have a custom collection, place it in `/etc/ansible/collections/ansible_collections/_My_Namespace_/_My_Collection_`.

.Prerequisites
* Ansible plugin in {Project} is enabled
* Ansible plugin is enabled.
* Your {Project} account has a role that grants the `import_ansible_playbooks` permission.

.Procedure
// Not available via Hammer/UI: https://projects.theforeman.org/issues/34318
. Fetch the available Ansible playbooks using the following API request:
. Fetch the available Ansible playbooks by using the following API request:
+
[options="nowrap", subs="+quotes,verbatim,attributes"]
----
# curl -X GET 'Content-Type: application/json' https://_{foreman-example-com}_/ansible/api/v2/ansible_playbooks/fetch?proxy_id=_My_{smart-proxy-context}_ID_
# curl -X GET -H 'Content-Type: application/json' https://_{foreman-example-com}_/ansible/api/v2/ansible_playbooks/fetch?proxy_id=__My_{smart-proxy-context}_ID__
----
. Select the Ansible playbook you want to import and note its name.
. Import the Ansible playbook using its name:
. Import the Ansible playbook by its name:
+
[options="nowrap", subs="+quotes,verbatim,attributes"]
----
# curl -X PUT 'Content-Type: application/json' -d '{ "playbook_names": ["_My_Playbook_Name_"] }' https://_{foreman-example-com}_/ansible/api/v2/ansible_playbooks/sync?proxy_id=_My_{smart-proxy-context}_ID_
# curl -X PUT -H 'Content-Type: application/json' -d '{ "playbook_names": ["_My_Playbook_Name_"] }' https://_{foreman-example-com}_/ansible/api/v2/ansible_playbooks/sync?proxy_id=__My_{smart-proxy-context}_ID__
----
+
You get a notification in the {ProjectWebUI} after the import completes.

.Next steps
* You can run the playbook by executing a remote job from the created job template.
For more information, see xref:executing-a-remote-job_{context}[].

0 comments on commit 702ba93

Please sign in to comment.