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: add swap for release-osuosl-rhel8-arm64-1 #3522

Merged
merged 2 commits into from
Oct 17, 2023
Merged
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
6 changes: 5 additions & 1 deletion ansible/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ hosts:
server_jobs: 6
centos7-arm64-1: {ip: 140.211.169.7, server_jobs: 2, user: centos}
centos7-ppc64_le-1: {ip: 140.211.168.61, user: centos}
rhel8-arm64-1: {ip: 140.211.169.58, server_jobs: 2, user: cloud-user}
rhel8-arm64-1:
ip: 140.211.169.58
server_jobs: 2
user: cloud-user
swap_file_size_mb: 4096
rhel8-ppc64_le-1: {ip: 140.211.168.185, user: cloud-user}

- orka:
Expand Down
40 changes: 40 additions & 0 deletions ansible/roles/bootstrap/tasks/partials/linux-swap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---

#
# Creates a swap file on Linux.
# Assumes swap_file_size_mb has been set.
#

- name: create swapfile
ansible.builtin.command:
cmd: dd if=/dev/zero of=/{{ swap_file }} bs=1M count={{ swap_file_size_mb }}
creates: "{{ swap_file }}"
become: yes
become_user: root
register: swap_create

- name: set swapfile permissions
ansible.builtin.file:
group: root
mode: 0600
owner: root
path: "{{ swap_file }}"

- name: set up swap area
ansible.builtin.command:
cmd: mkswap {{ swap_file }}
when: swap_create.changed

- name: enable swap
ansible.builtin.command:
cmd: swapon {{ swap_file }}
when: swap_create.changed

- name: add swap to fstab
ansible.posix.mount:
fstype: swap
opts: defaults
path: swap
src: "{{ swap_file }}"
state: present
when: swap_create.changed
4 changes: 4 additions & 0 deletions ansible/roles/bootstrap/tasks/partials/rhel8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@
activationkey: "{{ secrets.rh_activationkey }}"
org_id: "{{ secrets.rh_org }}"
state: present

- name: set up swap on Linux
include_tasks: linux-swap.yml
when: swap_file_size_mb is defined
1 change: 1 addition & 0 deletions ansible/roles/bootstrap/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
autologon_regpath: 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'
swap_file: /swapfile