Advertisement
sandervanvugt

ansible in 3 weeks oct 23

Oct 24th, 2023
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.45 KB | None | 0 0
  1. [ansible@control kubernetes]$ history
  2. 1 ip a
  3. 2 sudo vim /etc/hosts
  4. 3 ping ubuntu
  5. 4 sudo dnf install ansible-core
  6. 5 ansible --version
  7. 6 vim inventory
  8. 7 ansible -i inventory all -u student -k -b -K -m command -a "useradd ansible"
  9. 8 ssh student@ansile1
  10. 9 ssh student@ansible1
  11. 10 ssh student@ansible2
  12. 11 ssh student@ubuntu
  13. 12 ansible -i inventory all -u student -k -b -K -m command -a "useradd ansible"
  14. 13 ansible -i inventory all -u student -k -b -K -m user -a "name=ansible state=present"
  15. 14 history
  16. 15 ansible -i inventory all -u student -k -b -K -m shell "echo password | passwd --stdin ansible"
  17. 16 ansible -i inventory all -u student -k -b -K -m shell -a "echo password | passwd --stdin ansible"
  18. 17 sudo visudo
  19. 18 ansible -i inventory all -u student -k -b -K -m copy -a 'content="ansible ALL=(ALL) NOPASSWD: ALL" dest=/etc/sudoers.d/ansible'
  20. 19 ansible -i inventory all -u ansible -k -b -m command -a "ls -l /root"
  21. 20 sudo dnf install -y git
  22. 21 git clone https://github.com/sandervanvugt/ansiblein3weeks
  23. 22 history
  24. 23 cd ansiblein3weeks/
  25. 24 ls
  26. 25 cd basics/
  27. 26 ls
  28. 27 cd ..
  29. 28 vim ansible.cfg
  30. 29 cp ../inventory .
  31. 30 ansible all -k -a "ls -l /root"
  32. 31 ssh-keygen
  33. 32 ssh-copy-id ansible1
  34. 33 ssh-copy-id ansible2
  35. 34 ssh-copy-id ubuntu
  36. 35 history
  37. 36 exit
  38. 37 cd ansiblein3weeks/
  39. 38 ./countdown 13
  40. 39 ./countdown 1
  41. 40 ./countdown 18
  42. 41 ./countdown 13
  43. 42 cd ..
  44. 43 ./countdown 17
  45. 44 vim secureme.yml
  46. 45 ansible-playbook secureme.yml
  47. 46 ansible all -a "cat /etc/sudoers.d/ansible"
  48. 47 sudo visudo
  49. 48 ansible all -m copy -a "content='ansible ALL=(ALL) ALL' dest=/etc/sudoers.d/ansible"
  50. 49 ansible all -a 'ls /root'
  51. 50 ansible all -a 'ls /root' -K
  52. 51 ansible all -a 'ls /root'
  53. 52 ls
  54. 53 cd filters/
  55. 54 ls
  56. 55 cat storage-filter.yaml
  57. 56 vim storage-filter.yaml
  58. 57 ansible-playbook storage-filter.yaml
  59. 58 cp ../inventory .
  60. 59 ls
  61. 60 cp ../ansible.cfg .
  62. 61 ansible-galaxy collection install community.general
  63. 62 ansible-playbook storage-filter.yaml
  64. 63 vim inventory
  65. 64 ansible-playbook storage-filter.yaml
  66. 65 ansible-playbook storage-filter.yaml -K
  67. 66 vim storage-filter.yaml
  68. 67 ansible-playbook storage-filter.yaml -K
  69. 68 ansible ansible1 -m setup | less
  70. 69 vim int-filter.yaml
  71. 70 ansible-playbook int-filter.yaml
  72. 71 vim int-filter.yaml
  73. 72 ansible-playbook int-filter.yaml
  74. 73 vim int-filter.yaml
  75. 74 ansible-playbook int-filter.yaml
  76. 75 vim assert_filter.yaml
  77. 76 ansible-playbook assert_filter.yaml
  78. 77 vim assert_filter.yaml
  79. 78 ansible-playbook assert_filter.yaml
  80. 79 vim password_hash.yaml
  81. 80 ansible-playbook password_hash.yaml
  82. 81 history
  83. 82 sudo poweroff
  84. 83 cd ansiblein3weeks/
  85. 84 ./countdown 1
  86. 85 podman images
  87. 86 cd ansiblein3weeks/
  88. 87 ls
  89. 88 ansible-navigator
  90. 89 ansible-navigator images
  91. 90 ansible-navigator --help
  92. 91 ansible-navigator run basics/install_and_start_httpt.yaml
  93. 92 ls
  94. 93 cd ..
  95. 94 ls
  96. 95 cd ansiblein3weeks/
  97. 96 cd /usr/share/doc/rhel-system-roles/selinux/
  98. 97 ls
  99. 98 vim example-selinux-playbook.yml
  100. 99 cd
  101. 100 cd ansiblein3weeks/includes/
  102. 101 ls
  103. 102 vim install-and-setup.yml
  104. 103 vim includes.yml
  105. 104 ls
  106. 105 cd lab/
  107. 106 s
  108. 107 ls
  109. 108 vim lab-playbook.yml
  110. 109 vim lab-tasks/file.yml
  111. 110 cd ..
  112. 111 ansible --version
  113. 112 ls
  114. 113 cd collections/
  115. 114 ls
  116. 115 vimn enforce-selinux-simplified.yml
  117. 116 vim enforce-selinux-simplified.yml
  118. 117 ansible-doc -l | less
  119. 118 ansible-galaxy collection list
  120. 119 history
  121. 120 su - student
  122. 121 ls
  123. 122 history
  124. 123 cd ansiblein3weeks/
  125. 124 ls
  126. 125 cd plugins/
  127. 126 ls
  128. 127 vim readkeys.yaml
  129. 128 ls ansible
  130. 129 ls student/
  131. 130 vim readkeys.yaml
  132. 131 ansible-playbook readkeys.yaml
  133. 132 vim inventory
  134. 133 ansible-playbook readkeys.yaml
  135. 134 ansible-playbook readkeys.yaml -K
  136. 135 ansible ansible2 -a "ls /root"
  137. 136 ansible-doc -t lookup -l
  138. 137 ansible-doc -t lookup url
  139. 138 vim hello.yml
  140. 139 ls
  141. 140 find ../.. -name "mytemplate.j2"
  142. 141 vim hello.yml
  143. 142 cp ../templates/mytemplate.j2 .
  144. 143 ansible-playbook hello.yml
  145. 144 ansible-playbook hello.yml -K
  146. 145 cat mytemplate.j2
  147. 146 ansible-doc -t callback -l
  148. 147 vim ansible.cfg
  149. 148 ansible-doc -t callback log_plays
  150. 149 vim ansible.cfg
  151. 150 ansible-doc -t callback log_plays
  152. 151 ansible-doc -t callback cgroup_perf_recap
  153. 152 vim ansible.cfg
  154. 153 ls
  155. 154 cat hello.yml
  156. 155 ansible-playbook hello.yml
  157. 156 ansible-playbook hello.yml -K
  158. 157 vim ansible.cfg
  159. 158 ansible-playbook hello.yml -K
  160. 159 sudo vim /etc/ansible/ansible.cfg
  161. 160 ls
  162. 161 cd ansible/
  163. 162 ansible-config init --disabled > ansible.cfg
  164. 163 vim ansible.cfg
  165. 164 cd ..
  166. 165 cd ../windows/
  167. 166 ls
  168. 167 vim inventory
  169. 168 ansible-inventory --yaml -i inventory --list --output winventory.yaml
  170. 169 vim winventory.yaml
  171. 170 vim inventory
  172. 171 ansible-inventory --yaml -i inventory --list --output winventory.yaml
  173. 172 vim winventory.yaml
  174. 173 ansible-doc -l -t inventory
  175. 174 sudo dnf install -y redis
  176. 175 sudo systemctl enable --now redis
  177. 176 sudo pip3 install redis
  178. 177 cd ../plugins/
  179. 178 ls
  180. 179 cd ..
  181. 180 grep -R 6379 *
  182. 181 cd factcache/
  183. 182 ls
  184. 183 vim ansible.cfg
  185. 184 ansible all -m setup
  186. 185 vim inventory
  187. 186 ansible all -m setup
  188. 187 ansible ansible1 -m setup -K
  189. 188 ls
  190. 189 cat checkcache.py
  191. 190 vim checkcache.py
  192. 191 ./checkcache.py
  193. 192 vim checkcache.py
  194. 193 ./checkcache.py
  195. 194 vim checkfacts.yaml
  196. 195 ansible-playbook checkfacts.yaml
  197. 196 ls
  198. 197 cat setupfactcache.yaml
  199. 198 cat changeconfig.yaml
  200. 199 vim changeconfig.yaml
  201. 200 ansible-playbook changeconfig.yaml
  202. 201 ansible-playbook changeconfig.yaml -K
  203. 202 vim changeconfig.yaml
  204. 203 ansible-playbook changeconfig.yaml -K
  205. 204 cd ..
  206. 205 vim ansible.cfg
  207. 206 cd -
  208. 207 vim changeconfig.yaml
  209. 208 history
  210. 209 cd ../windows/
  211. 210 sudo vim /etc/hosts
  212. 211 pwd
  213. 212 vim inventory
  214. 213 vim ansible.cfg
  215. 214 sudo pip3 install pywinrm
  216. 215 echo $PYTHONPATH
  217. 216 export PYTHONPATH=/usr/lib/python3.9/site-packages:/usr/lib64/python3.9/site-packages:/usr/local/bin
  218. 217 vim ~/.bashrc
  219. 218 ansible-doc -l | grep win
  220. 219 ansible-galaxy collections install ansible.windows
  221. 220 ansible-galaxy collection install ansible.windows
  222. 221 ansible-galaxy collection install community.windows
  223. 222 ansible-doc -l | grep win
  224. 223 ansible win -i inventory -m win_ping
  225. 224 vim inventory
  226. 225 vim ansible.cfg
  227. 226 vim inventory
  228. 227 ansible win -i inventory -m win_ping
  229. 228 vim inventory
  230. 229 ansible win -i inventory -m win_ping
  231. 230 vim inventory
  232. 231 vim ansible.cfg
  233. 232 vim inventory
  234. 233 ansible win -i inventory -m win_ping
  235. 234 vim playbook.yml
  236. 235 ansible-playbook playbook.yml
  237. 236 ls
  238. 237 vim wiebenik.yaml
  239. 238 ansible-playbook wiebenik
  240. 239 ansible-playbook wiebenik.yaml
  241. 240 vim createad.yml
  242. 241 ansible-playbook createad.yml
  243. 242 cd ..
  244. 243 ansible-doc -l | grep docker
  245. 244 ansible-galaxy collection install ansible.docker
  246. 245 ansible-galaxy collection install community.docker
  247. 246 ansible-doc -l | grep docker
  248. 247 cd docker/
  249. 248 ls
  250. 249 less readme.txt
  251. 250 vim newdocker.yaml
  252. 251 ansible-playbook newdocker.yaml
  253. 252 sudo vim /etc/hosts
  254. 253 ansible-playbook newdocker.yaml
  255. 254 ansible-playbook -vvv newdocker.yaml
  256. 255 ls
  257. 256 vim podman.yaml
  258. 257 ansible-galaxy collection install containers.podman
  259. 258 ls ~/Downloads/
  260. 259 ansible-galaxy collection list
  261. 260 cd ~/.ansible/collections/ansible_collections/
  262. 261 tar -xvf ~/Downloads/containers-podman-1.10.3.tar.gz .
  263. 262 tar -xvf ~/Downloads/containers-podman-1.10.3.tar.gz
  264. 263 ls
  265. 264 mkdir containers.podman
  266. 265 tar -xvf ~/Downloads/containers-podman-1.10.3.tar.gz -C containers.podman/
  267. 266 ansible-galaxy collection list
  268. 267 cd
  269. 268 cd ansiblein3weeks/docker/
  270. 269 ls
  271. 270 vim podman.yaml
  272. 271 ansible-playbook podman.yaml
  273. 272 vim podman.yaml
  274. 273 ansible-playbook podman.yaml
  275. 274 ansible-doc -l | grep podman
  276. 275 cd ~/.ansible/collections/ansible_collections/
  277. 276 ls
  278. 277 ls ansible
  279. 278 ls containers.podman/
  280. 279 ansible-galaxy collection install containers.podman
  281. 280 ansible-doc -l | grep podman
  282. 281 ls
  283. 282 rm -f *
  284. 283 ls
  285. 284 rm -rf docs meta plugins tests changelogs
  286. 285 ansible-doc -l | grep podman
  287. 286 cd -
  288. 287 ls
  289. 288 ansible-playbook podman.yaml
  290. 289 vim inventory
  291. 290 ansible-playbook podman.yaml
  292. 291 ansible-playbook podman.yaml -K
  293. 292 ansible ansible2 -a "podman ps"
  294. 293 curl ansible2:4444
  295. 294 ssh ansible@192.168.52.137
  296. 295 ssh ansible@192.168.52.136
  297. 296 cd ../
  298. 297 ls
  299. 298 cd esxi/
  300. 299 ls
  301. 300 vim setup-esxi.yaml
  302. 301 sudo pip3 install boto boto3
  303. 302 cd ..
  304. 303 cd ec2/
  305. 304 ls
  306. 305 mkdir -p group_vars/all
  307. 306 ansible-vault create group_vars/all/keys.yml
  308. 307 ansible-vault view group_vars/all/keys.yml
  309. 308 exit
  310. 309 cd ansiblein3weeks/
  311. 310 ./countdown 13
  312. 311 ./countdown 1
  313. 312 ./countdown 18
  314. 313 exit
  315. 314 cd ansiblein3weeks/
  316. 315 cd ec2/
  317. 316 ls
  318. 317 vim list-instances.yml
  319. 318 ansible-playbook --aks-vault-pass list-instances.yml
  320. 319 ansible-playbook --ask-vault-pass list-instances.yml
  321. 320 vim list-instances-new.yml
  322. 321 ansible-galaxy collection install community.aws
  323. 322 ansible-doc -l | grep aws
  324. 323 ansible-doc -l | wc -l
  325. 324 ansible-playbook --ask-vault-pass list-instances.yml
  326. 325 vim ubuntu-new.yaml
  327. 326 ansible-vault edit group_vars/all/keys.yml
  328. 327 ansible-playbook --ask-vault-pass list-instances.yml
  329. 328 vim list-instances.yml
  330. 329 ansible-playbook --ask-vault-pass ubuntu-new.yaml
  331. 330 ansible-playbook --ask-vault-pass ubuntu.yaml
  332. 331 ls
  333. 332 vim ubuntu-new.yaml
  334. 333 ansible-doc -l | grep aws | less
  335. 334 vim ubuntu-new.yaml
  336. 335 ansible-playbook --ask-vault-pass ubuntu.yaml
  337. 336 ansible-playbook --ask-vault-pass ubuntu-new.yaml
  338. 337 vim ubuntu-new.yaml
  339. 338 ansible-playbook --ask-vault-pass ubuntu-new.yaml
  340. 339 ansible-doc ec2_instance
  341. 340 vim ubuntu-new.yaml
  342. 341 ansible-playbook --ask-vault-pass ubuntu-new.yaml
  343. 342 vim ubuntu-new.yaml
  344. 343 vim list-instances.yml
  345. 344 ansible-playbook list-instances.yml
  346. 345 ansible-playbook list-instances.yml --ask-vault-password
  347. 346 cd
  348. 347 sudo vim /etc/hosts
  349. 348 cd ansiblein3weeks/kubernetes/
  350. 349 ls
  351. 350 ls -l
  352. 351 vim README.txt
  353. 352 ansible-galaxy role install geerlingguy.containerd
  354. 353 ls
  355. 354 vim kube-cluster-setup.yaml
  356. 355 ansible-galaxy collection install kubernetes.core
  357. 356 ansible-doc | grep k8s
  358. 357 ansible-doc -l | grep k8s
  359. 358 ansible-doc k8s
  360. 359 vim kube-cluster-setup.yaml
  361. 360 ansible-playbook kube-cluster-setup.yaml
  362. 361 ansible-playbook kube-cluster-setup.yaml -e kubehost=kubuntu
  363. 362 ansible-playbook kube-cluster-setup.yaml -e kubehost=kubuntu -K
  364. 363 vim inventory
  365. 364 ansible-playbook kube-cluster-setup.yaml -e kubehost=kubuntu -K
  366. 365 vim kube-cluster-setup.yaml
  367. 366 ansible-playbook kube-cluster-setup.yaml -e kubehost=kubuntu -K
  368. 367 vim inventory
  369. 368 ansible-playbook kube-cluster-setup.yaml -e kubehost=kubuntu -K -b -k -i inventory
  370. 369 cp ../ansible.cfg .
  371. 370 vim ansible.cfg
  372. 371 ansible-playbook kube-cluster-setup.yaml -e kubehost=kubuntu -K
  373. 372 ssh kubuntu
  374. 373 ansible-playbook kube-cluster-setup.yaml -e kubehost=kubuntu -K
  375. 374 ansible-playbook kube-cluster-setup.yaml -e kubehost=kubuntu -K -k
  376. 375 kubectl get all
  377. 376 kubectl get pods -n kube-system
  378. 377 ansible-playbook kube-cluster-setup.yaml -e kubehost=kubuntu -K -k
  379. 378 ls
  380. 379 vim kube-cluster-setup.yaml
  381. 380 ansible-playbook --tags=finishing kube-cluster-setup.yaml -k -K
  382. 381 vim kube-cluster-setup.yaml
  383. 382 ansible-playbook --tags=finishing kube-cluster-setup.yaml -k -K
  384. 383 history
  385.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement