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