You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
2.4 KiB
98 lines
2.4 KiB
---
|
|
- name: install prequisities
|
|
package:
|
|
name: "{{ item }}"
|
|
loop: "{{ icinga2_packages_pre_openbsd }}"
|
|
|
|
- name: reload facts
|
|
setup:
|
|
|
|
- name: install packages
|
|
package:
|
|
name: "{{ item }}"
|
|
loop: "{{ icinga2_packages }}"
|
|
|
|
- name: enable and start rc service
|
|
service:
|
|
name: "{{ item }}"
|
|
state: started
|
|
enabled: yes
|
|
loop: "{{ icinga2_systemd_services }}"
|
|
|
|
- name: create mysql db
|
|
mysql_db:
|
|
login_host: "{{ icinga2_mysql_auth.host }}"
|
|
login_user: "{{ icinga2_mysql_auth.user }}"
|
|
login_password: "{{ icinga2_mysql_auth.password }}"
|
|
name: "{{ icinga2_mysql_db.name }}"
|
|
state: present
|
|
target: "{{ icinga2_mysql_db.schema_openbsd }}"
|
|
register: db_created
|
|
|
|
- name: import mysql schema
|
|
mysql_db:
|
|
login_host: "{{ icinga2_mysql_auth.host }}"
|
|
login_user: "{{ icinga2_mysql_auth.user }}"
|
|
login_password: "{{ icinga2_mysql_auth.password }}"
|
|
name: "{{ icinga2_mysql_db.name }}"
|
|
state: import
|
|
target: "{{ icinga2_mysql_db.schema_openbsd }}"
|
|
when: db_created.changed
|
|
|
|
- name: create mysql users
|
|
mysql_user:
|
|
login_host: "{{ icinga2_mysql_auth.host }}"
|
|
login_user: "{{ icinga2_mysql_auth.user }}"
|
|
login_password: "{{ icinga2_mysql_auth.password }}"
|
|
name: "{{ icinga2_mysql_db.user }}"
|
|
password: "{{ icinga2_mysql_db.password }}"
|
|
priv: "{{ icinga2_mysql_db.name }}.*:ALL"
|
|
state: present
|
|
|
|
- name: deploy icinga2 ido-mysql config
|
|
template:
|
|
src: ido-mysql.conf
|
|
dest: /etc/icinga2/features-available/ido-mysql.conf
|
|
|
|
- name: enable icinga2 features
|
|
command: "icinga2 feature enable {{ item }}"
|
|
loop: "{{ icinga2_features }}"
|
|
notify: restart_icinga2
|
|
|
|
- name: setup icinga2 api
|
|
command: "icinga2 api setup"
|
|
when: '"api" in icinga2_features'
|
|
|
|
- name: configure icinga2 api users
|
|
template:
|
|
src: api-users.conf
|
|
dest: /etc/icinga2/conf.d/api-users.conf
|
|
when: '"api" in icinga2_features'
|
|
notify: restart_icinga2
|
|
|
|
- name: create icinga dirs
|
|
file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: _icinga
|
|
loop:
|
|
- /var/icinga
|
|
- /var/icinga/.ssh
|
|
|
|
- name: create ssh key
|
|
openssh_keypair:
|
|
path: /var/icinga/.ssh/id_rsa
|
|
|
|
- name: set ssh key owner
|
|
file:
|
|
path: "{{ item }}"
|
|
owner: _icinga
|
|
loop:
|
|
- /var/icinga/.ssh/id_rsa
|
|
- /var/icinga/.ssh/id_rsa.pub
|
|
|
|
- name: copy ssh config
|
|
copy:
|
|
src: ssh_config
|
|
dest: /var/icinga/.ssh/config
|
|
owner: _icinga
|
|
|