sandervanvugt

RHCE day2 dec21

Dec 21st, 2021
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.68 KB | None | 0 0
  1. [ansible@control ~]$ 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. 71 ../countdown 12
  73. 72 sudo vim /etc/ansible/hosts
  74. 73 cd ../
  75. 74 ls
  76. 75 cd lesson2/
  77. 76 ls
  78. 77 cat inventory
  79. 78 ansible -i inventory all --list-hosts
  80. 79 ansible -i inventory web --list-hosts
  81. 80 vim ansible.cfg
  82. 81 sudo vim /etc/ansible/ansible.cfg
  83. 82 pwd
  84. 83 vim ansible.cfg
  85. 84 ansible all -m command -a "chown -R ansible:ansible /home/ansible"
  86. 85 vim ansible.cfg
  87. 86 ansible all -m command -a "chown -R ansible:ansible /home/ansible"
  88. 87 ansible --version
  89. 88 vim ansible.cfg
  90. 89 ansible localhost -m user -a "name=lisa"
  91. 90 vim ansible.cfg
  92. 91 sudo visudo
  93. 92 ansible localhost -m user -a "name=lisa"
  94. 93 echo $EDITOR
  95. 94 EDIT=/usr/bin/nano
  96. 95 export EDITOR=/usr/bin/nano
  97. 96 alias nanosudo=visudo
  98. 97 nanosudo
  99. 98 sudo nanosudo
  100. 99 ansible all -a "id lisa"
  101. 100 vim inventory
  102. 101 ansible all -m user -a "name=linda"
  103. 102 ansible all -m command -a "useradd bill"
  104. 103 ansible all -m user -a "name=bill"
  105. 104 history
  106. 105 ansible-doc user
  107. 106 ../countdown 15
  108. 107 ansible all -m package -a "name=nmap state=latest"
  109. 108 ansible all -m shell -a "rpm -qa | grep nmap"
  110. 109 ansible all -m service -a "name=httpd state=started"
  111. 110 cd ../lesson4/
  112. 111 ls
  113. 112 vim install-httpd.yml
  114. 113 ansible-doc copy
  115. 114 ansible-doc sync
  116. 115 ansible-doc -l | grep sync
  117. 116 ansible-doc synchronize
  118. 117 ls
  119. 118 vim vsftpd.yml
  120. 119 ansible-playbook vsftpd.yml
  121. 120 vim vsftpd.yml
  122. 121 ansible-doc service
  123. 122 vim vsftpd.yml
  124. 123 ansible-playbook vsftpd.yml
  125. 124 vim vsftpd.yml
  126. 125 ansible-playbook vsftpd.yml
  127. 126 vim vsftpd.yml
  128. 127 ansible-playbook -v vsftpd.yml
  129. 128 vim vsftpd.yml
  130. 129 ansible-playbook -v vsftpd.yml
  131. 130 ansible-playbook -vvvv vsftpd.yml
  132. 131 ansible-doc chkconfig
  133. 132 which chkconfig
  134. 133 ls -l /usr/sbin/chkconfig
  135. 134 sudo dnf provides */ansible-lint
  136. 135 sudo dnf install python3-ansible-lint
  137. 136 ansible-lint vsftpd.yml
  138. 137 ansible --syntax-check vsftpd.yml
  139. 138 ansible -C vsftpd.yml
  140. 139 ansible-playbook --syntax-check vsftpd.yml
  141. 140 history
  142. 141 history | less
  143. 142 cd ../lesson5/
  144. 143 ls
  145. 144 vim user.yml
  146. 145 ansible-playbook user.yml
  147. 146 vim user.yml
  148. 147 ansible-playbook user.yml
  149. 148 vim user.yml
  150. 149 vim inventory
  151. 150 ansible-playbook user.yml -e user=anna
  152. 151 vim user.yml
  153. 152 ansible-playbook user.yml -e user=anna
  154. 153 cd ../..
  155. 154 git clone https://github.com/sandervanvugt/ansibleinthreeweeks
  156. 155 cd ansibleinthreeweeks/
  157. 156 cd windows/
  158. 157 vim inventory
  159. 158 cd ../azure/
  160. 159 cd ../aws
  161. 160 cd ..
  162. 161 cd ../rhce8-live/lesson5/
  163. 162 ls
  164. 163 cd webservers/
  165. 164 ls
  166. 165 vim site.yml
  167. 166 cat inventory
  168. 167 ls group_vars/
  169. 168 cat group_vars/lamp
  170. 169 ansible-playbook site.yml
  171. 170 cd ../../..
  172. 171 cd ansibleinthreeweeks/
  173. 172 grep -R 'vars:'
  174. 173 cd cisco/
  175. 174 vim inventory-ios
  176. 175 cd ../../rhce8-live/lesson5/
  177. 176 ls
  178. 177 cat install_services.yml
  179. 178 cat packages.fact
  180. 179 cd ../lesson4/
  181. 180 ls
  182. 181 vim install-httpd.yml
  183. 182 cp install-httpd.yml uninstall-httpd.yml
  184. 183 vim uninstall-httpd.yml
  185. 184 ansible-playbook uninstall-httpd.yml
  186. 185 vim uninstall-httpd.yml
  187. 186 ansible-playbook uninstall-httpd.yml
  188. 187 vim uninstall-httpd.yml
  189. 188 ansible-playbook uninstall-httpd.yml
  190. 189 vim install-httpd.yml
  191. 190 ansible-playbook install-httpd.yml
  192. 191 ansible-playbook uninstall-httpd.yml
  193. 192 cd ../lesson7/
  194. 193 ansible-vault --help
  195. 194 ansible-vault create secrets.yaml
  196. 195 export EDITOR=/usr/bin/vim
  197. 196 alias
  198. 197 unalias nanosudo
  199. 198 cat secrets.yaml
  200. 199 ls
  201. 200 rm secrets.yaml
  202. 201 ansible-vault create secret.yml
  203. 202 mv secret.yml vault/
  204. 203 cd vault/
  205. 204 ls
  206. 205 vim create-user.yml
  207. 206 ansible-playbook create-user.yml
  208. 207 ansible-playbook --ask-vault-pass create-user.yml
  209. 208 ansible ansible2.example.com -a "tail -2 /etc/shadow"
  210. 209 echo password > vault-pass
  211. 210 rm vault-pass
  212. 211 echo password > ~/vault-pass
  213. 212 vim create-user.yml
  214. 213 ansible-playbook --vault-password-file=../../vault-pass create-user.yml
  215. 214 ansible-playbook --vault-password-file=../../../vault-pass create-user.yml
  216. 215 ansible-playbook --vault-password-file=~/vault-pass create-user.yml
  217. 216 vim lab4.txt
  218. 217 vim dg.yaml
  219. 218 ../../countdown 5
  220. 219 vim ansible1.fact
  221. 220 vim lab5.yaml
  222. 221 ansible-playbook lab5.yaml
  223. 222 vim lab5.yaml
  224. 223 ansible-playbook lab5.yaml
  225. 224 ansible ansible1.example.com -m setup -a "filter=ansible_local"
  226. 225 cat lab5.yaml
  227. 226 cat ansible1
  228. 227 cat ansible1.fact
  229. 228 eixt
  230. 229 exit
  231. 230 ../../countdown 15
  232. 231 vim setupfactcache.yaml
  233. 232 ansible-playbook setupfactcache.yaml
  234. 233 pwd
  235. 234 ip a
  236. 235 ls
  237. 236 pwd
  238. 237 ../../countdown 12
  239. 238 ansible-doc copy
  240. 239 ansible-doc firewalld
  241. 240 ansible-doc file
  242. 241 history | less
  243. 242 pwd
  244. 243 vim dg.yaml
  245. 244 cd ../lesson7/
  246. 245 ansible ansible1.example.com -m setup > facts.txt
  247. 246 ls
  248. 247 cd facts
  249. 248 ls
  250. 249 ansible ansible1.example.com -m setup > facts.txt
  251. 250 less facts.txt
  252. 251 ansible-doc -l | grep fact
  253. 252 pwd
  254. 253 vim ../../ansible.cfg
  255. 254 cp ../../lesson5/ansible.cfg
  256. 255 cp ../../lesson5/ansible.cfg ../../
  257. 256 vim ../../ansible.cfg
  258. 257 cp ../../ansible.cfg .
  259. 258 sudo dnf install -y redis
  260. 259 sudo systemctl enable --now redis
  261. 260 sudo pip3 install redis
  262. 261 ansible all -m setup
  263. 262 ls
  264. 263 vim facts.yml
  265. 264 cat ansible.cfg
  266. 265 ansible-playbook facts.yml
  267. 266 cat facts.yml
  268. 267 sudo systemctl status redis
  269. 268 history
  270. 269 cat ansible.cfg
  271. 270 cd
  272. 271 mv rhce8-live rhce8-live.old
  273. 272 git clone https://github.com/sandervanvugt/rhce8-live
  274. 273 cd rhce8-live/lesson7/facts/
  275. 274 l;s
  276. 275 ls
  277. 276 vim ipfact.yml
  278. 277 ansible-playbook ipfact.yml
  279. 278 vim ipfact.yml
  280. 279 ansible-playbook ipfact.yml
  281. 280 cat ipfact.yml
  282. 281 ls
  283. 282 vim newlocalfacts.yml
  284. 283 vim localfacts.fact
  285. 284 ansible-playbook newlocalfacts.yml
  286. 285 ansible all -m setup -a "filter=ansible_local"
  287. 286 vim localfacts.fact
  288. 287 history
  289. 288 cat localfacts.fact
  290. 289 cat newlocalfacts.yml
  291. 290 cd ../arrays/
  292. 291 ls
  293. 292 cat vars/users-dictionary
  294. 293 cat vars/users-list
  295. 294 vim multi-list.yml
  296. 295 ansible-playbook multi-list.yml
  297. 296 vim multi-dictionary.yml
  298. 297 ansible-playbook multi-dictionary.yml
  299. 298 cd ../..
  300. 299 ./countdown 12
  301. 300 ls
  302. 301 vim loop-over-dict.yaml
  303. 302 mv loop-over-dict.yaml lesson7/arrays/
  304. 303 cd lesson7/arrays/
  305. 304 vim loop-over-dict.yaml
  306. 305 cat vars/users-dictionary
  307. 306 vim loop-over-dict.yaml
  308. 307 ansible-playbook loop-over-dict.yaml
  309. 308 cd ../..
  310. 309 ls
  311. 310 cd lesson8/
  312. 311 ls
  313. 312 vim loopservices.yml
  314. 313 ansible-playbook loopservices.yml
  315. 314 ansible-doc yum
  316. 315 ansible-doc package
  317. 316 vim loopusers.yml
  318. 317 vim loop-over-variable.yml
  319. 318 cat loopvars.yml
  320. 319 ansible-playbook loop-over-variable.yml
  321. 320 vim register_loop.yml
  322. 321 ansible-playbook register_loop.yml
  323. 322 vim register_loop.yml
  324. 323 ansible-playbook register_loop.yml
  325. 324 vim register_command.yml
  326. 325 ansible-playbook register_command.yml
  327. 326 vim register_command.yml
  328. 327 ansible-playbook register_command.yml
  329. 328 history
  330. 329 exit
  331. 330 history
  332.  
Advertisement
Add Comment
Please, Sign In to add comment