Skip to content
Open
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
5 changes: 0 additions & 5 deletions amazon-amd64-nix.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ source "amazon-ebssurrogate" "source" {
build {
sources = ["source.amazon-ebssurrogate.source"]

provisioner "file" {
source = "ebssurrogate/files/sources.cfg"
destination = "/tmp/sources.list"
}

provisioner "file" {
source = "ebssurrogate/files/ebsnvme-id"
destination = "/tmp/ebsnvme-id"
Expand Down
5 changes: 0 additions & 5 deletions amazon-arm64-nix.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ source "amazon-ebssurrogate" "source" {
build {
sources = ["source.amazon-ebssurrogate.source"]

provisioner "file" {
source = "ebssurrogate/files/sources-arm64.cfg"
destination = "/tmp/sources.list"
}

provisioner "file" {
source = "ebssurrogate/files/ebsnvme-id"
destination = "/tmp/ebsnvme-id"
Expand Down
18 changes: 5 additions & 13 deletions ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,25 +141,12 @@
when: not stage2
import_tasks: tasks/setup-fail2ban.yml

# Install EC2 instance connect
# Only for AWS images
- name: install EC2 instance connect
when: not qemu
become: yes
apt:
pkg:
- ec2-instance-connect
tags:
- aws-only

# Install this at the end to prevent it from kicking in during the apt process, causing conflicts
- name: Install security tools
become: yes
apt:
pkg:
- unattended-upgrades
update_cache: yes
cache_valid_time: 3600

- name: Run migrations
when: stage2
Expand Down Expand Up @@ -212,3 +199,8 @@
become: yes
shell: |
sudo -u ubuntu bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix-collect-garbage -d"

- name: Setup Swap
when: stage2 and not qemu
become: yes
import_tasks: tasks/stage2/setup-swap.yml
1 change: 0 additions & 1 deletion ansible/tasks/internal/install-salt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
- salt-common={{ salt_release }}
- salt-minion={{ salt_release }}
state: present
update_cache: yes

- name: Pin salt packages at major version
ansible.builtin.copy:
Expand Down
1 change: 0 additions & 1 deletion ansible/tasks/setup-postgrest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
package:
- libnuma-dev
- libpq5
update_cache: true
state: 'present'

- name: PostgREST - grab the list of installed packages
Expand Down
8 changes: 0 additions & 8 deletions ansible/tasks/setup-system.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
- name: Execute stage1 tasks
when: not stage2
block:
- name: System - apt update and apt upgrade
ansible.builtin.apt:
update_cache: true
upgrade: true
# SEE http://archive.vn/DKJjs#parameter-upgrade

- name: Install required security updates Ansible dependencies, security tools, and other useful things
ansible.builtin.apt:
cache_valid_time: 3600
pkg:
- acl
- bwm-ng
Expand All @@ -23,7 +16,6 @@
- sysstat
- tzdata
- vim
update_cache: true
# SEE https://github.com/georchestra/ansible/issues/55#issuecomment-588313638
# Without this, a similar error is faced

Expand Down
1 change: 0 additions & 1 deletion ansible/tasks/setup-tmux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
ansible.builtin.apt:
name: 'tmux'
state: 'present'
update_cache: true
become: true

- name: tmux - Configure tmux alias
Expand Down
38 changes: 0 additions & 38 deletions ansible/tasks/setup-tuned.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
name: 'tuned'
policy_rc_d: 101
state: 'present'
update_cache: true
become: true

- name: 'tuned - Create a tuned profile directory' # noqa: name[casing]
Expand Down Expand Up @@ -185,43 +184,6 @@
value: '10'
become: true

- name: 'tuned - Enable zswap if swap is present' # noqa: name[casing]
when: ansible_facts['swaptotal_mb'] > 0
block:
- name: 'tuned - Decrease the kernel swappiness' # noqa: name[casing]
community.general.ini_file:
create: true
group: 'root'
mode: '0644'
no_extra_spaces: true
option: 'vm.swappiness'
path: '/etc/tuned/profiles/postgresql/tuned.conf'
section: 'sysctl'
state: 'present'
value: '10'
become: true

- name: 'tuned - Load zstd compressor module' # noqa: name[casing]
community.general.modprobe:
name: 'zstd'
persistent: 'present'
state: 'present'
become: true

- name: 'tuned - Configure and enable zswap' # noqa: name[casing]
ansible.builtin.shell:
cmd: "echo {{ zswap_item['value'] }} > /sys/module/zswap/parameters/{{ zswap_item['param'] }}"
changed_when: true
loop:
- param: 'compressor'
value: 'zstd'
- param: 'max_pool_percent'
value: '10'
- param: 'enabled'
value: 'Y'
loop_control:
loop_var: 'zswap_item'

- name: 'tuned - Activate the tuned service' # noqa: name[casing]
ansible.builtin.systemd_service:
daemon_reload: true
Expand Down
49 changes: 49 additions & 0 deletions ansible/tasks/stage2/setup-swap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
- name: Allocate and format swapfile
ansible.builtin.shell: |
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
args:
creates: /swapfile

- name: Add swapfile to fstab
ansible.posix.mount:
src: /swapfile
path: none
fstype: swap
opts: sw
dump: "0"
passno: "0"
state: present

- name: 'tuned - Decrease the kernel swappiness' # noqa: name[casing]
community.general.ini_file:
create: true
group: 'root'
mode: '0644'
no_extra_spaces: true
option: 'vm.swappiness'
path: '/etc/tuned/profiles/postgresql/tuned.conf'
section: 'sysctl'
state: 'present'
value: '10'

- name: 'tuned - Load zstd compressor module' # noqa: name[casing]
community.general.modprobe:
name: 'zstd'
persistent: 'present'
state: 'present'

- name: 'tuned - Configure and enable zswap' # noqa: name[casing]
ansible.builtin.shell:
cmd: "echo {{ zswap_item['value'] }} > /sys/module/zswap/parameters/{{ zswap_item['param'] }}"
changed_when: true
loop:
- param: 'compressor'
value: 'zstd'
- param: 'max_pool_percent'
value: '10'
- param: 'enabled'
value: 'Y'
loop_control:
loop_var: 'zswap_item'
1 change: 0 additions & 1 deletion ansible/tasks/test-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
ansible.builtin.apt:
name: 'python3-psycopg2'
state: 'present'
update_cache: true
become: true

- name: Reset db stats
Expand Down
10 changes: 0 additions & 10 deletions ebssurrogate/files/sources-arm64.cfg

This file was deleted.

10 changes: 0 additions & 10 deletions ebssurrogate/files/sources.cfg

This file was deleted.

Loading
Loading