목록Server&Network/Ansible (2)
월루를 꿈꾸는 대학생
--- - name: ssh-keygen hosts: Cent gather_facts: no tasks: - name: "ssh password" connection: local command: "ssh-keygen -b 2048 -t rsa -f /home/vagrant/.ssh/id_rsa -q -N ''" #ansible server에서 ssh key 생성을 위해 local에서 실행 ignore_errors: yes run_once: true - name: "import id_rsa.pub" connection: local command: "cat /home/vagrant/.ssh/id_rsa.pub" register: id_pub run_once: true #msg: "{{ id_pub.stdou..
# ansible all -m user -a "name=suhyun" -u root (계정명) # ansible all -m shell -a "tail -n 1 /etc/passwd" -u root 실제로 계정이 생김 ###계정 삭제 # ansible all -m user -a "name=suhyun state=absent remove=yes" -u root 확인 ## 패스워드 추가 # ansible all -m user -a "name=jojoldu update_password=always password={{ '변경하고싶은 비밀번호' | password_hash('sha512') }}" -u root - 걍 저걸로 바로 만들고 비번 설정도 가능하다!