Skip to content
Snippets Groups Projects
Commit 8b20f9d3 authored by Antoine SCHILDKNECHT's avatar Antoine SCHILDKNECHT
Browse files

Merge branch 't36656-certbot-hook' into 'main'

Remove useless nginx test in post-hook | refs #36656

See merge request sys/ansible-public!27
parents 110c87ff fbe17dcb
No related branches found
No related tags found
No related merge requests found
Showing
with 27 additions and 108 deletions
...@@ -4,13 +4,11 @@ ...@@ -4,13 +4,11 @@
hosts: postgres_primary:postgres_standby:postgres_fenced hosts: postgres_primary:postgres_standby:postgres_fenced
tasks: tasks:
- name: get cluster state - name: get cluster state
ansible.builtin.command: "rephacheck" ansible.builtin.command: rephacheck
register: rephacheck register: rephacheck
changed_when: false changed_when: false
- name: show status for each node - name: show status for each node
ansible.builtin.debug: ansible.builtin.debug:
msg: "Current node {{ ansible_hostname }} status {{ rephacheck['stdout'] }}" msg: Current node {{ ansible_hostname }} status {{ rephacheck['stdout'] }}
when: rephacheck['stdout'] | length > 0 when: rephacheck['stdout'] | length > 0
...
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
hosts: postgres hosts: postgres
tasks: tasks:
- name: kill repmgrd - name: kill repmgrd
ansible.builtin.command: "pkill repmgrd" ansible.builtin.command: pkill repmgrd
# TOFIX: implement a proper verification # TOFIX: implement a proper verification
changed_when: false changed_when: false
failed_when: false failed_when: false
...@@ -13,5 +13,3 @@ ...@@ -13,5 +13,3 @@
ansible.builtin.systemd: ansible.builtin.systemd:
name: repmgrd name: repmgrd
state: restarted state: restarted
...
...@@ -5,20 +5,18 @@ ...@@ -5,20 +5,18 @@
tasks: tasks:
- name: fail if node status if not standby - name: fail if node status if not standby
ansible.builtin.fail: ansible.builtin.fail:
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/13/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/13/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:
- standby_dry_run is succeeded - standby_dry_run is succeeded
- rephacheck['stdout'] == "standby" - rephacheck['stdout'] == "standby"
...
#!/usr/bin/env ansible-playbook #!/usr/bin/env ansible-playbook
--- ---
- name: POSTGRESQL - name: POSTGRESQL
hosts: postgres hosts: postgres
tags: postgres tags: postgres
...@@ -15,5 +14,3 @@ ...@@ -15,5 +14,3 @@
when: proxy_apply | d(false) when: proxy_apply | d(false)
ansible.builtin.include_role: ansible.builtin.include_role:
name: proxy name: proxy
...
#!/usr/bin/env ansible-playbook #!/usr/bin/env ansible-playbook
--- ---
- name: PYTHON - name: PYTHON
hosts: all hosts: all
gather_facts: false gather_facts: false
...@@ -50,5 +49,3 @@ ...@@ -50,5 +49,3 @@
- import_playbook: tester.yml - import_playbook: tester.yml
tags: tester tags: tester
...
#!/usr/bin/env ansible-playbook #!/usr/bin/env ansible-playbook
--- ---
- name: Install UbiCast tester - name: Install UbiCast tester
hosts: mediaserver:mediaworker:mirismanager:postgres:msmonitor:live:celerity:mediaimport:mediacache:mediavault hosts: mediaserver:mediaworker:mirismanager:postgres:msmonitor:live:celerity:mediaimport:mediacache:mediavault
tags: all tags: all
roles: roles:
- tester - tester
...
#!/usr/bin/env ansible-playbook #!/usr/bin/env ansible-playbook
--- ---
- name: TEST DATA PARTITION - name: TEST DATA PARTITION
hosts: mediaserver hosts: mediaserver
gather_facts: false gather_facts: false
tasks: tasks:
- name: verify /data partition existence - name: verify /data partition existence
ansible.builtin.shell: findmnt /data ansible.builtin.shell: findmnt /data
register: data_exist register: data_exist
...@@ -14,7 +12,6 @@ ...@@ -14,7 +12,6 @@
# /data exist # /data exist
- block: - block:
- name: get /data size - name: get /data size
ansible.builtin.shell: df -BG /data --output=size | tail -n1 | grep -o '[0-9]*' ansible.builtin.shell: df -BG /data --output=size | tail -n1 | grep -o '[0-9]*'
register: data_size register: data_size
...@@ -23,13 +20,13 @@ ...@@ -23,13 +20,13 @@
- name: print size - name: print size
ansible.builtin.debug: ansible.builtin.debug:
msg: "/data size is {{ data_size.stdout }}G" msg: /data size is {{ data_size.stdout }}G
- name: create a test directory in /data - name: create a test directory in /data
ansible.builtin.file: ansible.builtin.file:
path: /data/test path: /data/test
state: directory state: directory
mode: '0755' mode: "0755"
owner: nobody owner: nobody
group: nogroup group: nogroup
ignore_errors: true ignore_errors: true
...@@ -39,7 +36,7 @@ ...@@ -39,7 +36,7 @@
ansible.builtin.file: ansible.builtin.file:
state: touch state: touch
path: /data/test/file path: /data/test/file
mode: '0644' mode: "0644"
owner: nobody owner: nobody
group: nogroup group: nogroup
ignore_errors: true ignore_errors: true
...@@ -52,7 +49,6 @@ ...@@ -52,7 +49,6 @@
# /data missing # /data missing
- block: - block:
- name: get /home size - name: get /home size
ansible.builtin.shell: df -BG /home --output=size | tail -n1 | grep -o '[0-9]*' ansible.builtin.shell: df -BG /home --output=size | tail -n1 | grep -o '[0-9]*'
register: home_size register: home_size
...@@ -61,11 +57,9 @@ ...@@ -61,11 +57,9 @@
- name: verify size - name: verify size
ansible.builtin.debug: ansible.builtin.debug:
msg: "/home size is too short ({{ home_size.stdout }}G < 200G)" msg: /home size is too short ({{ home_size.stdout }}G < 200G)
when: home_size.stdout | int < 200 when: home_size.stdout | int < 200
ignore_errors: true ignore_errors: true
failed_when: true failed_when: true
when: data_exist.rc != 0 when: data_exist.rc != 0
...
#!/usr/bin/env ansible-playbook #!/usr/bin/env ansible-playbook
--- ---
- name: RUN TESTER - name: RUN TESTER
hosts: all hosts: all
tags: tester tags: tester
...@@ -20,5 +19,3 @@ ...@@ -20,5 +19,3 @@
python3 /root/envsetup/tests/tester.py 2>&1 | tee /root/envsetup/tests/logs/tester_pb.log python3 /root/envsetup/tests/tester.py 2>&1 | tee /root/envsetup/tests/logs/tester_pb.log
creates: /root/envsetup/tests/logs/tester_pb.log creates: /root/envsetup/tests/logs/tester_pb.log
executable: /bin/bash executable: /bin/bash
...
#!/usr/bin/env ansible-playbook #!/usr/bin/env ansible-playbook
--- ---
- name: GATHER ALL FACTS - name: GATHER ALL FACTS
hosts: all hosts: all
tasks: tasks:
...@@ -14,7 +13,6 @@ ...@@ -14,7 +13,6 @@
hosts: all hosts: all
gather_facts: false gather_facts: false
tasks: tasks:
- include_vars: - include_vars:
file: ressources/firewall/rules.yml file: ressources/firewall/rules.yml
...@@ -30,7 +28,6 @@ ...@@ -30,7 +28,6 @@
hosts: all hosts: all
gather_facts: false gather_facts: false
tasks: tasks:
- include_vars: - include_vars:
file: ressources/firewall/rules.yml file: ressources/firewall/rules.yml
...@@ -42,5 +39,3 @@ ...@@ -42,5 +39,3 @@
loop_var: outer_item loop_var: outer_item
# execute loop only when group exists and host is in listen.groupname_src # execute loop only when group exists and host is in listen.groupname_src
when: (outer_item.groupname_src in groups) and (inventory_hostname in groups[outer_item.groupname_src]) when: (outer_item.groupname_src in groups) and (inventory_hostname in groups[outer_item.groupname_src])
...
--- ---
- debug: - debug:
msg: "On {{ outer_item.groupname }} server(s) put {{ outer_item.ports }} port(s) in listen mode" msg: On {{ outer_item.groupname }} server(s) put {{ outer_item.ports }} port(s) in listen mode
- ansible.builtin.shell: "nohup timeout 300 nc -lp {{ item }} >/dev/null 2>&1 &" - ansible.builtin.shell: nohup timeout 300 nc -lp {{ item }} >/dev/null 2>&1 &
ignore_errors: true ignore_errors: true
loop: "{{ outer_item.ports }}" loop: "{{ outer_item.ports }}"
changed_when: false changed_when: false
...
--- ---
listen: listen:
- groupname: mediaserver - groupname: mediaserver
ports: ["80", "443"] ports: ["80", "443"]
- groupname: celerity - groupname: celerity
ports: ["6200"] ports: ["6200"]
- groupname: wowza - groupname: wowza
ports: ["1935"] ports: ["1935"]
- groupname: mirismanager - groupname: mirismanager
ports: ["22", "443"] ports: ["22", "443"]
- groupname: mediaimport - groupname: mediaimport
ports: ["20", "22"] ports: ["20", "22"]
- groupname: all - groupname: all
ports: ["4949"] ports: ["4949"]
- groupname: postgres - groupname: postgres
ports: ["5432", "22"] ports: ["5432", "22"]
test: test:
- groupname_src: mediaworker - groupname_src: mediaworker
groupname_dst: mediaserver groupname_dst: mediaserver
ports: ["80", "443"] ports: ["80", "443"]
- groupname_src: mediaworker - groupname_src: mediaworker
groupname_dst: celerity groupname_dst: celerity
ports: ["6200"] ports: ["6200"]
- groupname_src: mediaserver - groupname_src: mediaserver
groupname_dst: celerity groupname_dst: celerity
ports: ["6200"] ports: ["6200"]
- groupname_src: mediaserver - groupname_src: mediaserver
groupname_dst: mediacache groupname_dst: mediacache
ports: ["22", "443"] ports: ["22", "443"]
- groupname_src: mediacache - groupname_src: mediacache
groupname_dst: mediaserver groupname_dst: mediaserver
ports: ["80", "443"] ports: ["80", "443"]
- groupname_src: mediaserver - groupname_src: mediaserver
hosts_dst: ["mirismanager.ubicast.eu"] hosts_dst: [mirismanager.ubicast.eu]
ports: ["80", "443"] ports: ["80", "443"]
- groupname_src: mediaserver - groupname_src: mediaserver
groupname_dst: netcapture groupname_dst: netcapture
ports: ["22"] ports: ["22"]
- groupname_src: netcapture - groupname_src: netcapture
groupname_dst: mediaserver groupname_dst: mediaserver
ports: ["443", "1935"] ports: ["443", "1935"]
- groupname_src: mediaserver - groupname_src: mediaserver
hosts_dst: ["git.ubicast.net"] hosts_dst: [git.ubicast.net]
ports: ["22"] ports: ["22"]
- groupname_src: localhost - groupname_src: localhost
groupname_dst: mediaserver groupname_dst: mediaserver
ports: ["80", "443"] ports: ["80", "443"]
...
--- ---
# test rules with direct hosts destination # test rules with direct hosts destination
- block: - block:
- debug: - debug:
msg: "Test rule from {{ outer_item.groupname_src }} to {{ outer_item.hosts_dst }} on {{ outer_item.ports }} port(s)" msg: Test rule from {{ outer_item.groupname_src }} to {{ outer_item.hosts_dst }} on {{ outer_item.ports }} port(s)
- shell: "nc -zv {{ item.0 }} {{ item.1 }}" - shell: nc -zv {{ item.0 }} {{ item.1 }}
ignore_errors: true ignore_errors: true
loop: "{{ outer_item.hosts_dst | product(outer_item.ports) | list }}" loop: "{{ outer_item.hosts_dst | product(outer_item.ports) | list }}"
when: proxy is not defined when: proxy is not defined
changed_when: false changed_when: false
- shell: "nc -x {{ proxy }} -X Connect -zv {{ item.0 }} {{ item.1 }}" - shell: nc -x {{ proxy }} -X Connect -zv {{ item.0 }} {{ item.1 }}
ignore_errors: true ignore_errors: true
loop: "{{ outer_item.hosts_dst | product(outer_item.ports) | list }}" loop: "{{ outer_item.hosts_dst | product(outer_item.ports) | list }}"
when: proxy is defined when: proxy is defined
...@@ -21,21 +20,17 @@ ...@@ -21,21 +20,17 @@
# test rules with ansible group destination # test rules with ansible group destination
- block: - block:
- debug: - debug:
msg: "Test rule from {{ outer_item.groupname_src }} to {{ outer_item.groupname_dst }} on {{ outer_item.ports }} port(s)" msg: Test rule from {{ outer_item.groupname_src }} to {{ outer_item.groupname_dst }} on {{ outer_item.ports }} port(s)
- shell: "nc -zv {{ item.0 }} {{ item.1 }}" - shell: nc -zv {{ item.0 }} {{ item.1 }}
ignore_errors: true ignore_errors: true
loop: "{{ groups[outer_item.groupname_dst] | map('extract', hostvars, ['ansible_default_ipv4', 'address']) | list loop: "{{ groups[outer_item.groupname_dst] | map('extract', hostvars, ['ansible_default_ipv4', 'address']) | list | product(outer_item.ports) | list }}"
| product(outer_item.ports) | list }}"
when: proxy is not defined when: proxy is not defined
changed_when: false changed_when: false
- shell: "nc -x {{ proxy }} -X Connect -zv {{ item.0 }} {{ item.1 }}" - shell: nc -x {{ proxy }} -X Connect -zv {{ item.0 }} {{ item.1 }}
ignore_errors: true ignore_errors: true
loop: "{{ groups[outer_item.groupname_dst] | map('extract', hostvars, ['ansible_default_ipv4', 'address']) | list loop: "{{ groups[outer_item.groupname_dst] | map('extract', hostvars, ['ansible_default_ipv4', 'address']) | list | product(outer_item.ports) | list }}"
| product(outer_item.ports) | list }}"
when: proxy is defined when: proxy is defined
changed_when: false changed_when: false
when: outer_item.groupname_dst is defined when: outer_item.groupname_dst is defined
...
#!/usr/bin/env ansible-playbook #!/usr/bin/env ansible-playbook
--- ---
- name: UPGRADE SERVERS - name: UPGRADE SERVERS
hosts: all hosts: all
tasks: tasks:
- name: apt-get dist-upgrade - name: apt-get dist-upgrade
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
ansible.builtin.apt: ansible.builtin.apt:
...@@ -21,5 +19,3 @@ ...@@ -21,5 +19,3 @@
ansible.builtin.yum: ansible.builtin.yum:
name: "*" name: "*"
state: latest state: latest
...
#!/usr/bin/env ansible-playbook #!/usr/bin/env ansible-playbook
--- ---
- name: USERS - name: USERS
hosts: all hosts: all
tags: all tags: all
roles: roles:
- conf - conf
- users - users
...
--- ---
- src: elastic.elasticsearch - src: elastic.elasticsearch
version: 7.9.0 version: 7.9.0
...
--- ---
dependencies: dependencies:
- role: conf - role: conf
- role: init - role: init
...@@ -9,5 +8,3 @@ dependencies: ...@@ -9,5 +8,3 @@ dependencies:
- role: ferm-install - role: ferm-install
- role: ferm-configure - role: ferm-configure
- role: fail2ban - role: fail2ban
...
--- ---
bench_server_packages: bench_server_packages:
- ubicast-benchmark - ubicast-benchmark
...@@ -14,5 +13,3 @@ bench_dl_streams: false ...@@ -14,5 +13,3 @@ bench_dl_streams: false
bench_stream_repo: https://git.ubicast.net/mediaserver/ms-testing-suite.git bench_stream_repo: https://git.ubicast.net/mediaserver/ms-testing-suite.git
bench_host_api_key: "{{ envsetup_ms_api_key | d() }}" bench_host_api_key: "{{ envsetup_ms_api_key | d() }}"
...
--- ---
dependencies: dependencies:
- role: conf - role: conf
- role: init - role: init
- role: sysconfig - role: sysconfig
...
--- ---
- name: install bench-server packages - name: install bench-server packages
ansible.builtin.apt: ansible.builtin.apt:
force_apt_get: true force_apt_get: true
...@@ -15,7 +14,7 @@ ...@@ -15,7 +14,7 @@
ansible.builtin.file: ansible.builtin.file:
path: /etc/mediaserver path: /etc/mediaserver
state: directory state: directory
mode: '755' mode: "755"
- name: benchmark configuration settings - name: benchmark configuration settings
ansible.builtin.copy: ansible.builtin.copy:
...@@ -30,7 +29,7 @@ ...@@ -30,7 +29,7 @@
"DL_STREAMS":{{ bench_dl_streams }}, "DL_STREAMS":{{ bench_dl_streams }},
"TIME_STATS":{{ bench_time_stat }} "TIME_STATS":{{ bench_time_stat }}
} }
mode: '644' mode: "644"
- name: reload systemd daemon - name: reload systemd daemon
ansible.builtin.systemd: ansible.builtin.systemd:
...@@ -45,7 +44,7 @@ ...@@ -45,7 +44,7 @@
ansible.builtin.template: ansible.builtin.template:
src: bench-streaming.conf.j2 src: bench-streaming.conf.j2
dest: /etc/mediaserver/bench-streaming.conf dest: /etc/mediaserver/bench-streaming.conf
mode: '644' mode: "644"
- name: clone ms-testing-suite repository - name: clone ms-testing-suite repository
ansible.builtin.git: ansible.builtin.git:
...@@ -60,7 +59,7 @@ ...@@ -60,7 +59,7 @@
src: /etc/mediaserver/bench-streaming.conf src: /etc/mediaserver/bench-streaming.conf
dest: /usr/share/ms-testing-suite/config.json dest: /usr/share/ms-testing-suite/config.json
remote_src: true remote_src: true
mode: '644' mode: "644"
- name: add docker key - name: add docker key
when: when:
...@@ -75,7 +74,7 @@ ...@@ -75,7 +74,7 @@
- not offline_mode | d(false) - not offline_mode | d(false)
- not in_docker | d(false) - not in_docker | d(false)
ansible.builtin.apt_repository: ansible.builtin.apt_repository:
repo: "deb https://download.docker.com/linux/debian buster stable" repo: deb https://download.docker.com/linux/debian buster stable
state: present state: present
update_cache: true update_cache: true
...@@ -101,5 +100,3 @@ ...@@ -101,5 +100,3 @@
cmd: make build_docker_img cmd: make build_docker_img
chdir: /usr/share/ms-testing-suite chdir: /usr/share/ms-testing-suite
run_once: true run_once: true
...
--- ---
bench_worker_packages: bench_worker_packages:
- ubicast-benchmark - ubicast-benchmark
...@@ -11,5 +10,3 @@ bench_user: admin ...@@ -11,5 +10,3 @@ bench_user: admin
bench_password: "{{ envsetup_ms_admin_pwd | d() }}" bench_password: "{{ envsetup_ms_admin_pwd | d() }}"
bench_oid: bench_oid:
bench_dl_streams: false bench_dl_streams: false
...
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