This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
настройка_стендов_слушателей [2018/10/04 13:46] val [АСТЕРИСК1,3 ЛИН5] |
настройка_стендов_слушателей [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 385: | Line 390: | ||
| ===== Ansible конфигурация ===== | ===== Ansible конфигурация ===== | ||
| - | ==== server.corpX.un ==== | + | <code> |
| - | + | # git clone http://val.bmstu.ru/unix/conf.git | |
| - | * АСТЕРИСК1,3 ЛИН5 | + | </code> |
| <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 | ||
| - | </code> | + | - name: Create resolv.conf file |
| + | template: src=resolv.conf.j2 dest=/etc/resolv.conf | ||
| - | ==== KOMM ==== | + | - name: Create hostname file |
| + | template: src=hostname.j2 dest=/etc/hostname | ||
| - | <code> | + | - 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> | ||