eng-waleed1

ansiblear-prep.v003

Jul 18th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.17 KB | None | 0 0
  1. id ansible
  2. useradd ansible
  3. passwd ansible
  4. vi /etc/hosts
  5. 192.168.0.200 control.ansiblear.com control
  6. 192.168.0.201 ansible1.ansiblear.com ansible1
  7. 192.168.0.202 ansible2.ansiblear.com ansible2
  8.  
  9. #as root:
  10. 14  id ansible
  11. 15  useradd ansible
  12. 16  passwd ansible
  13. 17  vi /etc/hosts
  14. 18  cat /etc/hosts
  15. 19  ping control
  16. 20  vi /etc/hosts
  17. 21  ping control
  18. 22  ping ansible1
  19. 23  ping ansible2
  20. 24  yum install -y epel-release
  21. 25  yum install ansible
  22. 26  ssh ansible1
  23. 27  su - ansible1
  24. 28  su - ansible
  25. 29  echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ansible
  26. 30  su - ansible
  27. 31  mv ansible-ar/ /home/ansible/
  28. 32  chown ansible:ansible /home/ansible/ansible-ar/
  29. 33  su - ansible
  30. 34  ansible -version
  31. 35  ansible --version
  32. 36  su - ansible
  33. 37  history
  34.  
  35. #as ansible user:
  36.   3  ssh-keygen
  37.   4  ssh-copy-id
  38.   5  ssh-copy-id  ansible1
  39.   6  ssh ansibl1
  40.   7  ssh ansible1
  41.   8  ssh-copy-id  ansible2
  42.   9  ssh ansible2
  43.  10  echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ansible
  44.  11  cd ansible-ar/
  45.  12  ls
  46.  13  cd ansible-ar/
  47.  14  ls
  48.  15  vi inventory
  49.  16  ansible all -i inventory --list-hosts
  50.  17  ansible all -i inventory --graph
  51.  18  ansible all -i inventory --graph
  52.  19  ansible-inventory all -i inventory --graph
  53.  20  vi ansible.cfg
  54.  21  ansible all -m shell -a "ls"
  55.  22  ansible all -i inventory -m shell -a "ls"
  56.  23  ansible all -i inventory -m shell -a "id ansible"
  57.  24  ansible all -i inventory -m shell -a "cat /etc/passwd"
  58.  25  ansible all -i inventory -m shell -a "cat /etc/shadow"
  59.  26  ls
  60.  27  cat ansible.cfg
  61.  28  cat inventory
  62.  
  63. inventory
  64. ansible1
  65. ansible2
  66.  
  67. ansible.cfg
  68. [default]
  69. remote_user=ansible
  70. host_key_checking=false
  71. inventory=inventory
  72. [privilege_escalation]
  73. become=true
  74. become_method=sudo
  75. become_user=root
  76. become_ask_pass=false
  77.  
  78.  
  79. # ansible 1/2 - managed node history:
  80.  
  81.  23  useradd ansible
  82.  24  passwd ansible
  83.  25  vi /etc/hosts
  84.  26  cat /etc/hosts
  85.  27  ping control
  86.  28  vi /etc/hosts
  87.  29  ping control
  88.  30  ping ansible1
  89.  31  ping ansible2
  90.  32  ping control
  91.  33  ping ansible1
  92.  34  ping ansible2
  93.  35  vi /etc/hosts
  94.  36  systemctl status sshd
  95.  37  rpm -qa | grep -i python
  96.  38  firewall-cmd --list-all
  97.  39  echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ansible
Add Comment
Please, Sign In to add comment