Optionally setup a swap device.
This commit is contained in:
parent
9f51bcbba2
commit
9244f93dc3
|
@ -49,6 +49,9 @@ additional_disks: false
|
||||||
disks_and_mountpoints_list: []
|
disks_and_mountpoints_list: []
|
||||||
# - { mountpoint: '/data', device: 'xvda3', fstype: 'xfs', opts: 'noatime', state: 'mounted', create_filesystem: True }
|
# - { mountpoint: '/data', device: 'xvda3', fstype: 'xfs', opts: 'noatime', state: 'mounted', create_filesystem: True }
|
||||||
|
|
||||||
|
swap_device: false
|
||||||
|
swap_device_name: /dev/vdxxxxx
|
||||||
|
|
||||||
ansible_python3_debs:
|
ansible_python3_debs:
|
||||||
- python3-lxml
|
- python3-lxml
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,12 @@
|
||||||
- mkcert_create_certificate
|
- mkcert_create_certificate
|
||||||
- name: HTTP client proxy
|
- name: HTTP client proxy
|
||||||
ansible.builtin.import_tasks: http_client_proxy.yml
|
ansible.builtin.import_tasks: http_client_proxy.yml
|
||||||
- name: Manage additiondal disk volumes
|
- name: Manage additional disk volumes
|
||||||
ansible.builtin.import_tasks: additional_disks.yml
|
ansible.builtin.import_tasks: additional_disks.yml
|
||||||
when: additional_disks
|
when: additional_disks
|
||||||
|
- name: Manage a swap device
|
||||||
|
ansible.builtin.import_tasks: swap_device.yml
|
||||||
|
when: swap_device
|
||||||
- name: Manage the autofs configuration
|
- name: Manage the autofs configuration
|
||||||
ansible.builtin.import_tasks: autofs.yml
|
ansible.builtin.import_tasks: autofs.yml
|
||||||
when: autofs_client_mountpoint
|
when: autofs_client_mountpoint
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
- name: swap_device | Configure and enable a swap device
|
||||||
|
when: swap_device
|
||||||
|
tags:
|
||||||
|
- swap
|
||||||
|
- swap_device
|
||||||
|
block:
|
||||||
|
- name: swap_device | Initialize the swap device
|
||||||
|
ansible.builtin.command: mkswap {{ swap_device_name }} && touch /root/.mkswap_executed
|
||||||
|
args:
|
||||||
|
creates: /root/.mkswap_executed
|
||||||
|
register: mkswap_command_execution
|
||||||
|
- name: swap_device | Enable the swap device
|
||||||
|
ansible.builtin.command: swapon {{ swap_device_name }} && touch /root/.swapon_executed
|
||||||
|
args:
|
||||||
|
creates: /root/.swapon_executed
|
||||||
|
|
||||||
|
- name: swap_device | Add the swap device to the fstab file
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /etc/fstab
|
||||||
|
regexp: "^{{ swap_device_name }}"
|
||||||
|
line: "{{ swap_device_name }} swap swap defaults 0 0"
|
Loading…
Reference in New Issue