sandervanvugt

ans3W dec21

Dec 10th, 2021
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.82 KB | None | 0 0
  1. [ansible@control ansibleinthreeweeks]$ history
  2. 1 ip a
  3. 2 sudo vi /etc/hosts
  4. 3 cat /etc/hosts
  5. 4 sudo dnf install epel -y
  6. 5 sudo dnf install epel-release -y
  7. 6 sudo dnf install -y ansible
  8. 7 vim inventory
  9. 8 ping rocky
  10. 9 ping ubuntu
  11. 10 sudo vi /etc/hosts
  12. 11 ping ubuntu
  13. 12 ansible --version
  14. 13 sudo dnf install git -y
  15. 14 git clone https://github.com/sandervanvugt/ansibleinthreeweeks
  16. 15 cd ansibleinthreeweeks/
  17. 16 ls
  18. 17 git pull
  19. 18 ./countdown 12
  20. 19 sudo sh -c "echo password | passwd --stdin ansible"
  21. 20 echo ansible ALL=(ALL) NOPASSWD: ALL >/tmp/sudoers
  22. 21 echo "ansible ALL=(ALL) NOPASSWD: ALL" >/tmp/sudoers
  23. 22 cd ..
  24. 23 cat inventory
  25. 24 ansible rocky -i inventory -u root -k -m raw -a "useradd -G wheel ansible"
  26. 25 ssh root@rocky
  27. 26 ansible rocky -i inventory -u root -k -m raw -a "useradd -G wheel ansible"
  28. 27 ansible rocky -i inventory -u root -k -m command -a "id"
  29. 28 ansible rocky -i inventory -u root -k -m command -a "id ansible"
  30. 29 history
  31. 30 ansible rocky -i inventory -u root -k -m shell -a "echo password | passwd --stdin ansible"
  32. 31 ssh ansible@rocky
  33. 32 ansible rocky -i inventory -u root -k -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  34. 33 ansible rocky -u ansible -k -i inventory -m command -a "ls -l /root"
  35. 34 ansible rocky -u ansible -k -i inventory -b -m command -a "ls -l /root"
  36. 35 ssh-keygen
  37. 36 ssh-copy-id rocky
  38. 37 ansible rocky -u ansible -i inventory -b -m command -a "ls -l /root"
  39. 38 history
  40. 39 #ansible ubuntu -i inventory -u student -k -b -K -m command -a "useradd -G sudo ansible"
  41. 40 ssh student@ubuntu
  42. 41 #ansible ubuntu -i inventory -u student -k -b -K -m command -a "useradd -m -G sudo ansible"
  43. 42 ansible ubuntu -i inventory -u student -k -b -K -m command -a "useradd -m -G sudo ansible"
  44. 43 ansible ubuntu -i inventory -u ansible -k -b -K -m command -a "ls /root"
  45. 44 ansible ubuntu -i inventory -u student -k -b -K -m shell -a "echo ansible:password | chpasswd"
  46. 45 ansible ubuntu -i inventory -u ansible -k -b -K -m command -a "ls /root"
  47. 46 ansible ubuntu -i inventory -u ansible -k -b -K -m command -a "ls -a /root"
  48. 47 ssh-copy-id ubuntu
  49. 48 ansible ubuntu -i inventory -u ansible -b -K -m command -a "ls -a /root"
  50. 49 ansible ubuntu -i inventory -u ansible -b -K -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  51. 50 ansible ubuntu -i inventory -u ansible -m command -a "ls -a /root"
  52. 51 ansible ubuntu -i inventory -u ansible -b -m command -a "ls -a /root"
  53. 52 history
  54. 53 cd ansibleinthreeweeks/
  55. 54 ls
  56. 55 cd basics/
  57. 56 ls
  58. 57 cd ..
  59. 58 vim ansible.cfg
  60. 59 vim inventory
  61. 60 ansible all -m command -a "ls -a /root"
  62. 61 ansible-doc -l | wc
  63. 62 ansible-doc -l
  64. 63 ansible all -m ping
  65. 64 ansible all -m user -a "name=lisa"
  66. 65 ansible all -m command -a "useradd lisa"
  67. 66 ansible all -m command -a "id lisa"
  68. 67 ansible all -m user -a "name=lisa state=absent"
  69. 68 ansible all -m command -a "id lisa"
  70. 69 ansible-doc user
  71. 70 ansible rocky -m command -a "rpm -qa | grep python"
  72. 71 ansible rocky -m shell -a "rpm -qa | grep python"
  73. 72 ansible all -m copy -a 'content="hello world" dest=/tmp/testfile'
  74. 73 ansible all -a "cat /tmp/testfile"
  75. 74 ansible all -m package -a "name=nmap state=latest"
  76. 75 ansible all -m service -a "name=httpd state=started enabled=yes"
  77. 76 history
  78. 77 cat ansible.cfg
  79. 78 ls
  80. 79 cd basics/
  81. 80 ls
  82. 81 cp ../ansible.cfg .
  83. 82 cp ../inventory .
  84. 83 ls
  85. 84 vim install_and_start_httpt.yaml
  86. 85 ansible-playbook install_and_start_httpt.yaml
  87. 86 vim install_and_start_httpt.yaml
  88. 87 ../countdown 18
  89. 88 vim install_and_start_httpt.yaml
  90. 89 ansible-playbook install_and_start_httpt.yaml
  91. 90 ansible-playbook install_and_start_httpt.yaml -vvvv
  92. 91 ls
  93. 92 vim run_and_test_httpd.yaml
  94. 93 ansible-playbook run_and_test_httpd.yaml
  95. 94 ansible-doc -l | grep ufw
  96. 95 cat ansible.cfg
  97. 96 vim run_and_test_httpd.yaml
  98. 97 ansible-playbook run_and_test_httpd.yaml
  99. 98 vim variables_example.yaml
  100. 99 ansible-playbook variables_example.yaml
  101. 100 ansible-playbook variables_example.yaml -e user=anna
  102. 101 ansible ubuntu -m setup > ubuntu_facts.txt
  103. 102 less ubuntu_facts.txt
  104. 103 vim gather_facts.yaml
  105. 104 ansible-playbook gather_facts.yaml
  106. 105 vim old_facts.yaml
  107. 106 vim new_facts.yaml
  108. 107 ansible-playbook new_facts.yaml
  109. 108 vim new_facts.yaml
  110. 109 ansible-playbook new_facts.yaml
  111. 110 ls
  112. 111 cat new_facts.yaml
  113. 112 vim myvars.yaml
  114. 113 vim vars_file.yaml
  115. 114 ansible-playbook myvars.yaml
  116. 115 vim vars_file.yaml
  117. 116 vim myvars.yaml
  118. 117 ansible-playbook myvars.yaml
  119. 118 cat myvars.yaml
  120. 119 cat vars_file.yaml
  121. 120 mv myvars.yaml myvars
  122. 121 vimn vars_file.yaml
  123. 122 vim vars_file.yaml
  124. 123 ansible-playbook myvars.yaml
  125. 124 ansible-playbook vars_file.yaml
  126. 125 ip a
  127. 126 cat /etc/hosts
  128. 127 history
  129. 128 ansible all -a "poweroff"
  130. 129 sudo poweroff
  131. 130 cd ansibleinthreeweeks/
  132. 131 ./countdown 13
  133. 132 history
  134. 133 history | grep git
  135. 134 ls
  136. 135 cd ansibleinthreeweeks/
  137. 136 ls
  138. 137 cd basics/
  139. 138 ls
  140. 139 ip a
  141. 140 sudo poweroff
  142. 141 history
  143. 142 cd ansibleinthreeweeks/
  144. 143 ls
  145. 144 ansible localhost -m debug -a 'var=hostvars["localhost"]'
  146. 145 find . -name "register.yaml"
  147. 146 vim register.yaml
  148. 147 ansible-playbook register.yaml
  149. 148 vim register.yaml
  150. 149 ls
  151. 150 vim secret.yml
  152. 151 rm secret.yml
  153. 152 ansible-vault --help
  154. 153 ansible-vault create secret.yml
  155. 154 vim create-user.yml
  156. 155 ansible-playbook create-user.yml
  157. 156 ansible-playbook --ask-vault-pass create-user.yml
  158. 157 ansible all -a "tail /etc/shadow"
  159. 158 echo password > vault-pass
  160. 159 ansible-playbook --vault-password-file=vault-pass create-users.yml
  161. 160 ansible-playbook --vault-password-file=vault-pass create-user.yml
  162. 161 sudo dnf install -y redis
  163. 162 sudo systemctl enable --now redis
  164. 163 sudo systemctl status redis
  165. 164 sudo pip3 install redis
  166. 165 ls
  167. 166 git pull
  168. 167 ls
  169. 168 cd ..
  170. 169 ls
  171. 170 mv ansibleinthreeweeks ansibleinthreeweeks.old
  172. 171 git clone https://github.com/sandervanvugt/ansibleinthreeweeks
  173. 172 cd ansibleinthreeweeks
  174. 173 ls
  175. 174 cd factcache/
  176. 175 ls
  177. 176 vim ansible.cfg
  178. 177 vim checkcache.py
  179. 178 ./checkcache.py
  180. 179 ansible all -m setup
  181. 180 vim inventory
  182. 181 ansible all -m setup
  183. 182 ./checkcache.py
  184. 183 vim checkfacts.yaml
  185. 184 ansible-playbook checkfacts.yaml
  186. 185 sudo crontab -e
  187. 186 crontab -e
  188. 187 cd ..
  189. 188 ls
  190. 189 cd templates/
  191. 190 ls
  192. 191 cp ../factcache/ansible.cfg .
  193. 192 cp ../factcache/inventory .
  194. 193 vim vsftpd.j2
  195. 194 vim vsftpd-template.yml
  196. 195 ansible-playbook vsftpd-template.yml
  197. 196 ansible rocky -a "cat /etc/vsftpd/vsftpd.conf"
  198. 197 vim vsftpd-template.yml
  199. 198 cd ..
  200. 199 ls
  201. 200 cd task_control/
  202. 201 ls
  203. 202 vim handlers.yml
  204. 203 ansible-playbook handlers.yml
  205. 204 ls
  206. 205 cp ../factcache/ansible.cfg .
  207. 206 cp ../factcache/inventory .
  208. 207 vim handlers.yml
  209. 208 ansible-playbook handlers.yml
  210. 209 touch /tmp/index.html
  211. 210 ansible-playbook handlers.yml
  212. 211 vim handlers.yml
  213. 212 ansible-playbook handlers.yml
  214. 213 ansible rocky -m file -a "name=/var/www/html/index.html state=absent"
  215. 214 ansible-playbook handlers.yml
  216. 215 cd ..
  217. 216 ls
  218. 217 ./countdown 12
  219. 218 ls
  220. 219 cd task_control/
  221. 220 ls
  222. 221 vim loopservices.yml
  223. 222 rpm -qf $(which crond)
  224. 223 rpm -qf $(which sshd)
  225. 224 vim loopservices.yml
  226. 225 ansible-playbook loopservices.yml
  227. 226 vim loopservices.yml
  228. 227 ansible-doc service
  229. 228 ansible-doc yum
  230. 229 ansible-doc package
  231. 230 ls
  232. 231 vim ifsize.yml
  233. 232 vim when_multiple.yml
  234. 233 sudo vim /etc/hosts
  235. 234 vim inventory
  236. 235 vim ../factcache/inventory
  237. 236 vim when_multiple.yml
  238. 237 ansible-playbook when_multiple.yml
  239. 238 ansible all -m setup
  240. 239 ssh-copy-id ansible@tower
  241. 240 ansible all -m setup
  242. 241 ansible tower -m setup
  243. 242 ansible-playbook when_multiple.yml
  244. 243 vim when_multiple.yml
  245. 244 ls
  246. 245 vim ifsize.yml
  247. 246 ansible-playbook ifsize.yml
  248. 247 cd ..
  249. 248 ls
  250. 249 ansible --version
  251. 250 ansible-galaxy install geerlingguy.nginx
  252. 251 cd
  253. 252 cd .ansible/roles/geerlingguy.nginx/
  254. 253 ls
  255. 254 cd tasks/
  256. 255 ls
  257. 256 vim main.yml
  258. 257 cd
  259. 258 cd ansibleinthreeweeks
  260. 259 ls
  261. 260 cd roles/
  262. 261 ls
  263. 262 vim nginx-role.yml
  264. 263 cp ../factcache/inventory .
  265. 264 cp ../factcache/ansible.cfg .
  266. 265 ansible-playbook nginx-role.yml
  267. 266 ls
  268. 267 vim pretasks.yml
  269. 268 vim ../../.ansible/roles/geerlingguy.nginx/tasks/main.yml
  270. 269 ansible ubuntu -m setup -a "filter=ansible_os_family"
  271. 270 pwd
  272. 271 ../countdown 12
  273. 272 ansible-galaxy --help
  274. 273 ansible-galaxy collection -l
  275. 274 ansible-galaxy collection
  276. 275 ansible-galaxy collection list
  277. 276 ansible-doc -l
  278. 277 ansible-doc --help
  279. 278 cd
  280. 279 cd ansibleinthreeweeks
  281. 280 git pull
  282. 281 vim listing731.yaml
  283. 282 vim inventory
  284. 283 cp factcache/ansible.cfg .
  285. 284 vim listing731.yaml
  286. 285 ansible-playbook listing731.yaml
  287. 286 sudo vim /etc/ansible/ansible.cfg
  288. 287 ./countdown 18
  289. 288 ls
  290. 289 cd filters/
  291. 290 ls
  292. 291 vim int-filter.yaml
  293. 292 cp int-filter.yaml int-filter-wring.yaml
  294. 293 vim int-filter-wring.yaml
  295. 294 ansible-playbook int-filter-wring.yaml
  296. 295 ls
  297. 296 vim int-filter.yaml
  298. 297 ansible-playbook int-filter.yaml
  299. 298 vim ansible.cfg
  300. 299 vim int-filter.yaml
  301. 300 sudo ls /
  302. 301 ansible-playbook int-filter.yaml -K
  303. 302 cp ../factcache/ansible.cfg .
  304. 303 cp ../factcache/inventory .
  305. 304 vim storage-filter.yaml
  306. 305 ansible-playbook storage-filter.yaml
  307. 306 vim storage-filter.yaml
  308. 307 ansible all -m setup
  309. 308 ansible-playbook storage-filter.yaml
  310. 309 ansible-playbook storage-filter.yaml --flush-cache
  311. 310 ssh root@tower
  312. 311 ansible-playbook storage-filter.yaml
  313. 312 ansible-playbook storage-filter.yaml --flush-cache
  314. 313 ansible all -m setup
  315. 314 ansible-playbook storage-filter.yaml --flush-cache
  316. 315 vim ansible.cfg
  317. 316 vim storage-filter.yaml
  318. 317 ansible-playbook storage-filter.yaml
  319. 318 vim storage-filter.yaml
  320. 319 vim ansible.cfg
  321. 320 ansible all -m setup
  322. 321 ansible-playbook storage-filter.yaml
  323. 322 vim assert_filter.yaml
  324. 323 ansible-playbook assert_filter.yaml
  325. 324 vim assert_filter.yaml
  326. 325 ansible-playbook assert_filter.yaml
  327. 326 vim assert_filter.yaml
  328. 327 ansible-playbook assert_filter.yaml
  329. 328 ls
  330. 329 vim password_hash.yaml
  331. 330 ansible-playbook password_hash.yaml
  332. 331 ../countdown 12
  333. 332 ls
  334. 333 cd ..
  335. 334 find . -name "readkeys.*"
  336. 335 cd plugins/
  337. 336 vim readkeys.yaml
  338. 337 ansible doc -t lookup -l
  339. 338 ansible-doc -t lookup -l
  340. 339 ls
  341. 340 vim hello.yml
  342. 341 ansible-doc -t callback -l
  343. 342 ls
  344. 343 vim ansible.cfg
  345. 344 ansible-playbook hello.yml
  346. 345 vim hello.yml
  347. 346 find ../ -name "mytempl*"
  348. 347 cp ../templates/mytemplate.j2 .
  349. 348 ansible-playbook hello.yml -K
  350. 349 sudo vim /etc/ansible/ansible.cfg
  351. 350 cd ..
  352. 351 cat windows/inventory
  353. 352 ansible-inventory --yaml -i windows/inventory --list --output winventroy.yaml
  354. 353 ls
  355. 354 vim winventroy.yaml
  356. 355 ansible-doc -t inventory -l
  357. 356 ansible-doc -t inventory nmap
  358. 357 ansible-doc -t inventory -l
  359. 358 history
Advertisement
Add Comment
Please, Sign In to add comment