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

ansible: Allow passing tmpfs options #112

Merged
merged 1 commit into from
Dec 16, 2023
Merged

Conversation

chantra
Copy link
Collaborator

@chantra chantra commented Dec 12, 2023

Currently, the only option passed to tmpfs is exec so tmpfs is mounted with "exec" option.
We may need to pass extra options on some runners, like setting the size of tmpfs for instance (docker seems to default to 50% of the host memory), and only on specific hosts, so we need this to be somwhat configurable.

Add a new variable runner_tmpfs_options which defaults to ['exec'] and can be overridden at the host/group level.

Test, after setting a host to use:

        runner_tmpfs_options:
          - exec
          - size=12G

running ansible in dry-run mode:

--- before: /etc/systemd/system/[email protected]
+++ after:
/home/chantra/.ansible/tmp/ansible-local-3819115bni8m1fy/tmp65ktafym
@@ -15,7 +15,7 @@
             --health-cmd='(ss -ntp -H dport = :443 | grep -q ESTAB) ||
exit 1' \
 --health-start-period=60s --health-interval=30s \
 --health-timeout=5s --health-retries=3 \
-            --tmpfs /tmp/work:exec \
+            --tmpfs /tmp/work:exec,size=12G \
             --rm \
             --env-file
"/etc/actions-runner/actions-runner-kernel-patches-worker-%i.env" \
             --env-file
"/etc/actions-runner/actions-runner-kernel-patches-worker-%i-ghtoken.env"
\

And for a hosts with no override, running ansible does not chasnge anything.

Currently, the only option passed to tmpfs is `exec` so tmpfs is mounted
with "exec" option.
We may need to pass extra options on some runners, like setting the size
of tmpfs for instance (docker seems to default to 50% of the host
memory), and only on specific hosts, so we need this to be somwhat
configurable.

Add a new variable `runner_tmpfs_options` which defaults to `['exec']`
and can be overridden at the host/group level.

Test, after setting a host to use:
```
        runner_tmpfs_options:
          - exec
          - size=12G
```

running ansible in dry-run mode:
```
--- before: /etc/systemd/system/[email protected]
+++ after:
/home/chantra/.ansible/tmp/ansible-local-3819115bni8m1fy/tmp65ktafym
@@ -15,7 +15,7 @@
             --health-cmd='(ss -ntp -H dport = :443 | grep -q ESTAB) ||
exit 1' \
 --health-start-period=60s --health-interval=30s \
 --health-timeout=5s --health-retries=3 \
-            --tmpfs /tmp/work:exec \
+            --tmpfs /tmp/work:exec,size=12G \
             --rm \
             --env-file
"/etc/actions-runner/actions-runner-kernel-patches-worker-%i.env" \
             --env-file
"/etc/actions-runner/actions-runner-kernel-patches-worker-%i-ghtoken.env"
\

```

And for a hosts with no override, running ansible does not chasnge
anything.

Signed-off-by: Manu Bretelle <[email protected]>
@chantra chantra merged commit b17e815 into libbpf:main Dec 16, 2023
2 checks passed
@chantra chantra deleted the ansible_more_mem branch December 18, 2023 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant