Skip to content

Commit

Permalink
Merge pull request #2405 from ProgrammeVitam/cp71_bug_14180_fix_brows…
Browse files Browse the repository at this point in the history
…er_installation_on_almalinux

CP V7.1 - BUG #14180: fix browser installation on Almalinux
  • Loading branch information
GiooDev authored Jan 22, 2025
2 parents 52f5957 + d65683e commit dbe3d72
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 70 deletions.
7 changes: 1 addition & 6 deletions deployment/roles/browser/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,5 @@
# handlers file for storage-offer-default
- name: restart apache
service:
name: httpd
name: "{{ 'apache2' if ansible_os_family == 'Debian' else 'httpd' }}"
state: restarted

- name: restart apache2
service:
name: apache2
state: restarted
88 changes: 24 additions & 64 deletions deployment/roles/browser/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,93 +1,53 @@
---
#- name: Install vitam user for /vitam browser
# package:
# name: vitam-user-vitam
# state: latest
- block:
- name: Install Apache package for displaying data content
package:
name: httpd
state: latest
register: result
retries: "{{ packages_install_retries_number | default(2) }}"
until: result is succeeded
delay: "{{ packages_install_retries_delay | default(10) }}"
when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat")

- name: Install Apache package for displaying data content
package:
name: apache2
name: "{{ 'apache2' if ansible_os_family == 'Debian' else 'httpd' }}"
state: latest
register: result
retries: "{{ packages_install_retries_number | default(2) }}"
until: result is succeeded
delay: "{{ packages_install_retries_delay | default(10) }}"
when: ( ansible_distribution == "Debian")

# TODO : idéalement, Apache ne devrait écouter que sur l'IP d'admin

- name: Ensure Apache autostart && Apache is started on Centos
service:
name: httpd
enabled: yes
state: started
when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat")

- name: Ensure Apache autostart && Apache is started on Debian
service:
name: apache2
enabled: yes
state: started
when: (ansible_distribution == "Debian" )

- name: add vitamui group to apache user on Centos
- name: add vitamui group to apache user
user:
name: apache
name: "{{ 'www-data' if ansible_os_family == 'Debian' else 'httpd' }}"
groups: vitamui
when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat")

- name: add vitamui group to apache user on Centos
user:
name: www-data
groups: vitamui
when: (ansible_distribution == "Debian" )

- name: copy theme files
copy:
src: ".theme"
dest: "{{vitamui_defaults.folder.root_path | default('/vitamui')}}"
owner: "root"
src: .theme
dest: "{{ vitamui_defaults.folder.root_path | default('/vitamui') }}"
owner: root
mode: 0644

- name: add configuration file for mapping on Centos # + notify httpd restart
- name: add Apache configuration file for browser
template:
src: "{{item}}.j2"
dest: "/etc/httpd/conf.d/{{item}}"
src: "{{ item }}.j2"
dest: "{{ '/etc/apache2/sites-available' if ansible_os_family == 'Debian' else '/etc/httpd/conf.d' }}/{{ item }}"
mode: 0500
owner: root
when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat")
notify: restart apache
with_items:
- "httpd-offer-view.conf"

- name: add configuration file for mapping on Debian # + notify httpd restart
template:
src: "{{item}}.j2"
dest: "/etc/apache2/sites-available/{{item}}"
mode: 0500
owner: root
when: (ansible_distribution == "Debian" )
notify: restart apache2
with_items:
- "httpd-offer-view.conf"
- httpd-offer-view.conf

- name: activate offer view in Debian only
file:
src: '/etc/apache2/sites-available/{{item}}'
dest: '/etc/apache2/sites-enabled/{{item}}'
src: '/etc/apache2/sites-available/{{ item }}'
dest: '/etc/apache2/sites-enabled/{{ item }}'
state: link
when: (ansible_distribution == "Debian" )
notify: restart apache2
when: ansible_os_family == "Debian"
notify: restart apache
with_items:
- "httpd-offer-view.conf"
- httpd-offer-view.conf

- meta: flush_handlers

- name: Ensure Apache autostart && Apache is started
service:
name: "{{ 'apache2' if ansible_os_family == 'Debian' else 'httpd' }}"
enabled: yes
state: started

when: extra | d(false)

0 comments on commit dbe3d72

Please sign in to comment.