Ansible
- Ansible(1)Ansibleの概要
- Ansible(2)ファイル関連モジュール
- Ansible(3)システム管理モジュール
- Ansible(4)コマンド実行モジュール
- Ansible(5)パッケージ管理関連モジュール
cron
cronの設定を行う。
| 変数 | デフォルト | 内容 | 備考 |
|---|---|---|---|
| name | cron名 | ||
| job | 実行コマンド | ||
| minute | * | 分 | |
| hour | * | 時 | |
| day | * | 日 | |
| month | * | 月 | |
| month | * | 月 | |
| state | present | 実行内容 | absent, present |
Example
- name: Ensure a job that runs at 2 and 5 exists. Creates an entry like "0 5,2 * * ls -alh > /dev/null"
cron:
name: "check dirs"
minute: "0"
hour: "5,2"
job: "ls -alh > /dev/null"
group
グループを管理する。
| 変数 | デフォルト | 内容 | 備考 |
|---|---|---|---|
| name | 必須 | グループ名 | |
| state | present | 実行内容 | absent, present |
Example
- name: Ensure group "somegroup" exists
group:
name: somegroup
state: present
lvol
LVMボリュームを作成する。
| 変数 | デフォルト | 内容 | 備考 |
|---|---|---|---|
| vg | ボリュームグループ名 | ||
| lv | 論理ボリューム名 | ||
| size | ボリュームサイズ | ||
| state | present | 実行内容 | absent, present |
Example
- name: Create a logical volume of 512m
lvol:
vg: firefly
lv: test
size: 512
mount
ファイルシステムをマウントする。
| 変数 | デフォルト | 内容 | 備考 |
|---|---|---|---|
| path | 必須 | マウントポイント | |
| state | 必須 | 実行内容 | absent, mounted, present, unmounted |
| src | マウントパス | ||
| fstype | ファイルシステム |
selinux
SELinuxのポリシーを変更する。
| 変数 | デフォルト | 内容 | 備考 |
|---|---|---|---|
| state | None | 実行内容 | enforcing, permissive, disabled |
Example
# Enable SELinux
- selinux:
policy: targeted
state: enforcing
sysctl
sysctl.confを管理する。
| 変数 | デフォルト | 内容 | 備考 |
|---|---|---|---|
| name | 必須 | キー | |
| value | 値 | ||
| state | present | 実行内容 | absent, present |
Example
# Set vm.swappiness to 5 in /etc/sysctl.conf
- sysctl:
name: vm.swappiness
value: 5
state: present
user
ユーザを管理する。
| 変数 | デフォルト | 内容 | 備考 |
|---|---|---|---|
| name | 必須 | ユーザ名 | |
| password | パスワード | ||
| groups | グループ名 | ||
| shell | シェル | ||
| createhome | yes | ホームディレクトリを作るかどうか | |
| home | ホームディレクトリ |
Example
- name: Add the user 'johnd' with a specific uid and a primary group of 'admin'
user:
name: johnd
comment: John Doe
uid: 1040
group: admin
timezone
タイムゾーンを設定する。
| 変数 | デフォルト | 内容 | 備考 |
|---|---|---|---|
| name | タイムゾーン |
Example
- name: set timezone to Asia/Tokyo
timezone:
name: Asia/Tokyo