sandervanvugt

setting up ansible managed nodes

Dec 20th, 2021
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. [ansible@control setup]$ history
  2. 1 sudo dnf install -y epel-release
  3. 2 cat /etc/redhat-release
  4. 3 sudo dnf install ansible
  5. 4 ansible --version
  6. 5 history
  7. 6 sudo dnf install vim git -y
  8. 7 git clone https://github.com/sandervanvugt/rhce8-live
  9. 8 cd rhce8-live/
  10. 9 ls
  11. 10 cd
  12. 11 ip a
  13. 12 sudo vim /etc/hosts
  14. 13 ping ansible1
  15. 14 ping ansible2
  16. 15 ssh root@ansible1
  17. 16 ssh root@ansible2
  18. 17 history
  19. 18 cd rhce8-live/
  20. 19 ls
  21. 20 ./countdown 12
  22. 21 ansible-doc -l
  23. 22 ansible-doc -l | grep user
  24. 23 mkdir setup
  25. 24 cd setup/
  26. 25 vim inventory
  27. 26 ansible-doc user
  28. 27 ansible all -m user -a "name=ansible"
  29. 28 ansible all -m user -a "name=ansible" -i inventory
  30. 29 ansible all -m user -a "name=ansible" -i inventory -k
  31. 30 ansible all -m user -a "name=bob" -i inventory -k
  32. 31 ansible all -m user -a "name=bob" -i inventory -k -u root
  33. 32 ansible all -m user -a "name=ansible state=absent" -i inventory -k -u root
  34. 33 history
  35. 34 cat inventory
  36. 35 ansible all -m command -a "tail -3 /etc/passwd"
  37. 36 ansible all -m command -a "tail -3 /etc/passwd" -i inventory
  38. 37 ansible all -m command -a "tail -3 /etc/passwd" -i inventory -u root -k
  39. 38 ansible all -m user -a "name=ansible state=present" -i inventory -k -u root
  40. 39 ssh ansible@ansible2
  41. 40 history
  42. 41 sudo -i
  43. 42 ansible -i inventory all -m command -a "rpm -qa | grep util" -u root -k
  44. 43 ansible -i inventory all -m shell -a "rpm -qa | grep util" -u root -k
  45. 44 ansible -i inventory all -m shell -a "echo password | passwd --stdin ansible" -u root -k
  46. 45 ssh ansible@ansible1
  47. 46 ansible -i inventory all -m command -a "chown -R ansible:ansible /home/ansible" -u root -k
  48. 47 ansible -i inventory all -m command -a "ls -al /home/ansible" -u root -k
  49. 48 ssh ansible1
  50. 49 ssh ansible2
  51. 50 sudo vim /etc/hosts
  52. 51 history
  53. 52 ansible-doc copy
  54. 53 history
  55. 54 ansible -i inventory all -m copy -a 'content="ansible ALL=(ALL) NOPASSWD: ALL" -dest=/etc/sudoers.d/ansible' -u root -k
  56. 55 cat ~/.ssh/known_hosts
  57. 56 rm -f ~/.ssh/known_hosts
  58. 57 ansible -i inventory all -m copy -a 'content="ansible ALL=(ALL) NOPASSWD: ALL" -dest=/etc/sudoers.d/ansible' -u root -k
  59. 58 ssh ansible1
  60. 59 ssh ansible2
  61. 60 cat ~/.ssh/known_hosts
  62. 61 ansible -i inventory all -m copy -a 'content="ansible ALL=(ALL) NOPASSWD: ALL" -dest=/etc/sudoers.d/ansible' -u root -k
  63. 62 ansible -i inventory all -m copy -a 'content="ansible ALL=(ALL) NOPASSWD: ALL" dest=/etc/sudoers.d/ansible' -u root -k
  64. 63 ansible -i inventory all -m user -a "name=bob" -u ansible -k
  65. 64 ansible -i inventory all -m user -a "name=alice" -u ansible -k
  66. 65 ansible -i inventory all -m user -a "name=alice" -u ansible -k -b
  67. 66 ssh-keygen
  68. 67 ssh-copy-id ansible1
  69. 68 ssh-copy-id ansible2
  70. 69 ansible -i inventory all -m user -a "name=bob state=absent" -u ansible -b
  71. 70 history
  72.  
Advertisement
Add Comment
Please, Sign In to add comment