On 01. okt. 2016 04:24,
hzj...@foxmail.com wrote:
>
> thanks for ur advice, i have aix and linux, i wrote the playbook based on ur reply, it works , but i think it's too long, is there a better way to rewrite this ?
In my opinion it's not long, you could but the code in it's one file and
use include if you would like the playbook to have less code.
The other option is to use grep/egrep on /etc/passwd, the you can use
the same code on AIX and Linux. I think AIX has egrep.
tasks:
- Name get user
shell: egrep "^{{ user }}:" /etc/passwd
register: user_info
- name: Change passwd
command: <whatever to change password>
when: user_info.rc == 0
--
Kai Stian Olstad