Advertisement
sandervanvugt

ansible 3weeks day2 oct 21

Oct 18th, 2021
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.01 KB | None | 0 0
  1.  
  2. [ansible@controller filters]$ history
  3. 1 ip a
  4. 2 sudo vim /etc/hosts
  5. 3 cat /etc/hosts
  6. 4 sudo vim /etc/hosts
  7. 5 sudo dnf install epel-release
  8. 6 sudo dnf install -y ansible
  9. 7 ansible --version
  10. 8 vim /etc/hosts
  11. 9 mkdir projectone
  12. 10 cd projectone/
  13. 11 vim inventory
  14. 12 ansible -i inventory -m command -a "ip a"
  15. 13 ansible all -i inventory -m command -a "ip a"
  16. 14 cat /etc/hosts
  17. 15 sudo sh -c "echo password | passwd --stdin ansible"
  18. 16 echo ansible ALL=(ALL) NOPASSWD: ALL > /tmp/sudoers
  19. 17 echo 'ansible ALL=(ALL) NOPASSWD: ALL' > /tmp/sudoers
  20. 18 ansible all -i inventory -u root -k -m raw -a "useradd -G wheel ansible"
  21. 19 sudo vim /etc/ansible/ansible.cfg
  22. 20 ansible all -i inventory -u root -k -m raw -a "useradd -G wheel ansible"
  23. 21 ansible all -i inventory -u root -k -m raw -a "useradd -G wheel bob"
  24. 22 ansible all -i inventory -u root -k -m raw -a "userdel bob"
  25. 23 sudo cp /tmp/sudoers /etc/sudoers.d/ansible
  26. 24 sudo ls /root
  27. 25 su - ansible
  28. 26 ssh-keygen
  29. 27 ssh-copy-id ubuntu
  30. 28 ssh-copy-id centos7
  31. 29 ssh-copy-id rhel84
  32. 30 ansible all -i inventory -u root -k -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  33. 31 ls
  34. 32 cd projectone/
  35. 33 ansible all -i inventory -u root -k -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  36. 34 ansible all -i inventory -u ansible -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  37. 35 cd ..
  38. 36 sudo dnf install git -y
  39. 37 git clone https://github.com/sandervanvugt/ansiblein3weeks
  40. 38 git clone https://github.com/sandervanvugt/ansible3weeks
  41. 39 git clone https://github.com/sandervanvugt/ansibleinthreeweeks
  42. 40 cd ansibleinthreeweeks/
  43. 41 ls
  44. 42 cd ..
  45. 43 git clone https://github.com/sandervanvugt/luth
  46. 44 luth/countdown 15
  47. 45 ansible ubuntu -i inventory -u ansible -k -K -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  48. 46 cd projectone/
  49. 47 ansible ubuntu -i inventory -u ansible -k -K -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  50. 48 ansible ubuntu -i inventory -u ansible -k -K -m command -a "ls -ld /etc/sudoers.d"
  51. 49 ansible ubuntu -i inventory -u ansible -k -K -m command -a "ls -la /root"
  52. 50 vim inventory
  53. 51 cat /etc/ansible/hosts
  54. 52 less /etc/ansible/ansible.cfg
  55. 53 cd ../ansibleinthreeweeks/
  56. 54 ls
  57. 55 cd basics/
  58. 56 ls
  59. 57 cd ..
  60. 58 find . -name "ansible.cfg"
  61. 59 vim ansible.cfg
  62. 60 cp ansible.cfg ../projectone/
  63. 61 cd ../projectone/
  64. 62 ls
  65. 63 vim inventory
  66. 64 cd -
  67. 65 cd collections/
  68. 66 ls
  69. 67 vim ansible.cfg
  70. 68 ansible-doc -l
  71. 69 ansible-doc -l | wc
  72. 70 cd ../../projectone/
  73. 71 history
  74. 72 ansible ubuntu -i inventory -u ansible -b -k -K -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  75. 73 cat ansible.cfg
  76. 74 ansible -m package -a "name=nmap"
  77. 75 ansible ubuntu -m package -a "name=nmap"
  78. 76 ansible-doc package
  79. 77 ansible all -m command -a "useradd -m -s /bin/bash linda"
  80. 78 vim inventory
  81. 79 ansible all -m command -a "id linda"
  82. 80 ansible all -m command -a "useradd -m -s /bin/bash linda"
  83. 81 ansible all -m user -a "name=linda"
  84. 82 ../luth/countdown 12
  85. 83 sudo vim /etc/hosts
  86. 84 cd ../ansibleinthreeweeks/
  87. 85 ls
  88. 86 cd collections/
  89. 87 ls
  90. 88 vim enforce-selinux.yml
  91. 89 cd ../../projectone/
  92. 90 ansible all -m ping
  93. 91 ansible all -m user -a "name=lisa"
  94. 92 ansible all -m command -a "id lisa"
  95. 93 ansible all -m user -a "name=lisa state=absent"
  96. 94 ansible all -m command -a "id lisa"
  97. 95 ansible centos7 -m command -a "rpm -qa | grep python"
  98. 96 ansible centos7 -m shell -a "rpm -qa | grep python"
  99. 97 ansible all -m copy -a 'content="hello world" dest=/etc/motd'
  100. 98 ansible all -m command -a "cat /etc/motd"
  101. 99 ansible all -m package -a "name=nmap state=latest"
  102. 100 ansible all -m service -a "name=httpd state=started"
  103. 101 cd ../ansibleinthreeweeks/
  104. 102 ls
  105. 103 cd basics/
  106. 104 ls
  107. 105 cp ../../projectone/* .
  108. 106 ls
  109. 107 vim install_and_start_httpt.yaml
  110. 108 ansible-doc service
  111. 109 ls
  112. 110 ansible-playbook install_and_start_httpt.yaml
  113. 111 cd ..
  114. 112 ../luth/countdown 25
  115. 113 vim kp.yaml
  116. 114 ansible-doc service
  117. 115 vim kp.yaml
  118. 116 ansible-doc firewalld
  119. 117 vim kp.yaml
  120. 118 ansible-playbook kp.yaml
  121. 119 cd ../projectone/
  122. 120 ansible-playbook ../ansibleinthreeweeks/kp.yaml
  123. 121 cd ../ansibleinthreeweeks/basics/
  124. 122 ls
  125. 123 vim multi_play.yaml
  126. 124 cp ../../projectone/inventory .
  127. 125 ansible-playbook multi_play.yaml
  128. 126 vim multi_play.yaml
  129. 127 ansible-doc yum
  130. 128 vim multi_play.yaml
  131. 129 ansible-doc yum
  132. 130 ansible-playbook multi_play.yaml
  133. 131 cd ../..
  134. 132 git clone https://github.com/sandervanvugt/rhce8-live
  135. 133 cd rhce8-live/
  136. 134 ls
  137. 135 cd lesson16/
  138. 136 ls
  139. 137 vim software-advanced.yml
  140. 138 vim setup-rhel.yml
  141. 139 grep prompt *
  142. 140 cd ..
  143. 141 grep -r prompt *
  144. 142 cat lesson15/assertsize.yml
  145. 143 cd lesson16/
  146. 144 ls
  147. 145 vim setup-rhel.yml
  148. 146 ansible-playbook setup-rhel.yml
  149. 147 vim inventory
  150. 148 ansible-playbook setup-rhel.yml
  151. 149 vim setup-rhel.yml
  152. 150 cp setup-rhel.yml ~/ansibleinthreeweeks/
  153. 151 cd ~/ansibleinthreeweeks/
  154. 152 ls
  155. 153 cd basics/
  156. 154 ls
  157. 155 ansible-playbook playbook_with_errors.yaml
  158. 156 vim playbook_with_errors.yaml
  159. 157 ansible-playbook playbook_with_errors.yaml
  160. 158 vim playbook_with_errors.yaml
  161. 159 ansible-playbook playbook_with_errors.yaml
  162. 160 vim playbook_with_errors.yaml
  163. 161 ansible-playbook playbook_with_errors.yaml
  164. 162 vim playbook_with_errors.yaml
  165. 163 pwd
  166. 164 ../../luth/countdown 12
  167. 165 cd ..
  168. 166 cd basics/
  169. 167 vim inventory
  170. 168 ansible rhel84 -a "yum repolist"
  171. 169 ls
  172. 170 vim variables_example.yaml
  173. 171 ansible-playbook variables_example.yaml
  174. 172 ansible-playbook variables_example.yaml -e user=bob
  175. 173 vim variables_example.yaml
  176. 174 ansible rhel84 -m setup > rhelfacts.txt
  177. 175 less rhelfacts.txt
  178. 176 ansible-doc -l | grep fact
  179. 177 ansible-doc -l | grep _fact
  180. 178 vim gather_facts.yaml
  181. 179 less rhelfacts.txt
  182. 180 ansible-playbook gather_facts.yaml
  183. 181 ls
  184. 182 vim old_facts.yaml
  185. 183 ansible-playbook old_facts.yaml
  186. 184 vim new_facts.yaml
  187. 185 ansible-playbook new_facts.yaml
  188. 186 vim new_facts.yaml
  189. 187 vim myvars.yaml
  190. 188 vim vars_file.yaml
  191. 189 ansible-playbook vars_file.yaml
  192. 190 ls
  193. 191 cp vars_file.yaml vars_host.yaml
  194. 192 mkdir host_vars
  195. 193 vim vars_host.yaml
  196. 194 vim host_vars/centos7
  197. 195 ansible-playbook vars_host.yaml
  198. 196 vim host_vars/centos7
  199. 197 ansible-playbook vars_host.yaml
  200. 198 cd ../
  201. 199 cd ../rhce8-live/lesson5/
  202. 200 ls
  203. 201 cd webservers/
  204. 202 ls
  205. 203 cat group_vars/lamp
  206. 204 vim site.yml
  207. 205 cd ../..
  208. 206 pwd
  209. 207 cd ../ansibleinthreeweeks/
  210. 208 cd basics/
  211. 209 ls
  212. 210 vim host_vars/centos7
  213. 211 ansible-playbook vars_host.yaml
  214. 212 cd ../..
  215. 213 cd rhce8-live/lesson16/
  216. 214 ls
  217. 215 vim software-advanced.yml
  218. 216 cd
  219. 217 history
  220. 218 sudo poweroff
  221. 219 sudo vim /etc/hosts
  222. 220 ip a
  223. 221 sudo vim /etc/hosts
  224. 222 cd ansibleinthreeweeks/
  225. 223 vim inventory
  226. 224 cd basics/
  227. 225 vim inventory
  228. 226 cp inventory ..
  229. 227 ansible all -m copy -a "src=/etc/hosts dest=/etc/hosts"
  230. 228 ssh-copy-id tower
  231. 229 exit
  232. 230 ansible all -m copy -a "src=/etc/hosts dest=/etc/hosts"
  233. 231 cd ansibleinthreeweeks/basics/
  234. 232 vim ansible.cfg
  235. 233 ansible tower -m copy -a "src=/etc/hosts dest=/etc/hosts"
  236. 234 exit
  237. 235 history
  238. 236 cd ansibleinthreeweeks/
  239. 237 ls
  240. 238 find . -name "create-users.yml"
  241. 239 cd ..
  242. 240 find . -name "create-users.yml"
  243. 241 ls
  244. 242 find . -name "create-users.*"
  245. 243 cd rhce8-live/
  246. 244 ls
  247. 245 cd lesson5/
  248. 246 ls
  249. 247 cd ../lesson7/
  250. 248 ls
  251. 249 cd vault/
  252. 250 ls
  253. 251 cd ../..
  254. 252 cd ../ansibleinthreeweeks/
  255. 253 find . -name "create-user.*"
  256. 254 ls
  257. 255 ansible-vault create secret.yml
  258. 256 ansible-vault edit secret.yml
  259. 257 vim create-user.yml
  260. 258 ansible-playbook create-user.yml
  261. 259 ansible-playbook --ask-vault-pass create-user.yml
  262. 260 echo password > vault-pass
  263. 261 ansible-playbook --vault-password-file=vault-pass create-user.yml
  264. 262 vim /etc/ansible/ansible.cfg
  265. 263 ls
  266. 264 cd templates/
  267. 265 ls
  268. 266 vim vsftpd-template.yml
  269. 267 vim vsftpd.j2
  270. 268 ansible-playbook vsftpd-template.yml
  271. 269 cp ../basics/inventory .
  272. 270 cat inventory
  273. 271 ansible-playbook vsftpd-template.yml
  274. 272 ls
  275. 273 cp ../basics/ansible.cfg .
  276. 274 cat ansible.cfg
  277. 275 ansible-playbook vsftpd-template.yml
  278. 276 vim vsftpd-template.yml
  279. 277 pwd
  280. 278 ansible rhel84 -m command -a "cat /etc/vsftpd/vsftpd.conf"
  281. 279 cd ..
  282. 280 ls
  283. 281 cd task_control/
  284. 282 ls
  285. 283 vim handlers.yml
  286. 284 echo hello world > /tmp/index.html
  287. 285 cp ../basics/inventory .
  288. 286 ansible-playbook handlers.yml
  289. 287 cp ../basics/ansible.cfg .
  290. 288 ansible-playbook handlers.yml
  291. 289 vim handlers.yml
  292. 290 ansible-playbook handlers.yml
  293. 291 ansible all -m file -a "name=/tmp/index.html state=absent"
  294. 292 ansible all -m file -a "name=/var/www/html/index.html state=absent"
  295. 293 ansible-playbook handlers.yml
  296. 294 cd ..
  297. 295 ls
  298. 296 luth/countdown 13
  299. 297 ip a
  300. 298 cd ansibleinthreeweeks/
  301. 299 ls
  302. 300 cd task_control/
  303. 301 ls
  304. 302 vim loopservices.yml
  305. 303 ansible-playbook loopservices.yml
  306. 304 vim inventory
  307. 305 ansible-playbook loopservices.yml
  308. 306 vim loopservices.yml
  309. 307 ansible-playbook loopservices.yml
  310. 308 ~/luth/countdown 12
  311. 309 ls
  312. 310 vim ifsize.yml
  313. 311 ansible-playbook ifsize.yml
  314. 312 vim ifsize.yml
  315. 313 ansible-playbook ifsize.yml
  316. 314 lw
  317. 315 ls
  318. 316 vim when_multiple.yml
  319. 317 vim ifsize.yml
  320. 318 vim when_multiple.yml
  321. 319 ansible-playbook when_multiple.yml
  322. 320 cd ..
  323. 321 ls
  324. 322 cd roles
  325. 323 ls
  326. 324 cd ..
  327. 325 cd roles
  328. 326 ansible-galaxy install geerlingguy.nginx
  329. 327 cd ~/.ansible/roles/geerlingguy.nginx/
  330. 328 tree
  331. 329 vim tasks/main.yml
  332. 330 vim tasks/setup-RedHat.yml
  333. 331 cd ..
  334. 332 pwd
  335. 333 cd ~/ansibleinthreeweeks/roles/
  336. 334 ls
  337. 335 vim nginx-role.yml
  338. 336 ansible-playbook nginx-role.yml
  339. 337 cp ../basics/ansible.cfg .
  340. 338 cp ../basics/inventory .
  341. 339 ansible-playbook nginx-role.yml
  342. 340 pwd
  343. 341 cd
  344. 342 luth/countdown 20
  345. 343 ls
  346. 344 git clone https://github.com/sandervanvugt/rhce8-book
  347. 345 cd rhce8-book/
  348. 346 grep tag *
  349. 347 vim exercise123.yaml
  350. 348 ansible-playbook --list-tags exercise123.yaml
  351. 349 vim exercise123.yaml
  352. 350 ansible-playbook --list-tags exercise123.yaml -e newhost=tower -e newhostip=192.168.29.20
  353. 351 ansible-playbook --prompt-vault-pass --list-tags exercise123.yaml -e newhost=tower -e newhostip=192.168.29.20
  354. 352 ansible-playbook --ask-vault-pass --list-tags exercise123.yaml -e newhost=tower -e newhostip=192.168.29.20
  355. 353 vim exercise123.yaml
  356. 354 ansible-playbook exercise123.yaml --tags add-host -e newhost=tower -e newhostip=192.168.29.20
  357. 355 vim exercise123.yaml
  358. 356 ansible-playbook exercise123.yaml --tags addhost -e newhost=tower -e newhostip=192.168.29.20
  359. 357 ansible tower -m setup
  360. 358 grep vgs *
  361. 359 vim exercise153.yaml
  362. 360 cd ../ansibleinthreeweeks/
  363. 361 find . -name "sync*"
  364. 362 vim synchronize.yaml
  365. 363 ansible all -m command -a "grep requiretty /etc/sudoers"
  366. 364 ansible all -m command -a "grep wheel /etc/sudoers"
  367. 365 ansible-doc -t callback -l
  368. 366 ansible-doc -t callback yamlize
  369. 367 ansible-doc -t callback -l
  370. 368 ansible-doc -t callback yaml
  371. 369 ls
  372. 370 cd plugins/
  373. 371 ls
  374. 372 vim ansible.cfg
  375. 373 sudo cgcreate -a ansible:ansible -t ansible:ansible -g cpuacct,memory,pid:ansible_profile
  376. 374 sudo yum provides */cgcreate
  377. 375 sudo yum install libcgroup-tools
  378. 376 sudo cgcreate -a ansible:ansible -t ansible:ansible -g cpuacct,memory,pid:ansible_profile
  379. 377 pwd
  380. 378 ../../luth/countdown 12
  381. 379 sudo vim /etc/default/grub
  382. 380 sudo grub2-mkconfig -o /boot/grub2/grub.cfg
  383. 381 sudo reboot
  384. 382 luth/countdown 5
  385. 383 sudo cgcreate -a ansible:ansible -t ansible:ansible -g cpuacct,memory,pid:ansible_profile
  386. 384 mount | grep cgroup
  387. 385 sudo cgcreate -a ansible:ansible -t ansible:ansible -g cpuacct,memory,pids:ansible_profile
  388. 386 #cgexec -g cpuacct,memory,pids:ansible_profile ansible_playbook
  389. 387 cd ansibleinthreeweeks/
  390. 388 ls
  391. 389 cd plugins/
  392. 390 ls
  393. 391 cgexec -g cpuacct,memory,pids:ansible_profile ansible_playbook hello.yml
  394. 392*
  395. 393 vim ansible.cfg
  396. 394 ansible-playbook hello.yml
  397. 395 cd ..
  398. 396 cd filters/
  399. 397 ls
  400. 398 vim int-filter.yaml
  401. 399 ansible-playbook int-filter.yaml
  402. 400 vim int-filter.yaml
  403. 401 ansible-playbook int-filter.yaml
  404. 402 vim int-filter.yaml
  405. 403 ansible-playbook int-filter.yaml
  406. 404 ls -l /tmp
  407. 405 vim storage-filter.yaml
  408. 406 vim assert_filter.yaml
  409. 407 ansible-playbook assert_filter.yaml
  410. 408 vim assert_filter.yaml
  411. 409 ansible-playbook assert_filter.yaml
  412. 410 vim assert_filter.yaml
  413. 411 vim password_hash.yaml
  414. 412 sudo cat /etc/shadow
  415. 413 vim password_hash.yaml
  416. 414 cp password_hash.yaml passdumb.yaml
  417. 415 vim passdumb.yaml
  418. 416 ansible-playbook passdumb.yaml -e user=lisa
  419. 417 cp ../basics/inventory .
  420. 418 cp ../basics/ansible.cfg .
  421. 419 ansible-playbook passdumb.yaml -e user=lisa
  422. 420 ansible rhel84 -a "cat /etc/shadow"
  423. 421 vim password_hash.yaml
  424. 422 ansible-playbook password_hash.yaml
  425. 423 ansible rhel84 -a "cat /etc/shadow"
  426. 424 history
  427.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement