This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
настройка_стендов_слушателей [2018/07/24 08:11] val [gate.corpX.un] |
настройка_стендов_слушателей [2020/08/22 15:00] (current) val [Общие файлы конфигурации] |
||
|---|---|---|---|
| Line 8: | Line 8: | ||
| ==== Общие файлы конфигурации ==== | ==== Общие файлы конфигурации ==== | ||
| - | === Debian/Ubuntu/FreeBSD === | + | === Debian/Ubuntu === |
| <code> | <code> | ||
| Line 30: | Line 30: | ||
| ==== Debian/Ubuntu ==== | ==== Debian/Ubuntu ==== | ||
| + | |||
| + | * [[Настройка сети в Linux]] | ||
| === Gate === | === Gate === | ||
| Line 133: | Line 135: | ||
| ===== Скрипты автоконфигурации ===== | ===== Скрипты автоконфигурации ===== | ||
| + | <code> | ||
| + | # git clone http://val.bmstu.ru/unix/conf.git | ||
| + | </code> | ||
| ==== gate.corpX.un ==== | ==== gate.corpX.un ==== | ||
| <code> | <code> | ||
| Line 157: | Line 162: | ||
| search corp$X.un | search corp$X.un | ||
| nameserver 172.16.1.254 | nameserver 172.16.1.254 | ||
| + | #nameserver 192.168.$X.10 | ||
| EOF | EOF | ||
| Line 183: | Line 189: | ||
| echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf | echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf | ||
| + | |||
| + | timedatectl set-timezone Europe/Moscow | ||
| echo Success | echo Success | ||
| Line 228: | Line 236: | ||
| gateway 192.168.$X.1 | gateway 192.168.$X.1 | ||
| EOF | EOF | ||
| + | |||
| + | timedatectl set-timezone Europe/Moscow | ||
| echo Success | echo Success | ||
| Line 316: | Line 326: | ||
| 172.16.1.254; | 172.16.1.254; | ||
| }; | }; | ||
| + | empty-zones-enable no; | ||
| }; | }; | ||
| Line 342: | Line 353: | ||
| @ SOA ns root.ns 1 1d 12h 1w 3h | @ SOA ns root.ns 1 1d 12h 1w 3h | ||
| NS ns | NS ns | ||
| + | |||
| + | A 192.168.$X.10 | ||
| + | MX 1 server | ||
| ns A 192.168.$X.10 | ns A 192.168.$X.10 | ||
| Line 372: | Line 386: | ||
| echo Success | echo Success | ||
| exit 0 | exit 0 | ||
| + | </code> | ||
| + | |||
| + | ===== Ansible конфигурация ===== | ||
| + | |||
| + | <code> | ||
| + | # git clone http://val.bmstu.ru/unix/conf.git | ||
| + | </code> | ||
| + | |||
| + | <code> | ||
| + | server.isp.un:~/ansible/roles# cat host.yml | ||
| + | </code><code> | ||
| + | - name: Network config for hosts | ||
| + | hosts: corp | ||
| + | strategy: free | ||
| + | roles: | ||
| + | - host | ||
| + | </code><code> | ||
| + | server.isp.un:~/ansible/roles# cat host/tasks/main.yml | ||
| + | </code><code> | ||
| + | - name: Create hosts file | ||
| + | template: src=hosts.j2 dest=/etc/hosts | ||
| + | |||
| + | - name: Create resolv.conf file | ||
| + | template: src=resolv.conf.j2 dest=/etc/resolv.conf | ||
| + | |||
| + | - name: Create hostname file | ||
| + | template: src=hostname.j2 dest=/etc/hostname | ||
| + | |||
| + | - name: Create interfaces file | ||
| + | template: src=interfaces.j2 dest=/etc/network/interfaces | ||
| + | |||
| + | #- name: Restart system | ||
| + | # command: shutdown -r +1 | ||
| + | </code><code> | ||
| + | server.isp.un:~/ansible/roles# cat host/vars/main.yml | ||
| + | </code><code> | ||
| + | hostname: server | ||
| + | #hostname: mail | ||
| + | base_domain_prefix: corp | ||
| + | base_domain_suffix: un | ||
| + | base_net: 172.16.1 | ||
| + | gateway_octet: 254 | ||
| + | dns_ip: 172.16.1.254 | ||
| + | X: "{{ ansible_eth0.ipv4.address.split('.')[3] }}" | ||
| + | #X: "{{ ansible_eth0.ipv4.address.split('.')[3] | int - 100 }}" | ||
| + | </code><code> | ||
| + | server.isp.un:~/ansible/roles# cat host/templates/hosts.j2 | ||
| + | </code><code> | ||
| + | 127.0.0.1 localhost | ||
| + | |||
| + | {{ ansible_eth0.ipv4.address }} {{ hostname }}.{{ base_domain_prefix }}{{ X }}.{{ base_domain_suffix }} {{ hostname }} | ||
| + | |||
| + | {{ base_net }}.254 rep | ||
| + | </code><code> | ||
| + | server.isp.un:~/ansible/roles# cat host/templates/resolv.conf.j2 | ||
| + | </code><code> | ||
| + | search {{ base_domain_prefix }}{{ X }}.{{ base_domain_suffix }} | ||
| + | nameserver {{ dns_ip }} | ||
| + | </code><code> | ||
| + | server.isp.un:~/ansible/roles# cat host/templates/hostname.j2 | ||
| + | </code><code> | ||
| + | {{ hostname }}.{{ base_domain_prefix }}{{ X }}.{{ base_domain_suffix }} | ||
| + | </code><code> | ||
| + | server.isp.un:~/ansible/roles# cat host/templates/interfaces.j2 | ||
| + | </code><code> | ||
| + | auto lo | ||
| + | iface lo inet loopback | ||
| + | |||
| + | auto eth0 | ||
| + | iface eth0 inet static | ||
| + | address {{ ansible_eth0.ipv4.address }} | ||
| + | netmask 255.255.255.0 | ||
| + | gateway {{ base_net }}.{{ gateway_octet }} | ||
| + | </code><code> | ||
| + | root@server:~/ansible/roles# ansible-playbook host.yml | ||
| + | |||
| + | или | ||
| + | |||
| + | root@server:~# ansible-playbook ansible/roles/host.yml | ||
| </code> | </code> | ||