Coomon Playbook
Description
デフォルトで必要になるパッケージのインストールから、
ネットワーク設定やSELinuxなどOSの初期設定関連を行うプレイブック。
playbook構成
- handlers
- tasks
- templates
handlers
Restart hostnamed
systemd restart hostnamed
Reflect interface
nmcli setup attach
tasks
Task Name | main.yml |
---|---|
Path | common_roles/common/tasks/main.yml |
tags | init |
task list
- Install libselinux-python
- Install NetworkManager-glib
- selinux setting
- locale setting
- localtime setting
- clock setting
- hostname setting
- hosts adding
- resolve setting
- systemd setting
- sysctl setting
- defalut disable services
templates
- hosts.j2
- sysctl.conf.j2
- system.conf.j2
vars
http_proxy
yum等で利用する外部通信時にProxyがある場合に定義
Vars Name | http_proxy |
---|---|
valu | Proxy server name |
default | - |
example:
http_proxy: hogehoge.proxy.com
http_proxy_port
yum等で利用する外部通信時にProxyがある場合に定義
Vars Name | http_proxy_port |
---|---|
valu | Proxy server port |
default | 8080 |
example:
http_proxy_port: 8080
init_network_set
ネットワーク設定タイプを定義
Vars Name | init_network_set |
---|---|
valu | static / dhcp |
default | static |
example:
network_set: 'static'
init_hostname
サーバーホスト名の定義
デフォルトではサーバ上に設定してある値が代入されます。
Vars Name | init_hostname |
---|---|
valu | hostname |
default | ansible_hostname |
example:
hostname: "{{ ansible_hostname }}"
init_default_gateway*
固定IPの場合に設定するデフォルトゲートウェイIPの定義
デフォルトではサーバ上に設定されている値が代入されます。
Vars Name | init_default_gateway |
---|---|
valu | ip address |
default | ansible_default_ipv4.gateway |
example:
default_gateway: "{{ ansible_default_ipv4.gateway }}"
init_default_interface
Vars Name | init_default_interface |
---|---|
valu | ip address |
default | ansible_default_ipv4.interface |
example:
init_default_interface: "{{ ansible_default_ipv4.interface }}"
init_hosts
サーバのhostsに設定したい内容を定義
デフォルトでは自身のホスト情報のみ追記
Vars Name | hosts | |
---|---|---|
sub vars | name | |
valu | domain name | |
default | ansible_hostname | |
sub vars | ip | |
valu | ip address | |
default | ansible_default_ipv4.address |
example:
hosts:
- name: "{{ ansible_hostname }}"
ip: "{{ ansible_default_ipv4.address }}"
init_dns
resolvに定義する参照DNSサーバーを定義
Vars Name | init_dns |
---|---|
valu | ip address |
default | 8.8.8.8 8.8.4.4 |
example:
dns_servers:
- 8.8.8.8 8.8.4.4
init_disable_services
自動起動無効にするサービスを定義
Vars Name | init_disable_services |
---|---|
valu | service name |
default | auditd |
example:
disable_services:
- auditd