diff --git a/deployment/environments/group_vars/all/mongo_express_vars.yml b/deployment/environments/group_vars/all/mongo_express_vars.yml index c2314158be833a94f528c71b1d596b3932c21678..dfb57219bad4432826c290974021828fe66835d8 100755 --- a/deployment/environments/group_vars/all/mongo_express_vars.yml +++ b/deployment/environments/group_vars/all/mongo_express_vars.yml @@ -4,3 +4,5 @@ mongo_express_conf: service_name: "vitamui-mongo-express" baseuri: "/mongo-express" mongo_express_port: 9200 +mongo_express: + baseuri: "mongo-express" diff --git a/deployment/roles/browser/tasks/main.yml b/deployment/roles/browser/tasks/main.yml index 50e5f0873cdf7ff16cdd14d40de5d23f9bcb300a..7c4f6c4fbd8958fd3ee5d59fd37f2d28ee4a2be8 100644 --- a/deployment/roles/browser/tasks/main.yml +++ b/deployment/roles/browser/tasks/main.yml @@ -7,7 +7,7 @@ - name: Install Apache package for displaying data content package: name: httpd - when: (ansible_distribution == "CentOS" ) + when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") - name: Install Apache package for displaying data content package: @@ -21,7 +21,7 @@ name: httpd enabled: yes state: started - when: (ansible_distribution == "CentOS" ) + when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") - name: Ensure Apache autostart && Apache is started on Debian service: @@ -34,7 +34,7 @@ user: name: apache groups: vitamui - when: (ansible_distribution == "CentOS" ) + when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") - name: add vitamui group to apache user on Centos user: @@ -55,7 +55,7 @@ dest: "/etc/httpd/conf.d/{{item}}" mode: 0500 owner: root - when: (ansible_distribution == "CentOS" ) + when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") notify: restart apache with_items: - "httpd-offer-view.conf" diff --git a/deployment/roles/reverse/tasks/main.yml b/deployment/roles/reverse/tasks/main.yml index 142e6b40c258f4a5811e48687ac7a2a40630ef81..3df4ec7357a367911fcb28448e8eee10654b32dc 100644 --- a/deployment/roles/reverse/tasks/main.yml +++ b/deployment/roles/reverse/tasks/main.yml @@ -3,5 +3,8 @@ - import_tasks: apache.yml when: reverse|lower == 'apache' +- import_tasks: merge_index_apache.yml + when: reverse|lower == 'apache' + - import_tasks: nginx.yml when: reverse|lower == 'nginx' diff --git a/deployment/roles/reverse/tasks/merge_index_apache.yml b/deployment/roles/reverse/tasks/merge_index_apache.yml new file mode 100644 index 0000000000000000000000000000000000000000..842168bf3e4e603ed828d83c7f19fc6eb1654103 --- /dev/null +++ b/deployment/roles/reverse/tasks/merge_index_apache.yml @@ -0,0 +1,87 @@ +# vitam_reverse_external_dns: "mitogen.env.programmevitam.fr" + # https://zo-ui.env.programmevitam.fr/ + # https://zo.env.programmevitam.fr/ui/zo-ui/services + + +- name: set vitamui_consul_url + set_fact: + vitamui_consul_url: "/ui/{{ vitam_site_name }}-ui/services" + mongo_express_uri: "https://{{ vitam_site_name }}-ui.env.programmevitam.fr/mongo-express" + +- name: save index.html + command: cp -p index.html index.html.{{ ansible_date_time.date }}-{{ ansible_date_time.time }} + args: + chdir: "/var/www/html-{{ vitam_site_name }}" + +- name: url vitam ui + blockinfile: + path: "/var/www/html-{{ vitam_site_name }}/index.html" + marker: "<!-- {mark} BEGIN ANSIBLE MANAGED BLOCK -->" + insertafter: <div class="col-md-2"><a href="/ihm-recette/" class="btn btn-primary btn-xs" target="_blank">IHM recette</a> </div> + block: | + <div class="col-md-4"><a href="https://{{ vitam_site_name }}-ui.env.programmevitam.fr" class="btn btn-primary btn-xs" target="_blank">VITAM UI</a> </div> + +- name: consul + lineinfile: + path: "/var/www/html-{{ vitam_site_name }}/index.html" + insertafter: ">Portail Consul</a>" + line: " <div class=\"col-md-4\"><a href=\"{{ vitamui_consul_url }}\" class=\"btn btn-primary btn-xs\" target=\"_blank\">Portail Consul UI</a> <a href=\"https://{{ vitam_site_name }}-ui.env.programmevitam.fr/v1/health/state/any?pretty\" class=\"btn btn-primary btn-xs\" target=\"_blank\">Services health</a></div>" + +- name: read index.html + command: cat "/var/www/html-{{ vitam_site_name }}/index.html" + register: index_content + +### block in the goal to be complient with idempotence +- block: + - name: Mongo express data + replace: + path: "/var/www/html-{{ vitam_site_name }}/index.html" + regexp: (mongo-express-offer-fs-[0-9]+.*\n.*</div>) + replace: | + \1 + <div class="col-md-3"> + {% for host in groups['hosts_vitamui_mongod'] %} + <a href="{{ mongo_express_uri }}" class="btn btn-primary btn-xs" target="_blank">Mongo express {{ hostvars[host]['mongo_cluster_name'] }}</a> + {% endfor %} + </div> + when: index_content.stdout is not search('Mongo express.*vitamui') + + + + + +### block in the goal to be complient with idempotence +### Browser vm vitam-ui +- block: + - name: debug vitam-ui + replace: + path: "/var/www/html-{{ vitam_site_name }}/index.html" + regexp: "(/nodes/vitam-env-{{ vitam_site_name }}-vm-3.vitam-env/browse.*\n.*</div>)" + replace: | + \1 + </div> + {% for item in groups['hosts_vitamui'] %} + <div class="row component-line"> + <div class="col-md-3">{{ item }}</div> + <div class="col-md-2"> + {% for groupe in groups %} + {% if item in groups[groupe] %} + {% if (groupe not in ('hosts','all','vitam','prometheus','reverse','elasticsearch','mongo_common')) and (not(groupe is search('^zone'))) %} + {{ groupe|regex_replace('hosts_', '')| replace('_','-') }}<br/> + {% endif %} + {% endif %} + {% endfor %} + </div> + <div class="col-md-2"> + {% for groupe in groups %} + {% if groupe is search('^zone') %} + {% if item in groups[groupe] %}{{ groupe| replace('_',' ') }}<br/>{% endif %} + {% endif %} + {% endfor %} + </div> + <div class="col-md-2"> + <a href="https://{{ vitam_site_name }}-ui.env.programmevitam.fr/nodes/{{ item }}/browse" class="btn btn-primary btn-xs" target="_blank">/vitam browser</a> + </div> + </div> + {% endfor %} + when: index_content.stdout is not search("/nodes/vitam-env-{{ vitam_site_name }}-vm-5.vitam-env/browse") \ No newline at end of file diff --git a/deployment/vitamui_extra.yml b/deployment/vitamui_extra.yml index 7813c8e65ba393323482b7b17413891f54e90309..d4dad918cdd6ef323cabdac9ecea8d446462d7ac 100644 --- a/deployment/vitamui_extra.yml +++ b/deployment/vitamui_extra.yml @@ -1,6 +1,6 @@ --- - hosts: hosts_browse - gather_facts: no + gather_facts: yes roles: - browser \ No newline at end of file