All checks were successful
CI / skip-ci-check (pull_request) Successful in 1m22s
CI / lint-and-test (pull_request) Successful in 1m27s
CI / ansible-validation (pull_request) Successful in 2m53s
CI / secret-scanning (pull_request) Successful in 1m24s
CI / dependency-scan (pull_request) Successful in 1m28s
CI / sast-scan (pull_request) Successful in 2m32s
CI / license-check (pull_request) Successful in 1m28s
CI / vault-check (pull_request) Successful in 2m30s
CI / playbook-test (pull_request) Successful in 2m32s
CI / container-scan (pull_request) Successful in 1m53s
CI / sonar-analysis (pull_request) Successful in 2m40s
CI / workflow-summary (pull_request) Successful in 1m22s
- Fix deploy script to handle non-git directories by cloning to temp location and moving contents, preserving .env files during clone - Remove comment lines from env.j2 template to prevent xargs errors - Add initial deploy task to app_setup role to ensure app is deployed before service starts - Fix migrate command precedence to check env-specific overrides first - Add sudo to systemctl restart commands in deploy script - Update documentation with project-specific configuration notes These changes improve deployment reliability for all app projects while adding support for mirrormatch-specific requirements (db:push, seeding). All changes are backward-compatible with existing projects (pote, punimTag).
77 lines
1.8 KiB
YAML
77 lines
1.8 KiB
YAML
---
|
|
# Role: base_os
|
|
# Purpose: baseline OS config for app guests.
|
|
|
|
- name: Ensure apt cache is up to date
|
|
ansible.builtin.apt:
|
|
update_cache: true
|
|
cache_valid_time: 3600
|
|
|
|
- name: Install baseline packages
|
|
ansible.builtin.apt:
|
|
name: "{{ base_os_packages }}"
|
|
state: present
|
|
|
|
- name: Ensure /etc/sudoers.d exists
|
|
ansible.builtin.file:
|
|
path: /etc/sudoers.d
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0750"
|
|
|
|
- name: Ensure app user exists
|
|
ansible.builtin.user:
|
|
name: "{{ base_os_user }}"
|
|
shell: "{{ base_os_user_shell }}"
|
|
groups: "{{ base_os_user_groups }}"
|
|
append: true
|
|
create_home: true
|
|
state: present
|
|
|
|
- name: Ensure app user has authorized SSH key
|
|
ansible.posix.authorized_key:
|
|
user: "{{ base_os_user }}"
|
|
state: present
|
|
key: "{{ base_os_user_ssh_public_key }}"
|
|
when: base_os_user_ssh_public_key | length > 0
|
|
|
|
- name: Configure passwordless sudo for app user
|
|
ansible.builtin.copy:
|
|
dest: "/etc/sudoers.d/{{ base_os_user }}"
|
|
content: "{{ base_os_user }} ALL=(ALL) NOPASSWD:ALL\n"
|
|
owner: root
|
|
group: root
|
|
mode: "0440"
|
|
when: base_os_passwordless_sudo | bool
|
|
|
|
- name: Ensure ufw is installed
|
|
ansible.builtin.apt:
|
|
name: ufw
|
|
state: present
|
|
|
|
- name: Ensure UFW allows SSH
|
|
community.general.ufw:
|
|
rule: allow
|
|
port: "{{ base_os_allow_ssh_port }}"
|
|
proto: tcp
|
|
|
|
- name: Ensure UFW allows backend port
|
|
community.general.ufw:
|
|
rule: allow
|
|
port: "{{ base_os_backend_port }}"
|
|
proto: tcp
|
|
when: base_os_enable_backend | bool
|
|
|
|
- name: Ensure UFW allows frontend port
|
|
community.general.ufw:
|
|
rule: allow
|
|
port: "{{ base_os_frontend_port }}"
|
|
proto: tcp
|
|
when: base_os_enable_frontend | bool
|
|
|
|
- name: Enable UFW (deny incoming by default)
|
|
community.general.ufw:
|
|
state: enabled
|
|
policy: deny
|