Advertisement
sandervanvugt

ansible3weeks day3 sept22

Sep 23rd, 2022
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.05 KB | None | 0 0
  1. The connection to the server 192.168.29.30:6443 was refused - did you specify the right host or port?
  2. [ansible@control kubernetes]$ history
  3. 1 cd ansiblein3weeks/
  4. 2 ./countdown 12
  5. 3 cd ansiblein3weeks/
  6. 4 ./countdown 1
  7. 5 cd ansiblein3weeks/
  8. 6 ./countdown 12
  9. 7 ip a
  10. 8 sudo vim /etc/hosts
  11. 9 ssh root@ansible1
  12. 10 sudo dnf search ansible
  13. 11 sudo dnf install ansible-core
  14. 12 ansible --version
  15. 13 history
  16. 14 vim inventory
  17. 15 ansible -i inventory all -m command -a "useradd ansible"
  18. 16 ping ansible2
  19. 17 ping ansible1
  20. 18 ansible -i inventory all -m command -a "useradd ansible" -k
  21. 19 ssh ansible1
  22. 20 ssh root@ansible1
  23. 21 ssh root@ansible2
  24. 22 ansible -i inventory all -m command -a "useradd ansible" -k -u root
  25. 23 ansible -i inventory all -m command -a "useradd ansible" -k -u student -b -K
  26. 24 history
  27. 25 sudo echo password | passwd --stdin ansible
  28. 26 sudo sh -c 'echo password | passwd --stdin ansible'
  29. 27 ansible -i inventory -m command -a "rpm -qa | grep bash"
  30. 28 ansible -i inventory all -m command -a "rpm -qa | grep bash"
  31. 29 ansible -i inventory all -m command -a "rpm -qa | grep bash" -k
  32. 30 ansible -i inventory all -m command -a "rpm -qa | grep bash" -k -u root
  33. 31 ansible -i inventory all -m shell -a "rpm -qa | grep bash" -k -u root
  34. 32 ansible -i inventory all -m shell -a "echo password | passwd --stdin ansible" -k -u root
  35. 33 ansible -i inventory all -m command -a "whoami" -k
  36. 34 ansible -i inventory all -m command -a "ls -l /root" -k
  37. 35 ansible -i inventory all -m command -a "ls -l /root" -k -b
  38. 36 ansible -i inventory all -m command -a "ls -l /root" -k -b -K
  39. 37 sudo dnf install git
  40. 38 git clone https://github.com/sandervanvugt/ansiblein3weeks
  41. 39 cd ansiblein3weeks/
  42. 40 ls
  43. 41 history
  44. 42 ansible-doc copy
  45. 43 #ansible -i inventory all -m copy -a "content='ansible ALL=(ALL) NOPASSWD: ALL' dest=/etc/sudoers.d/ansible" -u root -k
  46. 44 sudo visudo
  47. 45 ansible -i inventory all -m copy -a "content='ansible ALL=(ALL) NOPASSWD: ALL' dest=/etc/sudoers.d/ansible" -u root -k
  48. 46 cat inventory
  49. 47 ansible -i inventory all -m copy -a "content='ansible ALL=(ALL) NOPASSWD: ALL' dest=/etc/sudoers.d/ansible" -u root -k
  50. 48 ansible -i inventory all -m command -a "ls -l /root" -k -b -K
  51. 49 history
  52. 50 ssh-keygen
  53. 51 ssh-copy-id ansible1.example.com
  54. 52 ssh-copy-id ansible2.example.com
  55. 53 ssh-copy-id control.example.com
  56. 54 ansible -i inventory all -m command -a "ls -l /root" -b
  57. 55 history
  58. 56 ansible -i inventory all -m command -a "useradd lisa" -b
  59. 57 ansible -i inventory all -m user -a "name=lisa" -b
  60. 58 history
  61. 59 ansible -i inventory all -m command -a "date"
  62. 60 vim ansible.cfg
  63. 61 ansible all -m command -a "date"
  64. 62 ansible all -m command -a "ls -l /root"
  65. 63 ansible all -m command -a "ls -l /root" -b
  66. 64 history
  67. 65 ansible --version
  68. 66 ansible-doc -l
  69. 67 ansible-doc -l | wc
  70. 68 ansible-galaxy collection install azure.azcollection
  71. 69 ansible-doc -l
  72. 70 cd basics/
  73. 71 ls
  74. 72 history | grep git
  75. 73 ls
  76. 74 vim run_and_test_httpd.yaml
  77. 75 ln ../inventory inventory
  78. 76 ln ../ansible.cfg ansible.cfg
  79. 77 vim inventory
  80. 78 vim ansible.cfg
  81. 79 ansible-playbook run_and_test_httpd.yaml
  82. 80 vim ansible.cfg
  83. 81 vim run_and_test_httpd.yaml
  84. 82 ansible-playbook run_and_test_httpd.yaml
  85. 83 vim run_and_test_httpd.yaml
  86. 84 ansible ansible2 -a "firewall-cmd --list-all" -b
  87. 85 ansible-doc firewalld
  88. 86 history | grep collection
  89. 87 ansible-galaxy collection install ansible.posix
  90. 88 ansible-doc -l | grep posix
  91. 89 ansible-doc firewalld
  92. 90 vim run_and_test_httpd.yaml
  93. 91 ansible-playbook run_and_test_httpd.yaml
  94. 92 vim run_and_test_httpd.yaml
  95. 93 curl ansible2
  96. 94 curl http://ansible2
  97. 95 ping ansible2
  98. 96 curl https://ansible2
  99. 97 history
  100. 98 ansible ansible2 -a "firewall-cmd --list-all" -b
  101. 99 vim run_and_test_httpd.yaml
  102. 100 ansible-playbook run_and_test_httpd.yaml
  103. 101 curl http://ansible2
  104. 102 vim run_and_test_httpd.yaml
  105. 103 ansible-doc uri
  106. 104 vim run_and_test_httpd.yaml
  107. 105 ansible-playbook run_and_test_httpd.yaml
  108. 106 vim run_and_test_httpd.yaml
  109. 107 ls
  110. 108 vim variables_example.yaml
  111. 109 ansible-playbook variables_example.yaml
  112. 110 ansible-playbook variables_example.yaml -e user=bob
  113. 111 vim variables_example.yaml
  114. 112 ansible-playbook variables_example.yaml -e user=bob
  115. 113 ../countdown 18
  116. 114 ls
  117. 115 vim gather_facts.yaml
  118. 116 ansible-playbook gather_facts.yaml | less
  119. 117 vim gather_facts.yaml
  120. 118 ansible-playbook gather_facts.yaml
  121. 119 ansible ansible1 -m setup | less
  122. 120 vim old_facts.yaml
  123. 121 ansible-playbook old_facts.yaml
  124. 122 vim new_facts.yaml
  125. 123 ansible-playbook new_facts.yaml
  126. 124 vim new_facts.yaml
  127. 125 ansible ansible1 -m setup | less
  128. 126 vim myvars.yaml
  129. 127 vim vars_file.yaml
  130. 128 ansible-playbook vars_file.yaml
  131. 129 ansible-playbook vars_file.yaml -b
  132. 130 ls
  133. 131 vim inventory
  134. 132 mkdir web
  135. 133 vim web/group_vars
  136. 134 vim vars_file.yaml
  137. 135 ansible-playbook vars_file.yaml
  138. 136 ls
  139. 137 vim inventory
  140. 138 vim web/group_vars
  141. 139 mkdir group_vars
  142. 140 mv web/group_vars group_vars/web
  143. 141 ansible-playbook vars_file.yaml
  144. 142 ansible-playbook vars_file.yaml -b
  145. 143 vim vars_file.yaml
  146. 144 ls\
  147. 145 ls
  148. 146 rm -rf web/
  149. 147 history
  150. 148 sudo poweroff
  151. 149 ssh-add ~/.ssh/id_rsa
  152. 150 ssh ansible1
  153. 151 ssh ansible2
  154. 152 vim securedo.yaml
  155. 153 ansible-playbook securedo.yaml
  156. 154 vim securedo.yaml
  157. 155 ansible-playbook securedo.yaml
  158. 156 ansible all -m copy -a "'content=ansible ALL=(ALL): ALL' dest=/etc/sudoers.d/ansible force=yes"
  159. 157 ansible all -m copy -a "content='ansible ALL=(ALL): ALL' dest=/etc/sudoers.d/ansible force=yes"
  160. 158 ansible all -m copy -a "content='ansible ALL=(ALL): ALL' dest=/etc/sudoers.d/ansible force=yes" -b
  161. 159 ansible all -a 'ls -l /root'
  162. 160 ansible all -a 'ls -l /root' -b
  163. 161 ansible all -a 'ls -l /root' -b -K
  164. 162 ssh ansible@ansible1
  165. 163 ssh ansible2
  166. 164 ansible all -a 'ls -l /root' -b -K
  167. 165 ansible all -a 'ls -l /root' -b
  168. 166 ../countdown 20
  169. 167 cd ../filters/
  170. 168 ls
  171. 169 vim int-filter.yaml
  172. 170 ansible-playbook int-filter.yaml
  173. 171 cp ../inventory .
  174. 172 cp ../ansible.cfg .
  175. 173 ansible-playbook int-filter.yaml
  176. 174 vim int-filter.yaml
  177. 175 ansible-playbook int-filter.yaml
  178. 176 vim int-filter.yaml
  179. 177 ansible-playbook int-filter.yaml
  180. 178 vim storage-filter.yaml
  181. 179 vim password_hash.yaml
  182. 180 ansible-playbook password_hash.yaml
  183. 181 ansible-playbook password_hash.yaml -b
  184. 182 vim assert_filter.yaml
  185. 183 ansible-playbook assert_filter.yaml
  186. 184 sudo dnf install -y python3-netaddr
  187. 185 ls
  188. 186 cd ..
  189. 187 ls
  190. 188 cd plugins/
  191. 189 ls
  192. 190 vim network.yaml
  193. 191 ansible-playbook network.yaml
  194. 192 cat ansible.cfg
  195. 193 cat inventory
  196. 194 cp ../inventory .
  197. 195 ansible-playbook network.yaml
  198. 196 ansible-galaxy collection install ansible.netcommon
  199. 197 ansible-playbook network.yaml
  200. 198 vim network.yaml
  201. 199 ansible-playbook network.yaml
  202. 200 #ansible-galaxy collection install ansible.netcommon
  203. 201 vim readkeys.yaml
  204. 202 ansible-playbook readkeys.yaml
  205. 203 vim readkeys.yaml
  206. 204 ls
  207. 205 ls ansible/id_rsa.pub
  208. 206 ansible-doc -t lookup -l
  209. 207 ansible-doc -t lookup file
  210. 208 ls
  211. 209 vim hello.yml
  212. 210 ansible-playbook hello.yml
  213. 211 find .. -name "mytemplate*"
  214. 212 cp ../templates/mytemplate.j2 .
  215. 213 ansible-playbook hello.yml
  216. 214 vim mytemplate.j2
  217. 215 ../countdown 9
  218. 216 vim nm-week3.yaml
  219. 217 vim ansible.cfg
  220. 218 ls
  221. 219 ansible-playbook hello.yml
  222. 220 ansible-inventory --yaml -i inventory --list --output inventory.yaml
  223. 221 vim ansible.cfg
  224. 222 ansible-inventory --yaml -i inventory --list --output inventory.yaml
  225. 223 vim inventory.yaml
  226. 224 cat ../windows/inventory
  227. 225 ansible-inventory --yaml -i ../windows/inventory --list --output winventory.yaml
  228. 226 vim winventory.yaml
  229. 227 ansible-doc -t inventory -l
  230. 228 sudo dnf install -y redis
  231. 229 sudo systemctl enable --now redis
  232. 230 sudo pip3 install redis
  233. 231 sudo dnf install python3-pip -y
  234. 232 sudo pip3 install redis
  235. 233 vim ansible.cfg
  236. 234 ansible all -m setup
  237. 235 ls
  238. 236 cd ..
  239. 237 ls
  240. 238 cd factcache/
  241. 239 ls
  242. 240 ./checkcache.py
  243. 241 vim ansible.cfg
  244. 242 ansible all -m setup | less
  245. 243 ansible-galaxy collection install community.general
  246. 244 ansible all -m setup | less
  247. 245 vim inventory
  248. 246 ansible all -m setup
  249. 247 ./checkcache.py
  250. 248 ansible all -m setup | less
  251. 249 vim checkfacts.yaml
  252. 250 ansible-playbook checkfacts.yaml
  253. 251 vim checkfacts.yaml
  254. 252 history
  255. 253 sudo poweroff
  256. 254 history
  257. 255 cd ansiblein3weeks/
  258. 256 ls
  259. 257 cd windows/
  260. 258 ls
  261. 259 sudo vim /etc/hosts
  262. 260 vim inventory
  263. 261 vim ansible.cfg
  264. 262 #sudo pip3 install pywinrm
  265. 263 sudo dnf search pip
  266. 264 sudo pip3 install pywinrm
  267. 265 ansible win -i inventory -m win_ping
  268. 266 ansible galaxy collection install ansible.windows
  269. 267 ansible-galaxy collection install ansible.windows
  270. 268 ansible win -i inventory -m win_ping
  271. 269 ansible win -i inventory -m setup
  272. 270 ansible-doc -l | grep fact
  273. 271 ansible-doc -l | grep win | less
  274. 272 vim playbook.yml
  275. 273 ansible-doc win_user
  276. 274 ansible-playbook playbook.yml
  277. 275 vim wiebenik.yaml
  278. 276 ansible-playbook wiebenik.yaml
  279. 277 ls
  280. 278 vim createad.yml
  281. 279 ansible-playbook createad.yml
  282. 280 cd ..
  283. 281 ls
  284. 282 cd docker/
  285. 283 ls
  286. 284 cat inventory
  287. 285 cat /etc/hosts
  288. 286 sudo vim /etc/hosts
  289. 287 vim ansible.cfg
  290. 288 ansible -a "whoami"
  291. 289 ansible dubuntu -a "whoami"
  292. 290 vim inventory
  293. 291 ansible dubuntu -a "whoami"
  294. 292 ssh-copy-id
  295. 293 ssh-copy-id dubuntu
  296. 294 ssh-copy-id ansible@dubuntu
  297. 295 cat /etc/hosts
  298. 296 vim ansible.cfg
  299. 297 sudo vim /etc/hosts
  300. 298 ssh-copy-id dubuntu
  301. 299 ansible dubuntu -a "whoami" -k
  302. 300 ansible dubuntu -a "whoami" -k -b -K
  303. 301 ansible dubuntu -a "whoami" -k
  304. 302 ansible dubuntu -a "whoami" -k -K
  305. 303 sudo cat /etc/sudoers.d/ansible
  306. 304 ansible dubuntu -a "whoami" -k
  307. 305 ssh-copy-id dubuntu
  308. 306 ls
  309. 307 vim docker_main.yaml
  310. 308 vim docker-ubuntu.yaml
  311. 309 vim newdocker.yaml
  312. 310 vim docker-ubuntu.yaml
  313. 311 sudo apt search docker.io
  314. 312 ansible dubuntu -a "apt search docker.io"
  315. 313 vim docker-ubuntu.yaml
  316. 314 vim newdocker.yaml
  317. 315 ls
  318. 316 ansible-playbook docker_main.yaml
  319. 317 ansible-galaxy collection install community.docker
  320. 318 ansible-playbook docker_main.yaml \
  321. 319 ansible-playbook docker_main.yaml
  322. 320 history
  323. 321 ls
  324. 322 vim podman.yaml
  325. 323 ansible-galaxy collection install containers.podman
  326. 324 ansible-doc -l | grep podman
  327. 325 vim podman.yaml
  328. 326 vim inventory
  329. 327 ansible-playbook podman.yaml
  330. 328 ansible-playbook podman.yaml -K
  331. 329 podman search httpd | grep docker
  332. 330 vim podman.yaml
  333. 331 ansible-playbook podman.yaml
  334. 332 vim podman.yaml
  335. 333 ansible-playbook podman.yaml
  336. 334 ansible ansible1 -a "podman ps"
  337. 335 ssh ansible1
  338. 336 vim podman.yaml
  339. 337 ssh ansible1
  340. 338 cd ../cisco/
  341. 339 ls
  342. 340 ansible-galaxy collection install community.ciscosmb
  343. 341 ansible-doc -l | grep cisco
  344. 342 vim inventory-
  345. 343 vim inventory-smb
  346. 344 vim ansible.cfg
  347. 345 ansible switch1 -i inventory-smb -m ping -u admin -k
  348. 346 vim inventory-smb
  349. 347 vim ~/.ssh/config
  350. 348 sudo pip3 install paramiko
  351. 349 vim inventory-smb
  352. 350 cat inventory-ios
  353. 351 ls
  354. 352 vim smbfacts.yaml
  355. 353 ansible-playbook smbfacts.yaml
  356. 354 ansible-playbook smbfacts.yaml -i inventory-smb
  357. 355 vim iosbackup.yml
  358. 356 ansible-galaxy collection install cisco.ios
  359. 357 vim iosbackup.yml
  360. 358 ls
  361. 359 ansible-playbook -i inventory-ios iosbackup.yml
  362. 360 ls
  363. 361 cd backup/
  364. 362 ls
  365. 363 less switch1_config.2022-09-23@16\:08\:06
  366. 364 cd ..
  367. 365 ./countdown 14
  368. 366 cd provision-kvm/
  369. 367 ls
  370. 368 cat host_vars/
  371. 369 cat host_vars/localhost
  372. 370 cat ansible.cfg
  373. 371 ssh student@192.168.52.129
  374. 372 rm ~/.ssh/config
  375. 373 ssh student@192.168.52.129
  376. 374 ping 192.168.52.129
  377. 375 ping 192.168.52.162
  378. 376 cd ..
  379. 377 ping 192.168.52.136
  380. 378 ssh student@192.168.52.136
  381. 379 ssh ansible@192.168.52.136
  382. 380 ansible-galaxy collection install azure.azcollection
  383. 381 cd azure/
  384. 382 ls
  385. 383 vim create-azure-stuff.yaml
  386. 384 ansible-playbook create-azure-stuff.yaml
  387. 385 sudo pip3 install 'ansible[azure]'
  388. 386 ansible-playbook create-azure-stuff.yaml
  389. 387 sudo pip3 install msrest
  390. 388 ansible-playbook create-azure-stuff.yaml
  391. 389 sudo pip3 install msrestazure
  392. 390 ansible-playbook create-azure-stuff.yaml
  393. 391 sudo pip3 install azure.cli
  394. 392 ansible-playbook create-azure-stuff.yaml
  395. 393 sudo pip3 install azure.storage.cloudstorageaccount
  396. 394 sudo pip3 install azure.storage
  397. 395 ansible-playbook create-azure-stuff.yaml
  398. 396 sudo pip3 install azure.mgmt
  399. 397 ansible-playbook create-azure-stuff.yaml
  400. 398 ansible-galaxy collection install community.azure
  401. 399 ansible-playbook create-azure-stuff.yaml
  402. 400 sudo pip3 install boto boto3
  403. 401 cd ../ec2/
  404. 402 ls
  405. 403 mkdir group_vars
  406. 404 mkdir all
  407. 405 ls ~
  408. 406 cat ~/aws_keys
  409. 407 pwd
  410. 408 ansible-vault create group_vars/all/keys.yml
  411. 409 ansible-vault edit group_vars/all/keys.yml
  412. 410 clear
  413. 411 vim list-instances.yml
  414. 412 ansible-playbook --ask-vault-pass list-instances.yml
  415. 413 vim ubuntu-new.yaml
  416. 414 ansible-playbook --ask-vault-pass ubuntu-new.yaml
  417. 415 ansible-playbook --ask-vault-pass list-instances.yml
  418. 416 ansible localhost -m ec2 -a 'instance_id=i-018ca5cd07702a56d state=absent region=us-west-2'
  419. 417 ansible localhost --ask-vault-pass -m ec2 -a 'instance_id=i-018ca5cd07702a56d state=absent region=us-west-2'
  420. 418 ls
  421. 419 cp ubuntu-new.yaml ubuntu-kill.yaml
  422. 420 vim ubuntu-kill.yaml
  423. 421 ansible-playbook --ask-vault-pass ubuntu-kill.yaml
  424. 422 ansible-playbook --ask-vault-pass list-instances.yml
  425. 423 cd ..
  426. 424 ./countdown 10
  427. 425 pip3 install kubernetes
  428. 426 pip3 install openshift
  429. 427 ansible-galaxy collection install kubernetes.core
  430. 428 ansible-galaxy collection install community.kubernetes
  431. 429 cat /etc/hosts
  432. 430 cd kubernetes/
  433. 431 ls
  434. 432 cat README.txt
  435. 433 ansible-galaxy role install geerlingguy.containerd
  436. 434 ls -l
  437. 435 cat inventory
  438. 436 vim inventory
  439. 437 vim kube-cluster-setup.yaml
  440. 438 ansible-playbook kube-cluster-setup.yaml -u ansible -k -K -e kubehost=kubuntu
  441. 439 vim kube-cluster-setup.yaml
  442. 440 ansible-playbook kube-cluster-setup.yaml -u ansible -k -K
  443. 441 vim inventory
  444. 442 ping kubuntu
  445. 443 ansible kubuntu -a "whoami"
  446. 444 ansible-playbook kube-cluster-setup.yaml -u ansible -k -K -i inventory
  447. 445 cp ../ansible.cfg .
  448. 446 vim ansible.cfg
  449. 447 ansible-playbook kube-cluster-setup.yaml -k
  450. 448 vim ansible.cfg
  451. 449 vim kube-cluster-setup.yaml
  452. 450 ansible-playbook kube-cluster-setup.yaml -k
  453. 451 kubectl get all
  454. 452 kubectl get all -A
  455. 453 vim kube-cluster-setup.yaml
  456. 454 ansible-playbook --tags finishin kube-cluster-setup.yaml -k
  457. 455 ansible-playbook --tags finishing kube-cluster-setup.yaml -k
  458. 456 kubectl get all
  459. 457 vim kube-cluster-setup.yaml
  460. 458 ansible-playbook --tags finishing kube-cluster-setup.yaml -k
  461. 459 kubectl edit node
  462. 460 kubectl run nginx --image=nginx
  463. 461 kubectl get all
  464. 462 history
  465.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement