change password with ansible
ansible을 이용하여 agent 서버의 유저 패스워드 변경 1. 환경준비 Centos 7.x Ansible 2. env ansible [root@localhost ~]# vi /etc/ansible/hosts # This is the default ansible 'hosts' file. # # It should live in /etc/ansible/hosts # # - Comments begin with the '#' character # - Blank lines are ignored # - Groups of hosts are delimited by [header] elements # - You can enter hostnames or ip addresses # - A hostname/ip can be a member of multiple groups [testgroup] #192.168.0.156 ansible_connection=ssh ansible_ssh_user=min ansible_ssh_pass=xxxxxxx 192.168.0.194 ansible_connection=ssh ansible_ssh_user=min ansible_ssh_pass=xxxxxxx # edit playbook [root@localhost ~]# vi changepw.yml - hosts: testgroup tasks: - name: Test echo shell: whoami echo -e 'oldpassword1\nlinuxpassword2\nlinuxpassword2' | passwd register: cat - debug: var=cat.stdout_lines 3. excute ansible [root@localhost ~]# ansible-playbook chan