Commit 70ab22a9 authored by Assaf Flatto's avatar Assaf Flatto

Modify the mysql IDO permissions

Fix structure to new format
parent ecb10f51
......@@ -41,7 +41,7 @@
name: "{{ icinga2_db_user }}"
password: "{{ icinga2_db_pass }}"
state: present
priv: "{{ icinga2_db }}.*:GRANT,INSERT,SELECT,UPDATE,DELETE,DROP,CREATE VIEW,INDEX,EXECUTE"
priv: "{{ icinga2_db }}.*:ALL"
- name: Import the IDO Schema on Icinga Web Database (only once)
mysql_db:
......
---
- name: Install Icinga2 IDO modules on RedHat OS family
yum: name=icinga2-ido-mysql
state=latest
yum:
name: icinga2-ido-mysql
state: latest
when: ansible_pkg_mgr == "yum"
- name: Install Icinga2 IDO modules on RedHat OS family (Fedora > 22)
dnf: name=icinga2-ido-mysql
state=latest
dnf:
name: icinga2-ido-mysql
state: latest
when: ansible_pkg_mgr == "dnf"
- name: Create a IDO Database for Icinga2
mysql_db: name={{ icinga2_db }}
state=present
mysql_db:
name: "{{ icinga2_db }}"
state: present
register: icinga_ido_db
- name: Create Icinga2 IDO Database User and configure Grants
mysql_user: name={{ icinga2_db_user }}
password={{ icinga2_db_pass }}
state=present
priv="{{ icinga2_db }}.*:GRANT,INSERT,SELECT,UPDATE,DELETE,DROP,CREATE VIEW,INDEX,EXECUTE"
mysql_user:
name: "{{ icinga2_db_user }}"
password: "{{ icinga2_db_pass }}"
state: present
priv: "{{ icinga2_db }}.*:INSERT,SELECT,UPDATE,DELETE,DROP,CREATE VIEW,INDEX,EXECUTE"
- name: Import the IDO Schema on Icinga Web Database (only once)
mysql_db: name={{ icinga2_db }}
state=import
target={{ icinga2_web_mysql_schema_rh }}
mysql_db:
name: "{{ icinga2_db }}"
state: import
target: "{{ icinga2_web_mysql_schema_rh }}"
when: icinga_ido_db.changed == true
- name: Configure Icinga2 Ido Mysql Feature
template: src=ido-mysql.conf.j2
dest={{ icinga2_ido_mysql_conf }}
backup=yes
owner=icinga
group=icinga
mode=0640
template:
src: "ido-mysql.conf.j2"
dest: "{{ icinga2_ido_mysql_conf }}"
backup: yes
owner: "icinga"
group: "icinga"
mode: 0640
when: icinga2_ido_mysql_configuration is defined
- name: Enable Icinga2 Ido Mysql Feature
......@@ -87,36 +93,41 @@
- name: Install Icinga Web2 on RedHat OS family
yum: name={{ item }}
state=latest
enablerepo={{ enablerepo }}
yum:
name: "{{ item }}"
state: latest
enablerepo: "{{ enablerepo }}"
with_items: "{{ icinga2_web2_ui_rpm }}"
tags: icinga2-ansible-web2-ui-install
when: ansible_pkg_mgr == "yum"
- name: Install Icinga Web2 on RedHat OS family
dnf: name={{ item.package }}
state=latest
enablerepo={{ enablerepo }}
dnf:
name: "{{ item }}"
state: latest
enablerepo: "{{ enablerepo }}"
with_items: "{{ icinga2_web2_ui_rpm }}"
tags: icinga2-ansible-web2-ui-install
when: ansible_pkg_mgr == "dnf"
- name: Create a Web Database for Icinga2
mysql_db: name={{ icinga2_web2_db }}
state=present
mysql_db:
name: "{{ icinga2_web2_db }}"
state: present
register: icinga_web_db
- name: Create Icinga2 Web Database User and configure Grants
mysql_user: name={{ icinga2_web2_db_user }}
password={{ icinga2_web2_db_pass }}
state=present
priv="{{ icinga2_web2_db }}.*:GRANT,INSERT,SELECT,UPDATE,DELETE,DROP,CREATE VIEW,INDEX,EXECUTE"
mysql_user:
name: "{{ icinga2_web2_db_user }}"
password: "{{ icinga2_web2_db_pass }}"
state: present
priv: "{{ icinga2_web2_db }}.*:INSERT,SELECT,UPDATE,DELETE,DROP,CREATE VIEW,INDEX,EXECUTE"
- name: Import the Web Schema on Icinga Web Database (only once)
mysql_db: name={{ icinga2_web2_db }}
state=import
target={{ icinga2_web2_mysql_schema_rh }}
mysql_db:
name: "{{ icinga2_web2_db }}"
state: import
target: "{{ icinga2_web2_mysql_schema_rh }}"
when: icinga_web_db.changed == true
- name: Define web server daemon package.
......@@ -125,9 +136,10 @@
when: web_server_daemon is not defined
- name: Restart {{ web_server_daemon }} and Icinga2 to Apply the Configuration
service: name={{ item }}
state=restarted
enabled=yes
service:
name: "{{ item }}"
state: restarted
enabled: yes
with_items:
- "{{ web_server_daemon }}"
- icinga2
......@@ -135,9 +147,10 @@
when: ansible_pkg_mgr == "dnf"
- name: Restart {{ web_server_daemon }} and Icinga2 to Apply the Configuration
service: name={{ item }}
state=restarted
enabled=yes
service:
name: "{{ item }}"
state: restarted
enabled: yes
with_items:
- "{{ web_server_daemon }}"
- icinga2
......@@ -147,9 +160,10 @@
- ansible_distribution_major_version == "7"
- name: Restart {{ web_server_daemon }} and Icinga2 to Apply the Configuration
service: name={{ item }}
state=restarted
enabled=yes
service:
name: "{{ item }}"
state: restarted
enabled: yes
with_items:
- "{{ web_server_daemon }}"
- icinga2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment