Update to 2022-03-07 16:00

This commit is contained in:
Daniel Berteaud
2022-03-07 16:00:05 +01:00
parent be6bc20783
commit 1065df387c
99 changed files with 761 additions and 303 deletions

View File

@@ -0,0 +1,9 @@
---
- import_tasks: ../includes/webapps_compress_archive.yml
vars:
- root_dir: "{{ itop_root_dir }}"
- version: "{{ itop_current_version }}"
when: itop_install_mode == 'upgrade'
tags: itop

View File

@@ -0,0 +1,10 @@
---
- import_tasks: ../includes/webapps_archive.yml
vars:
- root_dir: "{{ itop_root_dir }}"
- version: "{{ itop_current_version }}"
- db_name: "{{ itop_db_name }}"
- db_server: "{{ itop_db_server }}"
tags: itop

View File

@@ -0,0 +1,13 @@
---
- name: Remove temp and obsolete files
file: path={{ item }} state=absent
loop:
- "{{ itop_root_dir }}/tmp/iTop-{{ itop_version }}-{{ itop_build }}.zip"
- "{{ itop_root_dir }}/tmp/web"
- "{{ itop_root_dir }}/tmp/INSTALL"
- "{{ itop_root_dir }}/tmp/README"
- "{{ itop_root_dir }}/tmp/LICENSE"
- "{{ itop_root_dir }}/tmp/CAS-{{ itop_php_cas_version }}"
- "{{ itop_root_dir }}/tmp/CAS-{{ itop_php_cas_version }}.tgz"
tags: itop

View File

@@ -0,0 +1,12 @@
---
- import_tasks: ../includes/webapps_webconf.yml
vars:
- app_id: itop_{{ itop_id }}
- php_version: "{{ itop_php_version }}"
- php_fpm_pool: "{{ itop_php_fpm_pool | default('') }}"
tags: itop
- name: Deploy cron param file
template: src=cron.param.j2 dest={{ itop_root_dir }}/etc/cron.params group={{ itop_php_user }} mode=640
tags: itop

View File

@@ -0,0 +1,29 @@
---
- name: Create directory structure
file: path={{ item.dir }} state=directory owner={{ item.owner | default(omit) }} group={{ item.group | default(omit) }} mode={{ item.mode | default(omit) }}
with_items:
- dir: "{{ itop_root_dir }}"
- dir: "{{ itop_root_dir }}/archives"
mode: 700
- dir: "{{ itop_root_dir }}/tmp"
owner: "{{ itop_php_user }}"
mode: 700
- dir: "{{ itop_root_dir }}/sessions"
owner: "{{ itop_php_user }}"
mode: 700
- dir: "{{ itop_root_dir }}/meta"
mode: 700
- dir: "{{ itop_root_dir }}/backup"
mode: 700
- dir: "{{ itop_root_dir }}/etc"
group: "{{ itop_php_user }}"
mode: 750
- dir: "{{ itop_root_dir }}/web/data"
- dir: "{{ itop_root_dir }}/web/conf"
- dir: "{{ itop_root_dir }}/web/env-production"
- dir: "{{ itop_root_dir }}/web/env-production-build"
- dir: "{{ itop_root_dir }}/web/log"
- dir: "{{ itop_root_dir }}/web/extensions"
tags: itop

View File

@@ -0,0 +1,19 @@
---
- block:
- import_tasks: ../includes/webapps_set_install_mode.yml
vars:
- root_dir: "{{ itop_root_dir }}"
- version: "{{ itop_version }}"
- set_fact: itop_install_mode={{ (install_mode == 'upgrade' and not itop_manage_upgrade) | ternary('none',install_mode) }}
- set_fact: itop_current_version={{ current_version | default('') }}
tags: itop
- when: itop_db_pass is not defined
block:
- import_tasks: ../includes/get_rand_pass.yml
vars:
- pass_file: "{{ itop_root_dir }}/meta/ansible_dbpass"
- set_fact: itop_db_pass={{ rand_pass }}
tags: itop

View File

@@ -0,0 +1,5 @@
---
- name: Deploy filebeat configuration
template: src=filebeat.yml.j2 dest=/etc/filebeat/ansible_inputs.d/itop_{{ itop_id }}.yml
tags: itop,log

View File

@@ -0,0 +1,122 @@
---
- name: Install needed tools
yum:
name:
- tar
- mariadb
- acl
- graphviz
tags: itop
- when: itop_install_mode != 'none'
block:
- name: Download iTop
get_url:
url: "{{ itop_archive_url }}"
dest: "{{ itop_root_dir }}/tmp/"
checksum: "sha1:{{ itop_archive_sha1 }}"
- name: Extract iTop archive
unarchive:
src: "{{ itop_root_dir }}/tmp/iTop-{{ itop_version }}-{{ itop_build }}.zip"
dest: "{{ itop_root_dir }}/tmp"
remote_src: yes
- name: Remove previous install
file: path={{ itop_root_dir }}/web/{{ item }} state=absent
loop:
- addons
- datamodels
- images
- lib
- manifest.xml
- portal
- application
- core
- dictionnaries
- env-test
- index.php
- navigator
- setup
- webservices
- approot.inc.php
- css
- js
- pages
- synchro
- sources
- documentation
- name: Install new version of iTop
synchronize:
src: "{{ itop_root_dir }}/tmp/web/"
dest: "{{ itop_root_dir }}/web/"
recursive: True
delegate_to: "{{ inventory_hostname }}"
- name: Download php CAS lib
get_url:
url: "{{ itop_php_cas_archive_url }}"
checksum: sha1:{{ itop_php_cas_archive_sha1 }}
dest: "{{ itop_root_dir }}/tmp"
- name: Extract php CAS lib
unarchive:
src: "{{ itop_root_dir }}/tmp/CAS-{{ itop_php_cas_version }}.tgz"
dest: "{{ itop_root_dir }}/tmp"
remote_src: True
- name: Install php CAS lib
synchronize:
src: "{{ itop_root_dir }}/tmp/CAS-{{ itop_php_cas_version }}/{{ item }}"
dest: "{{ itop_root_dir }}/web/lib/"
recursive: True
delegate_to: "{{ inventory_hostname }}"
loop:
- CAS.php
- CAS
tags: itop
- name: Ensure env-production directories exist
file: path={{ itop_root_dir }}/web/{{ item }} state=directory
loop:
- env-production
- env-production-build
tags: itop
- import_tasks: ../includes/webapps_create_mysql_db.yml
vars:
- db_name: "{{ itop_db_name }}"
- db_user: "{{ itop_db_user }}"
- db_server: "{{ itop_db_server }}"
- db_pass: "{{ itop_db_pass }}"
tags: itop
- name: Install backup hooks
template: src={{ item }}-backup.sh.j2 dest=/etc/backup/{{ item }}.d/itop_{{ itop_id }} mode=700
loop:
- pre
- post
tags: itop
- name: Install systemd units
template: src=itop.{{ item }}.j2 dest=/etc/systemd/system/itop_{{ itop_id }}.{{ item }}
loop:
- service
- timer
register: itop_units
tags: itop
- name: Reload systemd
systemd: daemon_reload=True
when: itop_units.results | selectattr('changed','equalto',True) | list | length > 0
tags: itop
- name: Enable iTop timer
systemd:
name: itop_{{ itop_id }}.timer
state: "{{ (itop_cron_user is defined and itop_cron_pass is defined) | ternary('started','stopped') }}"
enabled: "{{ (itop_cron_user is defined and itop_cron_pass is defined) | ternary(True,False) }}"
tags: itop

View File

@@ -0,0 +1,32 @@
---
- include_tasks: user.yml
tags: always
- include_tasks: directories.yml
tags: always
- include_tasks: facts.yml
tags: always
- include_tasks: archive_pre.yml
when: itop_install_mode | dfefault('none') == 'upgrade'
tags: always
- include_tasks: install.yml
tags: always
- include_tasks: conf.yml
tags: always
- include_tasks: archive_post.yml
when: itop_install_mode | default('none') == 'upgrade'
tags: always
- include_tasks: write_version.yml
tags: always
- include_tasks: cleanup.yml
tags: always
- include_tasks: filebeat.yml
tags: always

View File

@@ -0,0 +1,8 @@
---
- import_tasks: ../includes/create_system_user.yml
vars:
- user: "{{ itop_php_user }}"
- comment: "PHP FPM for itop {{ itop_id }}"
tags: itop

View File

@@ -0,0 +1,8 @@
---
- import_tasks: ../includes/webapps_post.yml
vars:
- root_dir: "{{ itop_root_dir }}"
- version: "{{ itop_version }}"
tags: itop