Skip to content
Snippets Groups Projects
Commit 55b9a545 authored by Baptiste DE RENZO's avatar Baptiste DE RENZO
Browse files

Debian 11 support, Refs #34234

parent 2781312d
No related branches found
No related tags found
No related merge requests found
Showing
with 111 additions and 131 deletions
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
- name: delete postgresql data directory - name: delete postgresql data directory
ansible.builtin.file: ansible.builtin.file:
path: /var/lib/postgresql/11/main/ path: /var/lib/postgresql/13/main/
state: absent state: absent
force: true force: true
- name: copy data from primary - name: copy data from primary
ansible.builtin.command: > ansible.builtin.command: >
repmgr -f /etc/postgresql/11/main/repmgr.conf repmgr -f /etc/postgresql/13/main/repmgr.conf
--force --verbose --force --verbose
standby clone standby clone
-h {{ hostvars[groups['postgres_primary'][0]]['ansible_default_ipv4']['address'] }} -h {{ hostvars[groups['postgres_primary'][0]]['ansible_default_ipv4']['address'] }}
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
when: copy_from_primary is succeeded when: copy_from_primary is succeeded
- name: register node as standby - name: register node as standby
ansible.builtin.command: "repmgr -f /etc/postgresql/11/main/repmgr.conf --force --verbose standby register" ansible.builtin.command: "repmgr -f /etc/postgresql/13/main/repmgr.conf --force --verbose standby register"
become: true become: true
become_user: postgres become_user: postgres
when: copy_from_primary is succeeded when: copy_from_primary is succeeded
......
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
msg: "Current status {{ rephacheck['stdout'] }} must be standby." msg: "Current status {{ rephacheck['stdout'] }} must be standby."
when: rephacheck['stdout'] != "standby" when: rephacheck['stdout'] != "standby"
- name: check if node is currently in standby - name: check if node is currently in standby
ansible.builtin.command: "repmgr standby switchover -f /etc/postgresql/11/main/repmgr.conf --siblings-follow --dry-run" ansible.builtin.command: "repmgr standby switchover -f /etc/postgresql/13/main/repmgr.conf --siblings-follow --dry-run"
become: true become: true
become_user: postgres become_user: postgres
when: rephacheck['stdout'] == "standby" when: rephacheck['stdout'] == "standby"
register: standby_dry_run register: standby_dry_run
- name: switch standby node to primary - name: switch standby node to primary
ansible.builtin.command: "repmgr standby switchover -f /etc/postgresql/11/main/repmgr.conf --siblings-follow" ansible.builtin.command: "repmgr standby switchover -f /etc/postgresql/13/main/repmgr.conf --siblings-follow"
become: true become: true
become_user: postgres become_user: postgres
when: when:
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
ansible.builtin.apt: ansible.builtin.apt:
force_apt_get: true force_apt_get: true
install_recommends: false install_recommends: false
name: celerity-server name: ubicast-celerity-server
register: apt_status register: apt_status
retries: 60 retries: 60
until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg) until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg)
......
...@@ -9,6 +9,13 @@ ...@@ -9,6 +9,13 @@
retries: 60 retries: 60
until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg) until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg)
- name: use iptables-legacy
ansible.builtin.shell: |
update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
register: cmd
changed_when: "'using /usr/sbin/iptables-legacy to provide /usr/sbin/iptables (iptables) in manual mode' in cmd.stdout"
- name: configuration - name: configuration
notify: restart ferm notify: restart ferm
ansible.builtin.template: ansible.builtin.template:
......
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
ansible.builtin.systemd: ansible.builtin.systemd:
daemon_reload: true daemon_reload: true
- name: restart sshd
ansible.builtin.systemd:
name: sshd
state: restarted
- name: restart pure-ftpd - name: restart pure-ftpd
ansible.builtin.systemd: ansible.builtin.systemd:
name: pure-ftpd name: pure-ftpd
......
...@@ -41,6 +41,13 @@ ...@@ -41,6 +41,13 @@
## MYSECURESHELL ## MYSECURESHELL
- name: enable password login for ssh
notify: restart sshd
ansible.builtin.replace:
dest: /etc/ssh/sshd_config
regexp: "^PasswordAuthentication no"
replace: "#PasswordAuthentication yes"
- name: set the setuid on mysecureshell - name: set the setuid on mysecureshell
ansible.builtin.file: ansible.builtin.file:
path: /usr/bin/mysecureshell path: /usr/bin/mysecureshell
......
...@@ -6,7 +6,6 @@ server_packages: ...@@ -6,7 +6,6 @@ server_packages:
- memcached - memcached
- nginx - nginx
- postfix - postfix
- celerity-utils
- ubicast-mediaserver - ubicast-mediaserver
server_default_email_sender: "noreply@{{ server_hostname }}" server_default_email_sender: "noreply@{{ server_hostname }}"
......
...@@ -27,14 +27,6 @@ ...@@ -27,14 +27,6 @@
key: "{{ hostvars[item]['pubkey'] }}" key: "{{ hostvars[item]['pubkey'] }}"
tags: always tags: always
- name: resolve domain name to localhost
notify: restart nginx
loop: "{{ server_instances }}"
ansible.builtin.lineinfile:
path: /etc/hosts
line: '127.0.1.1 {{ item.ms_server_name }}'
backup: true
- name: Update the MS configuration with the celerity server IP - name: Update the MS configuration with the celerity server IP
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/mediaserver/msconf.py path: /etc/mediaserver/msconf.py
...@@ -60,23 +52,6 @@ ...@@ -60,23 +52,6 @@
mode: '0644' mode: '0644'
- name: create instances - name: create instances
when: inventory_hostname == groups['mediaserver'][0]
loop: "{{ server_instances }}"
environment:
MS_ID: "{{ item.ms_id }}"
MS_SERVER_NAME: "{{ item.ms_server_name }}"
MS_API_KEY: "{{ item.ms_api_key }}"
CM_SERVER_NAME: "{{ item.cm_server_name }}"
MS_SUPERUSER_PWD: "{{ item.ms_superuser_pwd }}"
MS_ADMIN_PWD: "{{ item.ms_admin_pwd }}"
ansible.builtin.command:
cmd: msinstaller.py {{ item.name }} --no-input
creates: /etc/nginx/sites-available/mediaserver-{{ item.name }}.conf
- name: create instances for secondary servers
when:
- groups['mediaserver'] | length > 1
- inventory_hostname != groups['mediaserver'][0]
loop: "{{ server_instances }}" loop: "{{ server_instances }}"
environment: environment:
MS_ID: "{{ item.ms_id }}" MS_ID: "{{ item.ms_id }}"
...@@ -85,8 +60,12 @@ ...@@ -85,8 +60,12 @@
CM_SERVER_NAME: "{{ item.cm_server_name }}" CM_SERVER_NAME: "{{ item.cm_server_name }}"
MS_SUPERUSER_PWD: "{{ item.ms_superuser_pwd }}" MS_SUPERUSER_PWD: "{{ item.ms_superuser_pwd }}"
MS_ADMIN_PWD: "{{ item.ms_admin_pwd }}" MS_ADMIN_PWD: "{{ item.ms_admin_pwd }}"
DB_HOST: "{{ envsetup_db_host | d('127.0.0.1') }}"
DB_PORT: "{{ envsetup_db_port | d('5432') }}"
DB_PG_ROOT_PWD: "{{ envsetup_db_pg_root_pwd | d('') }}"
MS_SECRET: "{{ envsetup_ms_secret | d('') }}"
ansible.builtin.command: ansible.builtin.command:
cmd: msinstaller.py {{ item.name }} --no-input cmd: mscontroller.py add -u {{ item.name }}
creates: /etc/nginx/sites-available/mediaserver-{{ item.name }}.conf creates: /etc/nginx/sites-available/mediaserver-{{ item.name }}.conf
throttle: 1 throttle: 1
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
ansible.builtin.apt: ansible.builtin.apt:
force_apt_get: true force_apt_get: true
install_recommends: false install_recommends: false
name: celerity-workers name: ubicast-celerity-workers
register: apt_status register: apt_status
retries: 60 retries: 60
until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg) until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg)
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
state: started state: started
- name: mirismanager install - name: mirismanager install
environment:
CM_SERVER_NAME: "{{ manager_hostname }}"
ansible.builtin.apt: ansible.builtin.apt:
force_apt_get: true force_apt_get: true
install_recommends: false install_recommends: false
...@@ -23,38 +25,6 @@ ...@@ -23,38 +25,6 @@
retries: 60 retries: 60
until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg) until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg)
- name: configure domain name in nginx conf
notify: restart nginx
ansible.builtin.replace:
path: /etc/nginx/sites-available/skyreach.conf
regexp: '^(\s*server_name).*;$'
replace: '\1 {{ manager_hostname }};'
backup: true
- name: configure domain name in settings
notify: restart skyreach
ansible.builtin.lineinfile:
path: /home/skyreach/skyreach_data/private/settings_override.py
regexp: '^#? ?SITE_URL.*'
line: "SITE_URL = 'https://{{ manager_hostname }}'"
backup: true
- name: configure site title in settings
notify: restart skyreach
ansible.builtin.lineinfile:
path: /home/skyreach/skyreach_data/private/settings_override.py
regexp: '^#? ?SITE_TITLE.*'
line: "SITE_TITLE = '{{ manager_hostname }}'"
backup: true
- name: configure site name in settings
notify: restart skyreach
ansible.builtin.lineinfile:
path: /home/skyreach/skyreach_data/private/settings_override.py
regexp: '^#? ?SITE_NAME.*'
line: "SITE_NAME = '{{ manager_hostname }}'"
backup: true
- name: configure email sender address in settings - name: configure email sender address in settings
notify: restart skyreach notify: restart skyreach
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
...@@ -63,13 +33,6 @@ ...@@ -63,13 +33,6 @@
line: "DEFAULT_FROM_EMAIL = '{{ manager_email_sender }}'" line: "DEFAULT_FROM_EMAIL = '{{ manager_email_sender }}'"
backup: true backup: true
- name: resolve domain name to localhost ipv4
notify: restart nginx
ansible.builtin.lineinfile:
path: /etc/hosts
line: '127.0.0.1 {{ manager_hostname }}'
backup: true
- name: ensure skyreach is running - name: ensure skyreach is running
ansible.builtin.service: ansible.builtin.service:
name: skyreach name: skyreach
......
--- ---
monitor_shell_pwd: "{{ envsetup_monitor_shell_pwd | d() }}" monitor_shell_pwd: "{{ envsetup_monitor_shell_pwd | d() }}"
monitor_admin_pwd: "{{ envsetup_monitor_admin_pwd | d() }}"
monitor_superuser_pwd: "{{ envsetup_monitor_superuser_pwd | d() }}"
ssh_maintenance_port: "{{ envsetup_ssh_maintenance_port | d() }}"
monitor_hostname: "{{ envsetup_monitor_server_name | d('monitor', true) }}" monitor_hostname: "{{ envsetup_monitor_server_name | d('monitor', true) }}"
monitor_firewall_enabled: true monitor_firewall_enabled: true
......
--- ---
- name: install ubicast msmonitor - name: install ubicast msmonitor
environment:
MONITOR_SERVER_NAME: "{{ monitor_hostname }}"
MONITOR_SHELL_PWD: "{{ monitor_shell_pwd | password_hash('sha512', 'monitor') }}"
MONITOR_ADMIN_PWD: "{{ monitor_admin_pwd | password_hash('sha512', 'monitor') }}"
MONITOR_SUPERUSER_PWD: "{{ monitor_superuser_pwd }}"
SSH_MAINTENANCE_PORT: "{{ ssh_maintenance_port }}"
ansible.builtin.apt: ansible.builtin.apt:
force_apt_get: true force_apt_get: true
install_recommends: false install_recommends: false
state: latest state: latest
name: name:
- ubicast-monitor - ubicast-webmonitor
- ubicast-monitor-runtime - ubicast-webmonitor-runtime
register: apt_status register: apt_status
retries: 60 retries: 60
until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg) until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg)
- name: set msmonitor account password
ansible.builtin.user:
name: msmonitor
password: "{{ monitor_shell_pwd | password_hash('sha512', 'monitor') }}"
- name: configure domain name in nginx
notify: restart nginx
ansible.builtin.replace:
path: /etc/nginx/sites-available/msmonitor.conf
regexp: '^(\s*server_name).*;$'
replace: '\1 {{ monitor_hostname }};'
backup: true
- name: resolve domain name to localhost ipv4
notify: restart nginx
ansible.builtin.lineinfile:
path: /etc/hosts
line: '127.0.1.1 {{ monitor_hostname }}'
backup: true
- name: ensure msmonitor is running - name: ensure msmonitor is running
ansible.builtin.service: ansible.builtin.service:
name: msmonitor name: webmonitor
enabled: true enabled: true
state: started state: started
- name: set directory permissions
ansible.builtin.file:
path: /home/msmonitor/msmonitor
mode: 0755
state: directory
# FIREWALL # FIREWALL
- name: firewall - name: firewall
......
...@@ -7,7 +7,7 @@ repmgr_packages: ...@@ -7,7 +7,7 @@ repmgr_packages:
- python3-psycopg2 - python3-psycopg2
- python3-toml - python3-toml
repmgr_pg_version: "{{ pg_version | default('11') }}" repmgr_pg_version: "{{ pg_version | default('13') }}"
repmgr_pg_cluster: "{{ pg_cluster | default('main') }}" repmgr_pg_cluster: "{{ pg_cluster | default('main') }}"
repmgr_pg_data: /var/lib/postgresql/{{ repmgr_pg_version }}/{{ repmgr_pg_cluster }} repmgr_pg_data: /var/lib/postgresql/{{ repmgr_pg_version }}/{{ repmgr_pg_cluster }}
......
...@@ -4,7 +4,7 @@ pg_packages: ...@@ -4,7 +4,7 @@ pg_packages:
- acl - acl
- postgresql - postgresql
pg_version: 11 pg_version: 13
pg_cluster: main pg_cluster: main
pg_password: "{{ envsetup_db_pg_root_pwd | d() }}" pg_password: "{{ envsetup_db_pg_root_pwd | d() }}"
......
/var/log/postgresql/*.log {
weekly
rotate 4
copytruncate
delaycompress
compress
notifempty
missingok
su root root
}
...@@ -20,6 +20,15 @@ ...@@ -20,6 +20,15 @@
# CONFIGURATION # CONFIGURATION
- name: update logrotate config
ansible.builtin.copy:
src: logrotate-postgresql
dest: "/etc/logrotate.d/postgresql-common"
owner: root
group: root
backup: false
mode: '644'
- name: ensure conf directory exists - name: ensure conf directory exists
ansible.builtin.file: ansible.builtin.file:
path: "{{ pg_conf_dir }}/conf.d" path: "{{ pg_conf_dir }}/conf.d"
......
...@@ -86,12 +86,13 @@ ...@@ -86,12 +86,13 @@
replace: 'Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";' replace: 'Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";'
notify: restart unattended-upgrades notify: restart unattended-upgrades
- name: allow automatic updates for ubicast security - name: allow automatic updates for ubicast security repo
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/apt/apt.conf.d/50unattended-upgrades path: /etc/apt/apt.conf.d/50unattended-upgrades
insertafter: '^Unattended-Upgrade::Origins-Pattern {$' insertafter: '^Unattended-Upgrade::Origins-Pattern {$'
line: ' "origin=UbiCast,label=UbiCast-Security";' line: ' "origin=UbiCast,label=UbiCast-Security";'
backup: true backup: true
notify: restart unattended-upgrades
- name: enable root login via ssh with key - name: enable root login via ssh with key
ansible.builtin.replace: ansible.builtin.replace:
......
--- ---
- name: create systemd-timesync service config directory
ansible.builtin.file:
path: /lib/systemd/system/systemd-timesyncd.service.d
state: directory
mode: 0755
- name: ntp add condition to systemd-timesyncd service - name: gathering services
notify: systemd daemon reload ansible.builtin.service_facts:
ansible.builtin.copy:
dest: /lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf
mode: '644'
content: |
[Unit]
# don't run timesyncd if we have another NTP daemon installed
ConditionFileIsExecutable=!/usr/sbin/ntpd
ConditionFileIsExecutable=!/usr/sbin/openntpd
ConditionFileIsExecutable=!/usr/sbin/chronyd
ConditionFileIsExecutable=!/usr/sbin/VBoxService
- name: ntp disable systemd-timesyncd service - name: ntp disable systemd-timesyncd service
notify: restart ntp notify: restart ntp
ansible.builtin.systemd: ansible.builtin.systemd:
name: systemd-timesyncd name: systemd-timesyncd
enabled: false enabled: false
daemon_reload: true
state: stopped state: stopped
when: ('systemd-timesyncd.service' in ansible_facts.services)
and (ansible_facts.services['systemd-timesyncd.service'].status != 'not-found')
- name: ntp install - name: ntp install
ansible.builtin.apt: ansible.builtin.apt:
......
--- ---
- name: ubuntu apt repo sources list - name: debian 10 apt repo sources list
when: when:
- not offline_mode | d(false) - not offline_mode | d(false)
- ansible_distribution == 'Ubuntu' - ansible_distribution == 'Debian'
- ansible_distribution_major_version == '10'
notify: update cache notify: update cache
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/apt/sources.list dest: /etc/apt/sources.list
mode: '644' mode: '644'
content: | content: |
deb {{ repos_prefix }}archive.ubuntu.com/ubuntu/ {{ repos_release }} main restricted universe multiverse deb {{ repos_prefix }}{{ repos_deb }}/debian {{ repos_release }} main contrib non-free
deb {{ repos_prefix }}archive.ubuntu.com/ubuntu/ {{ repos_release }}-updates main restricted universe multiverse deb {{ repos_prefix }}{{ repos_deb }}/debian {{ repos_release }}-updates main contrib non-free
deb {{ repos_prefix }}archive.ubuntu.com/ubuntu/ {{ repos_release }}-backports main restricted universe multiverse deb {{ repos_prefix }}{{ repos_deb_sec }}/debian-security {{ repos_release }}/updates main contrib non-free
deb {{ repos_prefix }}security.ubuntu.com/ubuntu {{ repos_release }}-security main restricted universe multiverse
- name: debian apt repo sources list - name: debian 11 apt repo sources list
when: when:
- not offline_mode | d(false) - not offline_mode | d(false)
- ansible_distribution == 'Debian' - ansible_distribution == 'Debian'
- ansible_distribution_major_version == '11'
notify: update cache notify: update cache
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/apt/sources.list dest: /etc/apt/sources.list
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
content: | content: |
deb {{ repos_prefix }}{{ repos_deb }}/debian {{ repos_release }} main contrib non-free deb {{ repos_prefix }}{{ repos_deb }}/debian {{ repos_release }} main contrib non-free
deb {{ repos_prefix }}{{ repos_deb }}/debian {{ repos_release }}-updates main contrib non-free deb {{ repos_prefix }}{{ repos_deb }}/debian {{ repos_release }}-updates main contrib non-free
deb {{ repos_prefix }}{{ repos_deb_sec }}/debian-security {{ repos_release }}/updates main contrib non-free deb {{ repos_prefix }}{{ repos_deb_sec }}/debian-security {{ repos_release }}-security main contrib non-free
- name: add ubicast apt repo key - name: add ubicast apt repo key
when: not offline_mode | d(false) when: not offline_mode | d(false)
...@@ -36,16 +37,42 @@ ...@@ -36,16 +37,42 @@
when: when:
- not offline_mode | d(false) - not offline_mode | d(false)
- repos_skyreach_token | d(false) - repos_skyreach_token | d(false)
- ansible_distribution == 'Debian'
- ansible_distribution_major_version == '10'
ansible.builtin.apt_repository: ansible.builtin.apt_repository:
repo: deb https://{{ repos_skyreach_host }} packaging/apt/{{ repos_skyreach_token }}/ repo: deb https://{{ repos_skyreach_host }} packaging/apt/{{ repos_skyreach_token }}/
filename: ubicast filename: ubicast
update_cache: true update_cache: true
- name: add ubicast apt repo
when:
- not offline_mode | d(false)
- repos_skyreach_token | d(false)
- ansible_distribution == 'Debian'
- ansible_distribution_major_version == '11'
ansible.builtin.apt_repository:
repo: deb https://{{ repos_skyreach_host }} packaging/apt/{{ repos_skyreach_token }}/bullseye/
filename: ubicast
update_cache: true
- name: add ubicast security apt repo - name: add ubicast security apt repo
when: not offline_mode | d(false) when:
- not offline_mode | d(false)
- ansible_distribution == 'Debian'
- ansible_distribution_major_version == '10'
ansible.builtin.apt_repository: ansible.builtin.apt_repository:
repo: deb https://{{ repos_skyreach_host }} packaging/apt/ubicast-security-updates/ repo: deb https://{{ repos_skyreach_host }} packaging/apt/ubicast-security-updates/
filename: ubicast-secu filename: ubicast-secu
update_cache: true update_cache: true
- name: add ubicast security apt repo
when:
- not offline_mode | d(false)
- ansible_distribution == 'Debian'
- ansible_distribution_major_version == '11'
ansible.builtin.apt_repository:
repo: deb https://{{ repos_skyreach_host }} packaging/apt/ubicast-security-updates/bullseye/
filename: ubicast-secu
update_cache: true
... ...
...@@ -3,5 +3,7 @@ ...@@ -3,5 +3,7 @@
tester_packages: tester_packages:
- ubicast-env - ubicast-env
- ubicast-tester - ubicast-tester
- ubicast-tester-nudgis
- ubicast-tester-system
... ...
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment