54 lines
1.3 KiB
YAML
54 lines
1.3 KiB
YAML
- name: Front - Install packages
|
|
ansible.builtin.dnf:
|
|
name: "{{ item }}"
|
|
state: present
|
|
loop: "{{ front.packages }}"
|
|
tags:
|
|
- install_front
|
|
|
|
- name: Front - Configure nginx port
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/nginx/conf.d/zabbix.conf
|
|
regexp: 'listen 8080;'
|
|
line: " listen 80;"
|
|
tags:
|
|
- install_front
|
|
notify: Restart nginx
|
|
|
|
- name: Front - Configure nginx url
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/nginx/conf.d/zabbix.conf
|
|
regexp: 'server_name example.com;'
|
|
line: " server_name {{ inventory_hostname }};"
|
|
tags:
|
|
- install_front
|
|
notify:
|
|
- Restart nginx
|
|
- Restart php-fpm
|
|
|
|
- name: Front - Configure keepalived
|
|
when: role == "srv"
|
|
block:
|
|
- name: Configure Keepalived
|
|
ansible.builtin.template:
|
|
src: keepalived.conf.j2
|
|
dest: /etc/keepalived/keepalived.conf
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
- name: Enable Keepalived service
|
|
ansible.builtin.systemd_service:
|
|
name: keepalived
|
|
state: restarted
|
|
enabled: true
|
|
|
|
- name: Enable and start
|
|
ansible.builtin.systemd_service:
|
|
name: "{{ item }}"
|
|
state: started
|
|
enabled: true
|
|
loop:
|
|
- nginx
|
|
- php-fpm
|
|
- zabbix-agent2
|