sandervanvugt

RHCE day3 oct21

Oct 28th, 2021
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.28 KB | None | 0 0
  1. ---
  2. - name: generate vrypto pw
  3. hosts: all
  4. tasks:
  5. - user:
  6. name: "{{ user }}"
  7. state: present
  8. - shell: echo password | passwd --stdin {{ user }}
  9. register: bobpw
  10. - debug:
  11. var: bobpw
  12.  
  13.  
  14. ########
  15. [ansible@control lesson12]$ history
  16. 1 sudo vim /etc/hosts
  17. 2 ip a
  18. 3 ping ansible1
  19. 4 ping ansible2
  20. 5 sudo yum install epel-release
  21. 6 sudo yum install ansible
  22. 7 ansible --version
  23. 8 sudo dnf install -y vim git
  24. 9 git clone https://github.com/sandervanvugt/rhce8-live
  25. 10 git clone https://github.com/sandervanvugt/rhce8-book
  26. 11 cd rhce8-live/
  27. 12 ls
  28. 13 cd lesson2/
  29. 14 ls
  30. 15 vim inventory
  31. 16 history
  32. 17 pwd
  33. 18 vim inventory
  34. 19 sudo vim /etc/ansible/hosts
  35. 20 pwd
  36. 21 ansible all -m ping
  37. 22 cat ansible.cfg
  38. 23 ansible -i inventory all --list-hosts
  39. 24 ansible file --list-hosts
  40. 25 cat inventory
  41. 26 ansible web --list-hosts
  42. 27 ls ..
  43. 28 ../countdown 15
  44. 29 vim ansible.cfg
  45. 30 ansible --version
  46. 31 sudo vim /etc/ansible/ansible.cfg
  47. 32 ansible all -m user -a "name=lisa"
  48. 33 ansible --help | less
  49. 34 #ansible all -m user -a "name=ansible groups=wheel" -u root -k
  50. 35 ansible-doc user
  51. 36 ansible all -m user -a "name=ansible groups=wheel" -u root -k
  52. 37 vim inventory
  53. 38 ansible all -m user -a "name=ansible groups=wheel" -u root -k
  54. 39 ansible all -m command -a "cat /etc/shadow" -u root -k
  55. 40 #ansible all -m command -a "echo password | passwd --stdin ansible"
  56. 41 ansible all -m command -a "cat /etc/passwd | grep ansible" -u root -k
  57. 42 ansible all -m shell -a "cat /etc/passwd | grep ansible" -u root -k
  58. 43 ansible all -m shell -a "echo password | passwd --stdin ansible" -u root -k
  59. 44 ansible all -m command -a "cat /etc/shadow" -k
  60. 45 cat ansible.cfg
  61. 46 ansible all -m command -a "cat /etc/shadow" -k -K
  62. 47 ansible all -m command -a "cat /etc/shadow" -K
  63. 48 ansible all -m shell -a 'echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ansible' -K
  64. 49 ssh ansible1
  65. 50 ansible all -m shell -a 'echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ansible' -K -k
  66. 51 ansible all -m shell -a 'cat /etc/shadow' -k
  67. 52 ssh-keygen
  68. 53 ssh-copy-id ansible1
  69. 54 ssh-copy-id ansible2
  70. 55 ansible all -m shell -a 'cat /etc/shadow'
  71. 56 history
  72. 57 ansible-doc -l | less
  73. 58 ansible-doc -l | wc
  74. 59 ansible-doc user
  75. 60 less /usr/lib/python3.6/site-packages/ansible/modules/system/user.py
  76. 61 ansible all -m ping
  77. 62 ansible all -m service -a "name=httpd state=started"
  78. 63 ansible all -m user -a "name=linda state=present"
  79. 64 ansible all -m command -a "useradd lisa"
  80. 65 history
  81. 66 ../countdown 15
  82. 67 ansible all -m package -a "name=namp state=present"
  83. 68 ansible all -m package -a "name=nmap state=present"
  84. 69 ansible all -m shell -a "rpm -qa | grep nmap"
  85. 70 cd ../lesson4/
  86. 71 l
  87. 72 ls
  88. 73 cat inventory
  89. 74 ls
  90. 75 vim vsftpd.yml
  91. 76 ansible-playbook vsftpd.yml
  92. 77*
  93. 78 vim vsftpd.yml
  94. 79 ansible ansible2.example.com -a "cat /var/ftp/pub/README"
  95. 80 ansible -v ansible2.example.com -a "cat /var/ftp/pub/README
  96. 81 history
  97. 82 ansible-playbook -v vsftpd.yml
  98. 83 ansible-playbook -vvvv vsftpd.yml
  99. 84 vim vsftpd.yml
  100. 85 ansible-playbook vsftpd.yml
  101. 86 vim vsftpd.yml
  102. 87 ansible-playbook vsftpd.yml
  103. 88 sudo yum provides */ansible-lint
  104. 89 sudo yum install -y python3-ansible-lint
  105. 90 ansible-lint vsftpd.yml
  106. 91 vim vsftpd.yml
  107. 92 ansible-lint --help | less
  108. 93 ansible-lint -L
  109. 94 ls
  110. 95 vim web-setup-and-test.yml
  111. 96 ansible-playbook web-setup-and-test.yml
  112. 97 vim web-setup-and-test.yml
  113. 98 ../countdown 17
  114. 99 vim es.yaml
  115. 100 ansible-playbook es.yaml
  116. 101 vim es.yaml
  117. 102 ansible-playbook es.yaml
  118. 103 vim es.yaml
  119. 104 ansible-playbook es.yaml
  120. 105 cd ../lesson5/
  121. 106 ls
  122. 107 vim user.yml
  123. 108 ansible-playbook user.yml
  124. 109 vim user.yml
  125. 110 ansible-playbook user.yml
  126. 111 vim inventory
  127. 112 ansible-playbook user.yml -e user=bob
  128. 113 vim user.yml
  129. 114 ansible-doc user
  130. 115 vim user.yml
  131. 116 ansible-playbook user.yml
  132. 117 vim user.yml
  133. 118 ansible-playbook user.yml
  134. 119 grep vars_file
  135. 120 grep vars_file *
  136. 121 mkdir vars
  137. 122 vim vars/users
  138. 123 vim user.yml
  139. 124 ansible-playbook user.yml
  140. 125 cd vars
  141. 126 mv users users.yml
  142. 127 cd ..
  143. 128 ansible-playbook user.yml
  144. 129 cat user.yml
  145. 130 ansible-playbook user.yml
  146. 131 vim user.yml
  147. 132 ansible-playbook user.yml
  148. 133 vim user.yml
  149. 134 ansible ansible1.example.com -m setup > facts.txt
  150. 135 less facts.txt
  151. 136 vim todayis.yml
  152. 137 less facts.txt
  153. 138 vim todayis.yml
  154. 139 ansible-playbook todayis.yml
  155. 140 vim todayis.yml
  156. 141* ansible-playbook todayis.yml
  157. 142 ansible-playbook todayis.yml
  158. 143 vim todayis.yml
  159. 144 ansible-playbook todayis.yml
  160. 145 vim todayis.yml
  161. 146 ansible-playbook todayis.yml
  162. 147 cat user.yml
  163. 148 cat todayis.yml
  164. 149 cat user.yml
  165. 150 history
  166. 151 #ansible ansible1.example.com -m raw -a "yum install python" -u ubuntu -b -k -K
  167. 152 cat todayis.yml
  168. 153 less facts.txt
  169. 154 ansible-playbook todayis.yml
  170. 155 cat user.yml
  171. 156 cd ../..
  172. 157 git clone https://github.com/sandervanvugt/ansibleinthreeweeks
  173. 158 cd ansibleinthreeweeks/windows/
  174. 159 ls
  175. 160 cat inventory
  176. 161 cd ../../rhce8-live/lesson5/
  177. 162 ls
  178. 163 cd webservers/
  179. 164 ls
  180. 165 cat ansible.cfg
  181. 166 cat inventory
  182. 167 ls
  183. 168 ls group_vars/
  184. 169 cat group_vars/lamp
  185. 170 vim site.yml
  186. 171 ansible-playbook site.yml
  187. 172 ansible-vault --help | less
  188. 173 cd ../../lesson7/
  189. 174 ls
  190. 175 cd vault/
  191. 176 ls
  192. 177 rm vault-pass\ 2
  193. 178 ansible-vault create secret.yml
  194. 179 cat secret.yml
  195. 180 vim create-user.yml
  196. 181 ansible-playbook create-user.yml
  197. 182 ansible-playbook --ask-vault-pass create-user.yml
  198. 183 echo password ~/vault-pass
  199. 184 pwd
  200. 185 ansible-playbook --vault-password-file=~/vault-pass create-users.yml
  201. 186 history
  202. 187 ansible-playbook --vault-password-file=~/vault-pass create-user.yml
  203. 188 echo password > ~/vault-pass
  204. 189 ansible-playbook --vault-password-file=~/vault-pass create-user.yml
  205. 190 cd ../..
  206. 191 cd lesson5/
  207. 192 vim vars/users.yml
  208. 193 ls
  209. 194 ansible-playbook user.yml
  210. 195 history
  211. 196 vim vault-lab.txt
  212. 197 ansible ansible2.example.com -a "tail /etc/shadow"
  213. 198 cd ../lesson7/
  214. 199 ls
  215. 200 cd facts/
  216. 201 ls
  217. 202 vim newlocalfacts.yml
  218. 203 cat localfacts.fact
  219. 204 ansible-playbook newlocalfacts.yml
  220. 205 ansible ansible1.example.com -m setup -a "filter=ansible_local"
  221. 206 cd ../
  222. 207 ls
  223. 208 cd arrays/
  224. 209 ls
  225. 210 cat vars/users-dictionary
  226. 211 cat vars/users-list
  227. 212 vim multi-list.yml
  228. 213 ansible-playbook multi-list.yml
  229. 214 vim multi-dictionary.yml
  230. 215 ansible-playbook multi-dictionary.yml
  231. 216 ../../countdown 15
  232. 217 cd ../facts/
  233. 218 vim es.yml
  234. 219 cd ../../lesson8/
  235. 220 ls
  236. 221 vim loopservices.yml
  237. 222 ansible-playbook loopservices.yml
  238. 223 vim loopusers.yml
  239. 224 ansible-playbook loopusers.yml
  240. 225 vim loop-over-variable.yml
  241. 226 vim loopvars.yml
  242. 227 ansible-playbook loop-over-variable.yml
  243. 228 vim register_loop.yml
  244. 229 ansible-playbook register_loop.yml
  245. 230 vim register_command.yml
  246. 231 ansible-playbook register_command.yml
  247. 232 cd ../lesson7/facts/
  248. 233 ls
  249. 234 vim es.yml
  250. 235 ansible-doc user
  251. 236 ansible-doc file
  252. 237 ansible-doc yum
  253. 238 cd ../../lesson8/
  254. 239 vim register_command.yml
  255. 240 ansible-playbook register_command.yml
  256. 241 vim register_command.yml
  257. 242 ansible-playbook register_command.yml
  258. 243 vim register_command.yml
  259. 244 ansible-playbook register_command.yml
  260. 245 vim register_command.yml
  261. 246 ../countdown 13
  262. 247 vim distro.yml
  263. 248 ansible-playbook distro.yml
  264. 249 vim distro.yml
  265. 250 ansible-playbook distro.yml
  266. 251 ansible-playbook distro.yml -e mypackage=nmap
  267. 252 vim distro.yml
  268. 253 ansible-playbook distro.yml -e mypackage=nmap
  269. 254 vim distro.yml
  270. 255 ansible-playbook distro.yml -e mypackage=nmap
  271. 256 ansible-doc vgs
  272. 257 ansible-doc setup
  273. 258 vim quicktest.yml
  274. 259 ansible-playbook quicktest.yml
  275. 260 vim quicktest.yml
  276. 261 ansible-playbook quicktest.yml
  277. 262 vim quicktest.yml
  278. 263 ansible-playbook quicktest.yml
  279. 264 vim command-output-test.yml
  280. 265 vgs
  281. 266 sudo vgs
  282. 267 sudo vgs rl
  283. 268 sudo vgs bob
  284. 269 vim command-output-test.yml
  285. 270 ansible-playbook command-output-test.yml
  286. 271 vim command-output-test.yml
  287. 272 ansible-playbook command-output-test.yml
  288. 273 vim command-output-test.yml
  289. 274 ansible-playbook command-output-test.yml
  290. 275 vim when_multiple.yml
  291. 276 ansible-playbook when_multiple.yml
  292. 277 vim when_multiple.yml
  293. 278 ansible-playbook when_multiple.yml
  294. 279 vim when_multiple.yml
  295. 280 ansible-playbook when_multiple.yml
  296. 281 less ../lesson5/facts.txt
  297. 282 vim when_multiple.yml
  298. 283 ansible-playbook when_multiple.yml
  299. 284 vim when_multiple.yml
  300. 285 ansible-playbook when_multiple.yml
  301. 286 vim when_multiple_complex.yml
  302. 287 ansible-playbook when_multiple_complex.yml
  303. 288 vim ifsize.yml
  304. 289 ansible-playbook ifsize.yml
  305. 290 vim ifsize.yml
  306. 291 vim restart.yml
  307. 292 ansible-playbook restart.yml
  308. 293 ansible ansible1.example.com -m service -a "name=crond state=stopped"
  309. 294 ansible-playbook restart.yml
  310. 295 ansible ansible1.example.com -m service -a "name=crond state=started"
  311. 296 history
  312. 297 vim jw.yaml
  313. 298 pwd
  314. 299 ls
  315. 300 vim handlers.yml
  316. 301 ansible-playbook handlers.yml
  317. 302 echo heelo > /tmp/index.html
  318. 303 ansible-playbook handlers.yml
  319. 304 vim handlers.yml
  320. 305 ansible-playbook handlers.yml
  321. 306 ansible all -m file -a "name=/var/www/html/index.html state=absent"
  322. 307 ansible-playbook handlers.yml
  323. 308 vim blocks.yml
  324. 309 ansible-playbook blocks.yml
  325. 310 vim blocks.yml
  326. 311 ls
  327. 312 grep rescue *
  328. 313 cd ../../rhce8-book/
  329. 314 history | grep book
  330. 315 history | grep rhce-book
  331. 316 history | grep rhce8-book
  332. 317 grep rescue *
  333. 318 vim listing731.yaml
  334. 319 ansible-playbook listing731.yaml
  335. 320 cd ../rhce8-live/lesson8/
  336. 321 vim failure.yml
  337. 322 ansible-playbook failure.yml
  338. 323 ls
  339. 324 cd ../../rhce8-book
  340. 325 vim listing725.yaml
  341. 326 ansible-playbook listing725.yaml
  342. 327 vim listing725.yaml
  343. 328 ansible-playbook listing725.yaml
  344. 329 cd -
  345. 330 vim changed.yml
  346. 331 ansible-playbook changed.yml
  347. 332 vim changed.yml
  348. 333 ansible-playbook changed.yml
  349. 334 cd ../lesson9/
  350. 335 ls
  351. 336 vim file.yml
  352. 337 vim copy.yml
  353. 338 ansible-playbook copy.yml
  354. 339 ls /tmp
  355. 340 cat /tmp/ansible1.example.com/tmp/hosts
  356. 341 ../countdown 16
  357. 342 vim vt.yaml
  358. 343 less ../lesson5/facts.txt
  359. 344 vim vt.yaml
  360. 345 ansible-playbook vt.yaml
  361. 346 ansible -m setup ansible2.example.com | less
  362. 347 vim vt.yaml
  363. 348 ansible-playbook vt.yaml
  364. 349 vim vt.yaml
  365. 350 ansible-playbook vt.yaml
  366. 351 vim vt.yaml
  367. 352 vim jw.yaml
  368. 353 ansible-playbook jw.yaml
  369. 354 vim jw.yaml
  370. 355 ansible-playbook jw.yaml
  371. 356 vim jw.yaml
  372. 357 ansible-playbook jw.yaml
  373. 358 vim jw.yaml
  374. 359 ansible-playbook jw.yaml
  375. 360 vim jw.yaml
  376. 361 ansible-playbook jw.yaml
  377. 362 cat jw.yaml
  378. 363 sudo yum install httpd
  379. 364 sudo systemctl start httpd
  380. 365 ps Zaux | grep http
  381. 366 ls -Z /var/www
  382. 367 sudo mkdir /web
  383. 368 ls -d /web
  384. 369 ls -dZ /web
  385. 370 vim selinux.yml
  386. 371 sudo ssh ansible2.example.com
  387. 372 vim selinux.yml
  388. 373 ansible-doc file
  389. 374 vim selinux.yml
  390. 375 ansible-playbook selinux.yml
  391. 376 vim selinux.yml
  392. 377 ../countdown 17
  393. 378 vim dg.sh
  394. 379 ls
  395. 380 vim vsftpd-template.yml
  396. 381 vim templates/vsftpd.j2
  397. 382 vim ansible.cfg
  398. 383 ansible-playbook vsftpd-template.yml
  399. 384 ansible all -a "cat /etc/vsftpd/vsftpd.conf"
  400. 385 ls
  401. 386 vim hostsfile.yml
  402. 387 vim templates/hosts.j2
  403. 388 ansible-playbook hostsfile.yml
  404. 389 ansible all -a "cat /etc/hosts"
  405. 390 vim templates/hosts.j2
  406. 391 ansible-galaxy install geerlingguy.nginx
  407. 392 cd ../lesson11
  408. 393 cd ~/.ansible/roles/
  409. 394 ls
  410. 395 cd geerlingguy.nginx/
  411. 396 ls
  412. 397 cd tasks/
  413. 398 ls
  414. 399 vim main.yml
  415. 400 vim setup-RedHat.yml
  416. 401 ls vars
  417. 402 cd ../vars/
  418. 403 ls
  419. 404 vim RedHat.yml
  420. 405 cd ../defaults/
  421. 406 ls
  422. 407 vim main.yml
  423. 408 cd ../templates/
  424. 409 ls
  425. 410 vim nginx.conf.j2
  426. 411 cd =
  427. 412 cd -
  428. 413 cd ~/rhce8-live/lesson11/
  429. 414 ls
  430. 415 vim nginx-role.yml
  431. 416 ansible-playbook nginx-role.yml
  432. 417 vim apache-vhost-role.yml
  433. 418 ls roles/
  434. 419 cd roles/mywebhost/
  435. 420 tree
  436. 421 cat tasks/main.yml
  437. 422 cat handlers/main.yml
  438. 423 cat templates/vhost.conf.j2
  439. 424 cat defaults/main.yml
  440. 425 cat vars/main.yml
  441. 426 pwd
  442. 427 cd ../..
  443. 428 ls
  444. 429 vim apache-vhost-role.yml
  445. 430 ansible-playbook apache-vhost-role.yml
  446. 431 ../countdown 12
  447. 432 cd roles/
  448. 433 ls
  449. 434 cat requirements.yml
  450. 435 ls
  451. 436 cd motd/
  452. 437 tree
  453. 438 cat tasks/main.yml
  454. 439 cat templates/motd.j2
  455. 440 cat defaults/main.yml
  456. 441 cd ../..
  457. 442 ls
  458. 443 vim motd-role.yml
  459. 444 ansible-playbook motd-role.yml
  460. 445 ansible all -a "cat /etc/motd"
  461. 446 ansible-galaxy --help
  462. 447 ansible-galaxy role --helo
  463. 448 ansible-galaxy role --help
  464. 449 ansible-galaxy role init
  465. 450 ansible-galaxy role init unclebob
  466. 451 ls
  467. 452 tree unclebob/
  468. 453 mv unclebob/ roles/
  469. 454 sudo yum install rhel-system-roles
  470. 455 sudo rpm -ql rhel-system-roles | less
  471. 456 cd /usr/share/doc/
  472. 457 ls
  473. 458 cd rhel-system-roles/
  474. 459 ls
  475. 460 pwd
  476. 461 cd selinux/
  477. 462 ls
  478. 463 cp example-selinux-playbook.yml ~/rhce8-live/lesson12/
  479. 464 cd
  480. 465 cd rhce8-live/lesson12/
  481. 466 ls
  482. 467 mv example-selinux-playbook.yml selinux-playbook.yml
  483. 468 vim selinux-playbook.yml
  484. 469 ansible-playbook selinux-playbook.yml
  485. 470 vim selinux-playbook.yml
  486. 471 ansible-playbook selinux-playbook.yml
  487. 472 ansible -a "ls -dZ /web"
  488. 473 ansible all -a "ls -dZ /web"
  489. 474 cd /usr/share/doc/rhel-system-roles/storage/
  490. 475 ls
  491. 476 cd ../
  492. 477 tree
  493. 478 cd ha_cluster/
  494. 479 ls
  495. 480 vim example-simple-playbook.yml
  496. 481 cd ../timesync/
  497. 482 ls
  498. 483 vim example-timesync-playbook.yml
  499. 484 vim example-timesync-pool.yml
  500. 485 vim example-timesync-pool-playbook.yml
  501. 486 cd
  502. 487 ansible all -i localhost, -m debug -a "msg={{ 'mypassword' | password_hash('sha512', 'mysecretsalt') }}"
  503. 488 cd rhce8-live/lesson12/
  504. 489 vim cryptopw.yaml
  505. 490 ansible-playbook cryptopw.yaml
  506. 491 vim cryptopw.yaml
  507. 492 ansible-playbook cryptopw.yaml -e user=anna
  508. 493 ansible all -a "tail /etc/shadow"
  509. 494 vim cryptopw.yaml
  510. 495 history
  511.  
Advertisement
Add Comment
Please, Sign In to add comment