Playbook
---
- name: Installation d'ITSM-NG
hosts: all
become: yes
tasks:
- name: Ajout de la cle GPG (Debian/Ubuntu)
ansible.builtin.apt_key:
url: http://deb.itsm-ng.org/pubkey.gpg
state: present
when: ansible_os_family == "Debian"
- name: Ajout du depot ITSM-NG (Debian/Ubuntu)
ansible.builtin.apt_repository:
repo: "deb http://deb.itsm-ng.org/{{ ansible_distribution | lower }}/ {{ ansible_distribution_release }} main"
state: present
when : ansible_os_family == "Debian"
- name : Ajout du depot ITSM-NG (RHEL)
ansible.builtin.yum_repository:
name: ITSM-NG
description: ITSM-NG
baseurl: http://rpm.itsm-ng.org/redhat/$releasever
gpgcheck: yes
gpgkey: http://rpm.itsm-ng.org/pubkey.gpg
enabled: yes
when: ansible_os_family == "RedHat" and ansible_distribution != "Fedora"
- name: Ajout du depot ITSM-NG (Fedora)
ansible.builtin.yum_repository:
name: ITSM-NG
description: ITSM-NG
baseurl: http://rpm.itsm-ng.org/fedora/$releasever
gpgcheck: yes
gpgkey: http://rpm.itsm-ng.org/pubkey.gpg
enabled: yes
when: ansible_os_family == "RedHat" and ansible_distribution == "Fedora"
- name: Installation du paquet ITSM-NG (Debian/Ubuntu)
ansible.builtin.apt:
name: itsm-ng
state: present
update_cache: yes
when: ansible_os_family == "Debian"
- name: Installation du paquet ITSM-NG (RHEL)
ansible.builtin.dnf:
name: itsm-ng
state: present
when: ansible_os_family == "RedHat"
- name: Suppresion de la configuration par defaut d'Apache (Debian/Ubuntu)
ansible.builtin.file:
path: /etc/apache2/sites-available/000-default.conf
state: absent
register: apache2_config_removed
when: ansible_os_family == "Debian"
- name: Suppression de la configuration par defaut d'Apache (RHEL)
ansible.builtin.file:
path: /etc/httpd/conf.d/welcome.conf
state: absent
register: httpd_config_removed
when: ansible_os_family == "RedHat"
- name: Redemarrage du service Apache (Debian/Ubuntu)
ansible.builtin.service:
name: apache2
state: restarted
when: ansible_os_family == "Debian" and apache2_config_removed.changed
- name: Redemarrage du service Apache (RHEL)
ansible.builtin.service:
name: httpd
state: restarted
when: ansible_os_family == "RedHat" and httpd_config_removed.changed