Not able to change runlevel in /etc/inittab using aix_inittab module

Hi,

I am new to Ansible and this is my first post on this community.
I am trying to use “aix_inittab” module and this is how my playbook looks like:

  • name: Change runlevel
    aix_inittab:
    name: myservice
    runlevel: 4
    action: once
    command: “echo hello”
    state: present
    become: yes

When I run this playbook with “vvvv” verbosity, I get following message:

TASK [prerequisites : Change runlevel ] *******************************************************
task path: /home/anurag/myplatform/roles/prerequisites/tasks/main.yml:1
Using module file /usr/lib/python2.6/site-packages/ansible/modules/system/aix_inittab.py
<X.X.X.100> ESTABLISH CONNECTION FOR USER: ansibleremote on PORT 22 TO X.X.X.100
<X.X.X.100> EXEC /bin/sh -c ‘echo ~ && sleep 0’
<X.X.X.100> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo /home/ansibleremote/.ansible/tmp/ansible-tmp-1516280197.57-204938815314702” && echo ansible-tmp-1516280197.57-204938815314702=“echo /home/ansibleremote/.ansible/tmp/ansible-tmp-1516280197.57-204938815314702” ) && sleep 0’
<X.X.X.100> PUT /tmp/tmp5KB4ge TO /home/ansibleremote/.ansible/tmp/ansible-tmp-1516280197.57-204938815314702/aix_inittab.py
<X.X.X.100> EXEC /bin/sh -c ‘chmod u+x /home/ansibleremote/.ansible/tmp/ansible-tmp-1516280197.57-204938815314702/ /home/ansibleremote/.ansible/tmp/ansible-tmp-1516280197.57-204938815314702/aix_inittab.py && sleep 0’
<X.X.X.100> EXEC /bin/sh -c ‘sudo -H -S -p “[sudo via ansible, key=xxxxxxxxxxxxxxxxxxxxxxxxxxx] password: " -u root /bin/sh -c '”’“‘echo BECOME-SUCCESS-zcfmpkdtgpljntitegpuwtpsvbcuznbv; /usr/bin/python /home/ansibleremote/.ansible/tmp/ansible-tmp-1516280197.57-204938815314702/aix_inittab.py; rm -rf “/home/ansibleremote/.ansible/tmp/ansible-tmp-1516280197.57-204938815314702/” > /dev/null 2>&1’”‘"’ && sleep 0’
The full traceback is:
File “/tmp/ansible_teqxIC/ansible_modlib.zip/ansible/module_utils/basic.py”, line 2762, in run_command
cmd = subprocess.Popen(args, **kwargs)
File “/usr/lib64/python2.6/subprocess.py”, line 639, in init
errread, errwrite)
File “/usr/lib64/python2.6/subprocess.py”, line 1228, in _execute_child
raise child_exception

fatal: [X.X.X.100]: FAILED! => {
“changed”: false,
“cmd”: “‘iptables:4:once:echo hello’”,
“invocation”: {
“module_args”: {
“action”: “once”,
“command”: “echo hello”,
“insertafter”: null,
“name”: “iptables”,
“runlevel”: “4”,
“state”: “present”
}
},
“msg”: “[Errno 2] No such file or directory”,
“rc”: 2
}

While on remote machine following folder was created in /home/ansibleremote/.ansible/tmp directory:
ansible-tmp-1516280125.08-11821906762904

and it contained one file named setup.py

This folder is different from what ansible was trying to create.

What am I missing here? I tried the same with root user without any success.
Please let me know if more information is required.

Regards,
Anurag Berdia

Guys,
Appreciate any help on this.

Thanks,
Anurag Berdia

not sure you can do that, iirc it requires an actual command, not a
shell builtin