Skip to content

Commit

Permalink
Change working directory for REX in pull mode
Browse files Browse the repository at this point in the history
Also fixed the default working directory, which is now `/run`.

(cherry picked from commit 981af6f)
(cherry picked from commit 51a93d9)
  • Loading branch information
adamlazik1 committed Mar 27, 2024
1 parent f51e3db commit 9b0ee74
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ include::modules/proc_configuring-the-fallback-to-any-smartproxy-remote-executio

include::modules/proc_configuring-the-global-smartproxy-remote-execution-setting-in-project.adoc[leveloffset=+1]

include::modules/proc_configuring-an-alternative-directory-to-execute-remote-jobs-on-clients.adoc[leveloffset=+1]
include::modules/proc_setting-an-alternative-directory-for-remote-execution-jobs-in-push-mode.adoc[leveloffset=+1]

ifeval::["{context}" == "managing-hosts"]
include::modules/proc_setting-an-alternative-directory-for-remote-execution-jobs-in-pull-mode.adoc[leveloffset=+1]
endif::[]

include::modules/proc_altering-the-privilege-elevation-method.adoc[leveloffset=+1]

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[id="setting-an-alternative-directory-for-remote-execution-jobs-in-pull-mode_{context}"]
= Setting an Alternative Directory for Remote Execution Jobs in Pull Mode

By default, {Project} uses the `/run` directory on hosts for remote execution jobs in pull mode.
If the `/run` directory on your host is mounted with the `noexec` flag, {Project} cannot execute remote execution job scripts in this directory.
You can use the `yggdrasild` service to set an alternative directory for executing remote execution jobs in pull mode.

.Procedure
On your host, perform these steps:

. Create a new directory:
+
[options="nowrap", subs="+quotes,verbatim,attributes"]
----
# mkdir _/My_Remote_Working_Directory_
----
. Access the `yggdrasild` service configuration:
+
[options="nowrap", subs="+quotes,verbatim,attributes"]
----
# systemctl edit yggdrasild
----
. Specify the alternative directory by adding the following line to the configuration:
+
[options="nowrap", subs="+quotes,verbatim,attributes"]
----
Environment=FOREMAN_YGG_WORKER_WORKDIR=_/My_Remote_Working_Directory_
----
. Restart the `yggdrasild` service:
+
[options="nowrap", subs="+quotes,verbatim,attributes"]
----
# systemctl restart yggdrasild
----
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[id="setting-an-alternative-directory-for-remote-execution-jobs-in-push-mode_{context}"]
ifeval::["{context}" == "managing-hosts"]
= Setting an Alternative Directory for Remote Execution Jobs in Push Mode

By default, {Project} uses the `/var/tmp` directory on hosts for remote execution jobs in push mode.
If the `/var/tmp` directory on your host is mounted with the `noexec` flag, {Project} cannot execute remote execution job scripts in this directory.
You can use `{foreman-installer}` to set an alternative directory for executing remote execution jobs in push mode.

:rex-default-working-dir: /var/tmp
:installer-change-working-dir-opt: --foreman-proxy-plugin-remote-execution-script-remote-working-dir
:rex-target-machine: host
endif::[]
ifeval::["{context}" == "ansible"]
= Configuring {Project} to Use an Alternative Directory to Execute Remote Jobs on Hosts

Ansible puts its own files it requires on the server side into the `/tmp` directory.
You have the option to set a different directory if required.

:rex-default-working-dir: /tmp
:installer-change-working-dir-opt: --foreman-proxy-plugin-ansible-working-dir
:rex-target-machine: {ProjectServer} or {SmartProxyServer}
endif::[]

.Procedure
. On your {rex-target-machine}, create a new directory:
+
[options="nowrap", subs="+quotes,verbatim,attributes"]
----
# mkdir _/My_Remote_Working_Directory_
----
ifndef::foreman-deb[]
+
. Copy the SELinux context from the default `{rex-default-working-dir}` directory:
+
[options="nowrap", subs="+quotes,verbatim,attributes"]
----
# chcon --reference={rex-default-working-dir} _/My_Remote_Working_Directory_
----
endif::[]
. Configure your {ProjectServer} or {SmartProxyServer} to use the new directory:
+
[options="nowrap", subs="+quotes,verbatim,attributes"]
----
# {foreman-installer} \
{installer-change-working-dir-opt} _/My_Remote_Working_Directory_
----

:!rex-default-working-dir:
:!installer-change-working-dir-opt:
:!rex-target-machine:

0 comments on commit 9b0ee74

Please sign in to comment.