community.general.aix_inittab 模块 – 管理 AIX 上的 inittab
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible
包,您可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要其他要求才能使用此模块,请参阅要求了解详细信息。
要在 playbook 中使用它,请指定:community.general.aix_inittab
。
概要
管理 AIX 上的 inittab。
要求
在执行此模块的主机上需要以下要求。
itertools
参数
参数 |
注释 |
---|---|
init 需要对这个条目执行的操作。 选项
|
|
必须运行什么命令。 |
|
新条目应插入到哪个 inittabline 之后。 |
|
inittab 条目的名称。 |
|
条目的运行级别。 |
|
该条目是否应在 inittab 文件中存在或不存在。 选项
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持: 完整 |
可以在 |
|
支持: 无 |
当处于 diff 模式时,将返回已更改的内容(或在 |
注释
注意
这些更改在重新启动后仍然存在。
您需要 root 权限才能使用
lsitab
、chitab
、mkitab
或rmitab
命令读取或调整 inittab。已在 AIX 7.1 上测试。
示例
# Add service startmyservice to the inittab, directly after service existingservice.
- name: Add startmyservice to inittab
community.general.aix_inittab:
name: startmyservice
runlevel: 4
action: once
command: echo hello
insertafter: existingservice
state: present
become: true
# Change inittab entry startmyservice to runlevel "2" and processaction "wait".
- name: Change startmyservice to inittab
community.general.aix_inittab:
name: startmyservice
runlevel: 2
action: wait
command: echo hello
state: present
become: true
- name: Remove startmyservice from inittab
community.general.aix_inittab:
name: startmyservice
runlevel: 2
action: wait
command: echo hello
state: absent
become: true
返回值
常见的返回值记录在此处,以下是此模块独有的字段
键 |
描述 |
---|---|
inittab 是否已更改 返回: 始终 示例: |
|
对 inittab 条目执行的操作 返回: 已更改 示例: |
|
调整后的 inittab 条目的名称 返回: 始终 示例: |