sandervanvugt

RHCE day1 dec2021

Dec 20th, 2021
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.25 KB | None | 0 0
  1. playbook: vsftpd.yml
  2. [ansible@control lesson4]$ history
  3. 1 sudo dnf install -y epel-release
  4. 2 cat /etc/redhat-release
  5. 3 sudo dnf install ansible
  6. 4 ansible --version
  7. 5 history
  8. 6 sudo dnf install vim git -y
  9. 7 git clone https://github.com/sandervanvugt/rhce8-live
  10. 8 cd rhce8-live/
  11. 9 ls
  12. 10 cd
  13. 11 ip a
  14. 12 sudo vim /etc/hosts
  15. 13 ping ansible1
  16. 14 ping ansible2
  17. 15 ssh root@ansible1
  18. 16 ssh root@ansible2
  19. 17 history
  20. 18 cd rhce8-live/
  21. 19 ls
  22. 20 ./countdown 12
  23. 21 ansible-doc -l
  24. 22 ansible-doc -l | grep user
  25. 23 mkdir setup
  26. 24 cd setup/
  27. 25 vim inventory
  28. 26 ansible-doc user
  29. 27 ansible all -m user -a "name=ansible"
  30. 28 ansible all -m user -a "name=ansible" -i inventory
  31. 29 ansible all -m user -a "name=ansible" -i inventory -k
  32. 30 ansible all -m user -a "name=bob" -i inventory -k
  33. 31 ansible all -m user -a "name=bob" -i inventory -k -u root
  34. 32 ansible all -m user -a "name=ansible state=absent" -i inventory -k -u root
  35. 33 history
  36. 34 cat inventory
  37. 35 ansible all -m command -a "tail -3 /etc/passwd"
  38. 36 ansible all -m command -a "tail -3 /etc/passwd" -i inventory
  39. 37 ansible all -m command -a "tail -3 /etc/passwd" -i inventory -u root -k
  40. 38 ansible all -m user -a "name=ansible state=present" -i inventory -k -u root
  41. 39 ssh ansible@ansible2
  42. 40 history
  43. 41 sudo -i
  44. 42 ansible -i inventory all -m command -a "rpm -qa | grep util" -u root -k
  45. 43 ansible -i inventory all -m shell -a "rpm -qa | grep util" -u root -k
  46. 44 ansible -i inventory all -m shell -a "echo password | passwd --stdin ansible" -u root -k
  47. 45 ssh ansible@ansible1
  48. 46 ansible -i inventory all -m command -a "chown -R ansible:ansible /home/ansible" -u root -k
  49. 47 ansible -i inventory all -m command -a "ls -al /home/ansible" -u root -k
  50. 48 ssh ansible1
  51. 49 ssh ansible2
  52. 50 sudo vim /etc/hosts
  53. 51 history
  54. 52 ansible-doc copy
  55. 53 history
  56. 54 ansible -i inventory all -m copy -a 'content="ansible ALL=(ALL) NOPASSWD: ALL" -dest=/etc/sudoers.d/ansible' -u root -k
  57. 55 cat ~/.ssh/known_hosts
  58. 56 rm -f ~/.ssh/known_hosts
  59. 57 ansible -i inventory all -m copy -a 'content="ansible ALL=(ALL) NOPASSWD: ALL" -dest=/etc/sudoers.d/ansible' -u root -k
  60. 58 ssh ansible1
  61. 59 ssh ansible2
  62. 60 cat ~/.ssh/known_hosts
  63. 61 ansible -i inventory all -m copy -a 'content="ansible ALL=(ALL) NOPASSWD: ALL" -dest=/etc/sudoers.d/ansible' -u root -k
  64. 62 ansible -i inventory all -m copy -a 'content="ansible ALL=(ALL) NOPASSWD: ALL" dest=/etc/sudoers.d/ansible' -u root -k
  65. 63 ansible -i inventory all -m user -a "name=bob" -u ansible -k
  66. 64 ansible -i inventory all -m user -a "name=alice" -u ansible -k
  67. 65 ansible -i inventory all -m user -a "name=alice" -u ansible -k -b
  68. 66 ssh-keygen
  69. 67 ssh-copy-id ansible1
  70. 68 ssh-copy-id ansible2
  71. 69 ansible -i inventory all -m user -a "name=bob state=absent" -u ansible -b
  72. 70 history
  73. 71 ../countdown 12
  74. 72 sudo vim /etc/ansible/hosts
  75. 73 cd ../
  76. 74 ls
  77. 75 cd lesson2/
  78. 76 ls
  79. 77 cat inventory
  80. 78 ansible -i inventory all --list-hosts
  81. 79 ansible -i inventory web --list-hosts
  82. 80 vim ansible.cfg
  83. 81 sudo vim /etc/ansible/ansible.cfg
  84. 82 pwd
  85. 83 vim ansible.cfg
  86. 84 ansible all -m command -a "chown -R ansible:ansible /home/ansible"
  87. 85 vim ansible.cfg
  88. 86 ansible all -m command -a "chown -R ansible:ansible /home/ansible"
  89. 87 ansible --version
  90. 88 vim ansible.cfg
  91. 89 ansible localhost -m user -a "name=lisa"
  92. 90 vim ansible.cfg
  93. 91 sudo visudo
  94. 92 ansible localhost -m user -a "name=lisa"
  95. 93 echo $EDITOR
  96. 94 EDIT=/usr/bin/nano
  97. 95 export EDITOR=/usr/bin/nano
  98. 96 alias nanosudo=visudo
  99. 97 nanosudo
  100. 98 sudo nanosudo
  101. 99 ansible all -a "id lisa"
  102. 100 vim inventory
  103. 101 ansible all -m user -a "name=linda"
  104. 102 ansible all -m command -a "useradd bill"
  105. 103 ansible all -m user -a "name=bill"
  106. 104 history
  107. 105 ansible-doc user
  108. 106 ../countdown 15
  109. 107 ansible all -m package -a "name=nmap state=latest"
  110. 108 ansible all -m shell -a "rpm -qa | grep nmap"
  111. 109 ansible all -m service -a "name=httpd state=started"
  112. 110 cd ../lesson4/
  113. 111 ls
  114. 112 vim install-httpd.yml
  115. 113 ansible-doc copy
  116. 114 ansible-doc sync
  117. 115 ansible-doc -l | grep sync
  118. 116 ansible-doc synchronize
  119. 117 ls
  120. 118 vim vsftpd.yml
  121. 119 ansible-playbook vsftpd.yml
  122. 120 vim vsftpd.yml
  123. 121 ansible-doc service
  124. 122 vim vsftpd.yml
  125. 123 ansible-playbook vsftpd.yml
  126. 124 vim vsftpd.yml
  127. 125 ansible-playbook vsftpd.yml
  128. 126 vim vsftpd.yml
  129. 127 ansible-playbook -v vsftpd.yml
  130. 128 vim vsftpd.yml
  131. 129 ansible-playbook -v vsftpd.yml
  132. 130 ansible-playbook -vvvv vsftpd.yml
  133. 131 ansible-doc chkconfig
  134. 132 which chkconfig
  135. 133 ls -l /usr/sbin/chkconfig
  136. 134 sudo dnf provides */ansible-lint
  137. 135 sudo dnf install python3-ansible-lint
  138. 136 ansible-lint vsftpd.yml
  139. 137 ansible --syntax-check vsftpd.yml
  140. 138 ansible -C vsftpd.yml
  141. 139 ansible-playbook --syntax-check vsftpd.yml
  142. 140 history
  143.  
Advertisement
Add Comment
Please, Sign In to add comment