�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z y d d l
m Z Wn e k
r e
Z n Xd d l m Z d
� Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
---
author:
- Joris Weijters (@molekuul)
module: aix_inittab
short_description: Manages the inittab on AIX
description:
- Manages the inittab on AIX.
version_added: "2.3"
options:
name:
description:
- Name of the inittab entry.
type: str
required: yes
aliases: [ service ]
runlevel:
description:
- Runlevel of the entry.
type: str
required: yes
action:
description:
- Action what the init has to do with this entry.
type: str
required: yes
choices:
- boot
- bootwait
- hold
- initdefault
- 'off'
- once
- ondemand
- powerfail
- powerwait
- respawn
- sysinit
- wait
command:
description:
- What command has to run.
type: str
required: yes
insertafter:
description:
- After which inittabline should the new entry inserted.
type: str
state:
description:
- Whether the entry should be present or absent in the inittab file.
type: str
choices: [ absent, present ]
default: present
notes:
- The changes are persistent across reboots.
- You need root rights to read or adjust the inittab with the C(lsitab), C(chitab), C(mkitab) or C(rmitab) commands.
- Tested on AIX 7.1.
requirements:
- itertools
s�
# Add service startmyservice to the inittab, directly after service existingservice.
- name: Add startmyservice to inittab
aix_inittab:
name: startmyservice
runlevel: 4
action: once
command: echo hello
insertafter: existingservice
state: present
become: yes
# Change inittab entry startmyservice to runlevel "2" and processaction "wait".
- name: Change startmyservice to inittab
aix_inittab:
name: startmyservice
runlevel: 2
action: wait
command: echo hello
state: present
become: yes
- name: Remove startmyservice from inittab
aix_inittab:
name: startmyservice
runlevel: 2
action: wait
command: echo hello
state: absent
become: yes
sy
name:
description: Name of the adjusted inittab entry
returned: always
type: str
sample: startmyservice
msg:
description: Action done with the inittab entry
returned: changed
type: str
sample: changed inittab entry startmyservice
changed:
description: Whether the inittab changed or not
returned: always
type: bool
sample: true
( t izip( t
AnsibleModulec C` s� i t d 6} | j d � } | j | | j d g � \ } } } | d k r� d
} | j d � } t d � | � } t t | | � � } | j i t d 6� n | S( Nt existt lsitabt namei t runlevelt actiont commandt :c S` s
| j � S( N( t strip( t s( ( sF /usr/lib/python2.7/site-packages/ansible/modules/system/aix_inittab.pyt <lambda>� s ( s names runlevels actions command(
t Falset get_bin_patht run_commandt paramst splitt mapt dictR t updatet True( t modulet
existsdictR t rct outt errt keyst values( ( sF /usr/lib/python2.7/site-packages/ansible/modules/system/aix_inittab.pyt check_current_entry� s
%c
C` s� t d t d t d d d t d d g � d t d d d t � d t d d d
d d d
d d d d d d d d d g � d t d d d t � d t d d � d t d d d d d
d d g � � d t � } i | j d d 6t d 6d d 6} | j d! � } | j d"