Skip to content

Commit

Permalink
Document VCS integration in foreman_ansible plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorben-D committed Mar 28, 2024
1 parent e533fa8 commit fd51ddb
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
4 changes: 4 additions & 0 deletions guides/common/assembly_getting-started-with-ansible.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ include::modules/proc_configuring-your-project-to-run-ansible-roles.adoc[levelof

include::modules/proc_enabling-ansible-integration-with-project.adoc[leveloffset=+1]

include::modules/proc_setting-up-ansible-vcs-integration.adoc[leveloffset=+1]

include::modules/proc_cloning-ansible-roles-from-vcs.adoc[leveloffset=+1]

include::modules/proc_importing-ansible-roles-and-variables.adoc[leveloffset=+1]

include::modules/proc_overriding-ansible-variables-in-project.adoc[leveloffset=+1]
Expand Down
24 changes: 24 additions & 0 deletions guides/common/modules/proc_cloning-ansible-roles-from-vcs.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[id="cloning-ansible-roles-from-vcs-{context}"]
= Cloning Ansible roles from VCS

You can clone Ansible roles to your {SmartProxy} from the {ProjectWebUI}.

.Prerequisites
* A {SmartProxy} with VSC integration for Ansible.
For more information, see xref:setting-up-vsc-integration-for-ansible_{context}[].

.Procedure
. In the {ProjectWebUI}, navigate to *Configure* > *Ansible* > *Roles*
. Click on `Clone from VCS...` in the toolbar.
Follow the wizard to clone an Ansible role from VCS.

Note: Currently, only links using *HTTPS* are supported

* Click *Examine* to select a git revision from the list of branches and tags.
* Select *Skipping existing* to overwrite existing Ansible roles on your {SmartProxy}.
. Click *Confirm* to clone your Ansible role from VCS to your {SmartProxy}.

.Next steps
* {Project} starts a task called `Clone Ansible role from VCS`.
For more information, see {AdministeringDocURL}Managing_Tasks_admin[Managing Tasks] in _{AdministeringDocTitle}_.
* Proceed with xref:Importing_Ansible_Roles_and_Variables_{context}[] after the task has finished successfully.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ endif::[]
* `/usr/share/ansible/roles`
* `/etc/ansible/collections`
* `/usr/share/ansible/collections`
* `(optional) VCS_INTEGRATION_PATH/ansible/roles`

Roles and collections from installed packages are placed under `/usr/share/ansible`.
If you want to add custom roles or collections, place them under `/etc/ansible`.
Expand Down
46 changes: 46 additions & 0 deletions guides/common/modules/proc_setting-up-ansible-vcs-integration.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[id="setting-up-vsc-integration-for-ansible_{context}"]
= Setting up VCS integration for Ansible

With VCS integration, you can clone Ansible roles from any remote git repository directly from the {ProjectWebUI}.

.Procedure
. Create the default directory:
+
----
# mkdir -p /var/lib/foreman-proxy/ansible/roles
----
. Assign the correct permissions:
+
----
# chmod -R 060 /var/lib/foreman-proxy/ansible/roles
----
. Add the directory to the group `foreman-proxy`:
+
----
# chgrp -R foreman-proxy /var/lib/foreman-proxy/ansible/roles
----

.Optional
You may also choose a different directory to clone the roles into:

* Create the directory:
+
----
mkdir -p CUSTOM_DIRECTORY/ansible/roles
----
* Assign the correct permissions and group as above
* Pass `CUSTOM_DIRECTORY` to your {SmartProxy} via the environment variable `STATE_DIR`
+
----
STATE_DIR=CUSTOM_DIRECTORY
----

Finally, you need to enable `vcs_integration` in the {SmartProxy} settings

.Procedure
* Append the following line `/etc/foreman-proxy/settings.d/ansible.yml`:
+
[source, yaml, options="nowrap", subs="verbatim,quotes,attributes"]
----
:vcs_integration: true
----

0 comments on commit fd51ddb

Please sign in to comment.