first commit
This commit is contained in:
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
sed -i 's/quiet/quiet\ ipv6\.disable\=1/' /etc/default/grub
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
hostname=`hostname`
|
||||
hostname=$hostname.czech-tv.cz
|
||||
echo "$hostname" | sed -i "s/servername/$hostname/" /etc/nginx/sites-available/default
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
phpversion=`systemctl | grep running | grep php | grep fpm | cut -d "-" -f 1 | cut -b 6-8`
|
||||
sed -i 's/\;ping.path/ping.path/' /etc/php/`echo $phpversion`/fpm/pool.d/www.conf
|
||||
sed -i 's/\;pm.status/pm.status/' /etc/php/`echo $phpversion`/fpm/pool.d/www.conf
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
- name: Provotni instalace serveru
|
||||
hosts: all
|
||||
become: true
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- name: Install NGINX
|
||||
apt:
|
||||
name: nginx-full
|
||||
state: present
|
||||
- name: Copy config file status
|
||||
copy:
|
||||
src: status_nginx
|
||||
dest: /etc/nginx/sites-available/status
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
- name: Add value for nginx
|
||||
local_action:
|
||||
module: zabbix_hostmacro
|
||||
server_url: http://zabbix.czech-tv.cz
|
||||
login_user: sm233387
|
||||
login_password: JaNa1975
|
||||
host_name: "{{inventory_hostname}}"
|
||||
macro_name: "{$NGINX.STUB_STATUS.PORT}"
|
||||
macro_value: 8080
|
||||
state: present
|
||||
- name: Check system information
|
||||
shell: "ln -sf /etc/nginx/sites-available/status /etc/nginx/sites-enabled/"
|
||||
- name: NGINX restart
|
||||
ansible.builtin.service:
|
||||
name: nginx
|
||||
state: restarted
|
||||
enabled: true
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
- name: Playbook to install chrony
|
||||
hosts: all
|
||||
become: true
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Install Chrony
|
||||
apt:
|
||||
name: chrony
|
||||
state: present
|
||||
- name: Copy config file
|
||||
copy:
|
||||
src: chrony.conf
|
||||
dest: /etc/chrony/chrony.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
- name: chorny restart
|
||||
ansible.builtin.service:
|
||||
name: chrony
|
||||
state: restarted
|
||||
enabled: true
|
||||
Executable
+71
@@ -0,0 +1,71 @@
|
||||
- name: NGINX
|
||||
hosts: all
|
||||
become: true
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- name: Install NGINX
|
||||
apt:
|
||||
name: nginx-full
|
||||
state: present
|
||||
- name: Copy config file status
|
||||
copy:
|
||||
src: status_nginx
|
||||
dest: /etc/nginx/sites-available/status
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
- name: Copy config file status
|
||||
copy:
|
||||
src: name_nginx
|
||||
dest: /tmp/name
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
- name: Copy config file default
|
||||
copy:
|
||||
src: default_nginx
|
||||
dest: /etc/nginx/sites-available/default
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
- name: Rename hostname
|
||||
shell:
|
||||
"/tmp/name"
|
||||
- name: Delete files name
|
||||
shell:
|
||||
"rm -f /tmp/name"
|
||||
- name: Add value for nginx
|
||||
local_action:
|
||||
module: zabbix_hostmacro
|
||||
server_url: https://zabbix.czech-tv.cz
|
||||
login_user: ansict
|
||||
login_password: Sojka123456
|
||||
host_name: "{{inventory_hostname}}"
|
||||
macro_name: "{$NGINX.STUB_STATUS.PORT}"
|
||||
macro_value: 8080
|
||||
state: present
|
||||
- name: Symlink na status
|
||||
shell:
|
||||
"ln -sf /etc/nginx/sites-available/status /etc/nginx/sites-enabled/"
|
||||
- name: Create CERT dir
|
||||
shell:
|
||||
"mkdir -p /etc/nginx/cert"
|
||||
- name: Copy key file
|
||||
copy:
|
||||
src: CT.key
|
||||
dest: /etc/nginx/cert/CT.key
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
- name: Copy cert file
|
||||
copy:
|
||||
src: CT.crt
|
||||
dest: /etc/nginx/cert/CT.crt
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
- name: NGINX restart
|
||||
ansible.builtin.service:
|
||||
name: nginx
|
||||
state: restarted
|
||||
enabled: true
|
||||
Executable
+91
@@ -0,0 +1,91 @@
|
||||
- name: PHP
|
||||
hosts: all
|
||||
become: true
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- name: Install PHP
|
||||
apt:
|
||||
name: php-fpm
|
||||
state: present
|
||||
- name: Copy config file status
|
||||
copy:
|
||||
src: status_nginx_php
|
||||
dest: /etc/nginx/sites-available/status
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
- name: Copy config file index.php
|
||||
copy:
|
||||
src: index.php
|
||||
dest: /var/www/html/
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: 0644
|
||||
- name: Copy config file default
|
||||
copy:
|
||||
src: default_php_nginx
|
||||
dest: /etc/nginx/sites-available/default
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
- name: Copy php enabled status
|
||||
copy:
|
||||
src: php_enabled_status
|
||||
dest: /tmp/php_enabled_status
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
- name: Run php enabled status
|
||||
shell:
|
||||
"/tmp/php_enabled_status"
|
||||
- name: Create a new host or update an existing host's info
|
||||
local_action:
|
||||
module: zabbix_host
|
||||
server_url: https://zabbix.czech-tv.cz
|
||||
login_user: ansict
|
||||
login_password: Sojka123456
|
||||
host_name: '{{inventory_hostname}}'
|
||||
host_groups:
|
||||
- Linux servers
|
||||
link_templates:
|
||||
- PHP-FPM by Zabbix agent
|
||||
- Linux by Zabbix agent
|
||||
- SSH Service
|
||||
- Nginx by Zabbix agent
|
||||
interfaces:
|
||||
- type: 1
|
||||
main: 1
|
||||
useip: 1
|
||||
ip: "{{hostvars[inventory_hostname]['ansible_default_ipv4']['address']}}"
|
||||
dns: "{{inventory_hostname}}"
|
||||
port: 10050
|
||||
- name: Add value for PHP
|
||||
local_action:
|
||||
module: zabbix_hostmacro
|
||||
server_url: https://zabbix.czech-tv.cz
|
||||
login_user: ansict
|
||||
login_password: Sojka123456
|
||||
host_name: "{{inventory_hostname}}"
|
||||
macro_name: "{$PHP_FPM.PORT}"
|
||||
macro_value: 8080
|
||||
state: present
|
||||
- name: Add value for PHP
|
||||
local_action:
|
||||
module: zabbix_hostmacro
|
||||
server_url: https://zabbix.czech-tv.cz
|
||||
login_user: ansict
|
||||
login_password: Sojka123456
|
||||
host_name: "{{inventory_hostname}}"
|
||||
macro_name: "{$PHP_FPM.PROCESS_NAME}"
|
||||
macro_value: php-fpm7.4
|
||||
state: present
|
||||
- name: PHP-FPM restart
|
||||
ansible.builtin.service:
|
||||
name: php7.4-fpm
|
||||
state: restarted
|
||||
enabled: true
|
||||
- name: NGINX restart
|
||||
ansible.builtin.service:
|
||||
name: nginx
|
||||
c state: restarted
|
||||
enabled: true
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
- name: First install
|
||||
hosts: all
|
||||
become: true
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- name: Install open-vm-tools
|
||||
apt:
|
||||
name: open-vm-tools
|
||||
state: presentcat
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
- name: Playbook to install zabbix
|
||||
hosts: all
|
||||
vars:
|
||||
ipa: "hostvars[inventory_hostname]['ansible_default_ipv4']['address']"
|
||||
become: true
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- name: Install zabbix
|
||||
apt:
|
||||
name: zabbix-agent
|
||||
state: present
|
||||
- name: Copy agent config file
|
||||
copy:
|
||||
src: zabbix_agentd.conf
|
||||
dest: /etc/zabbix/zabbix_agentd.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
- name: zabbix restart
|
||||
ansible.builtin.service:
|
||||
name: zabbix-agent
|
||||
state: restarted
|
||||
enabled: true
|
||||
- debug: var=hostvars[inventory_hostname]['ansible_default_ipv4']['address']
|
||||
- name: Create a new host or update an existing host's info
|
||||
local_action:
|
||||
module: zabbix_host
|
||||
server_url: https://zabbix.czech-tv.cz
|
||||
login_user: ansict
|
||||
login_password: Sojka123456
|
||||
host_name: '{{inventory_hostname}}'
|
||||
host_groups:
|
||||
- Linux servers
|
||||
link_templates:
|
||||
- Linux by Zabbix agent
|
||||
- SSH Service
|
||||
interfaces:
|
||||
- type: 1
|
||||
main: 1
|
||||
useip: 1
|
||||
ip: "{{hostvars[inventory_hostname]['ansible_default_ipv4']['address']}}"
|
||||
dns: "{{inventory_hostname}}"
|
||||
port: 10050
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
- name: Last install
|
||||
hosts: all
|
||||
become: true
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- name: Copy file disable IPV6
|
||||
copy:
|
||||
src: ipv6dis
|
||||
dest: /tmp/ipv6dis
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
- name: Run script disable IPV6
|
||||
shell:
|
||||
"/tmp/ipv6dis"
|
||||
- name: Regenerate grub
|
||||
shell:
|
||||
"update-grub"
|
||||
- name: Restart machine
|
||||
command: shutdown -r now
|
||||
async: 1
|
||||
poll: 0
|
||||
ignore_errors: true
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
CREATE USER 'zbx_monitor'@'%' IDENTIFIED BY 'datel1234';
|
||||
GRANT REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON *.* TO 'zbx_monitor'@'%';
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
# Databaze
|
||||
CREATE USER zbx_monitor WITH PASSWORD 'datel1234' INHERIT;
|
||||
GRANT pg_monitor TO zbx_monitor;
|
||||
|
||||
# Test pripojeni
|
||||
psql -h 127.0.0.1 --username=zbx_monitor postgres
|
||||
|
||||
# konfiguracni sobory
|
||||
mkdir /var/lib/zabbix/
|
||||
cp -a postgresql/ /var/lib/zabbix/
|
||||
cp template_db_postgresql.conf /etc/zabbix/zabbix_agentd.conf.d/
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
{$NGINX.STUB_STATUS.PORT}
|
||||
{$PHP_FPM.PORT}
|
||||
{$PHP_FPM.PROCESS_NAME}
|
||||
Reference in New Issue
Block a user