Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document VCS integration in foreman_ansible plugin #2920

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 that you can only clone Ansible roles through `http` and `https`.

* Click *Examine* to select a git revision from the list of branches and tags.
* Toggle between *Skipping existing* and *Update existing* to allow {Project} to override a given role if it is already present on the {SmartProxy}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Toggle between *Skipping existing* and *Update existing* to allow {Project} to override a given role if it is already present on the {SmartProxy}.
* Toggle between *Skipping existing* and *Update existing* to allow {Project} to override a given role if it is already present on your {SmartProxy}.

. Click *Confirm* to clone Ansible roles 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`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where does "VCS_INTEGRATION_PATH" come from? Is this something a user has to replace?


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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For nightly, I think these manualy steps are more or less OK. For the next release, I think it would be best to do this via foreman-installer.

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
----
Loading