sandervanvugt

ansible3 weeks dec21 ALL

Dec 17th, 2021
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.69 KB | None | 0 0
  1. sible_ec2_instance_info_payload.zip/ansible/modules/cloud/amazon/ec2_instance_info.py\", line 514, in list_ec2_instances\nAttributeError: 'ClientError' object has no attribute 'message'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
  2.  
  3. PLAY RECAP *********************************************************************************************
  4. localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
  5.  
  6. [ansible@control ec2]$ ls
  7. add-instance.yml ec2.ini group_vars list-instances-new.yml myfile ubuntu-new.yaml
  8. ec2-deploy.yml ec2.py inventory list-instances.yml ubuntu-ami.yaml
  9. [ansible@control ec2]$ ansible-playbook --ask-vault-pass ubuntu-new.yaml
  10. Vault password:
  11. [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost
  12. does not match 'all'
  13. /usr/lib/python3.6/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.26.7) or chardet (3.0.4) doesn't match a supported version!
  14. RequestsDependencyWarning)
  15.  
  16. PLAY [create an ubuntu instance on EC2] ****************************************************************
  17.  
  18. TASK [Gathering Facts] *********************************************************************************
  19. ok: [localhost]
  20.  
  21. TASK [start the instance] ******************************************************************************
  22. fatal: [localhost]: FAILED! => {"changed": false, "msg": "Instance creation failed => AuthFailure: AWS was not able to validate the provided access credentials"}
  23.  
  24. PLAY RECAP *********************************************************************************************
  25. localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
  26.  
  27. [ansible@control ec2]$ history
  28. 1 ip a
  29. 2 sudo vi /etc/hosts
  30. 3 cat /etc/hosts
  31. 4 sudo dnf install epel -y
  32. 5 sudo dnf install epel-release -y
  33. 6 sudo dnf install -y ansible
  34. 7 vim inventory
  35. 8 ping rocky
  36. 9 ping ubuntu
  37. 10 sudo vi /etc/hosts
  38. 11 ping ubuntu
  39. 12 ansible --version
  40. 13 sudo dnf install git -y
  41. 14 git clone https://github.com/sandervanvugt/ansibleinthreeweeks
  42. 15 cd ansibleinthreeweeks/
  43. 16 ls
  44. 17 git pull
  45. 18 ./countdown 12
  46. 19 sudo sh -c "echo password | passwd --stdin ansible"
  47. 20 echo ansible ALL=(ALL) NOPASSWD: ALL >/tmp/sudoers
  48. 21 echo "ansible ALL=(ALL) NOPASSWD: ALL" >/tmp/sudoers
  49. 22 cd ..
  50. 23 cat inventory
  51. 24 ansible rocky -i inventory -u root -k -m raw -a "useradd -G wheel ansible"
  52. 25 ssh root@rocky
  53. 26 ansible rocky -i inventory -u root -k -m raw -a "useradd -G wheel ansible"
  54. 27 ansible rocky -i inventory -u root -k -m command -a "id"
  55. 28 ansible rocky -i inventory -u root -k -m command -a "id ansible"
  56. 29 history
  57. 30 ansible rocky -i inventory -u root -k -m shell -a "echo password | passwd --stdin ansible"
  58. 31 ssh ansible@rocky
  59. 32 ansible rocky -i inventory -u root -k -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  60. 33 ansible rocky -u ansible -k -i inventory -m command -a "ls -l /root"
  61. 34 ansible rocky -u ansible -k -i inventory -b -m command -a "ls -l /root"
  62. 35 ssh-keygen
  63. 36 ssh-copy-id rocky
  64. 37 ansible rocky -u ansible -i inventory -b -m command -a "ls -l /root"
  65. 38 history
  66. 39 #ansible ubuntu -i inventory -u student -k -b -K -m command -a "useradd -G sudo ansible"
  67. 40 ssh student@ubuntu
  68. 41 #ansible ubuntu -i inventory -u student -k -b -K -m command -a "useradd -m -G sudo ansible"
  69. 42 ansible ubuntu -i inventory -u student -k -b -K -m command -a "useradd -m -G sudo ansible"
  70. 43 ansible ubuntu -i inventory -u ansible -k -b -K -m command -a "ls /root"
  71. 44 ansible ubuntu -i inventory -u student -k -b -K -m shell -a "echo ansible:password | chpasswd"
  72. 45 ansible ubuntu -i inventory -u ansible -k -b -K -m command -a "ls /root"
  73. 46 ansible ubuntu -i inventory -u ansible -k -b -K -m command -a "ls -a /root"
  74. 47 ssh-copy-id ubuntu
  75. 48 ansible ubuntu -i inventory -u ansible -b -K -m command -a "ls -a /root"
  76. 49 ansible ubuntu -i inventory -u ansible -b -K -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  77. 50 ansible ubuntu -i inventory -u ansible -m command -a "ls -a /root"
  78. 51 ansible ubuntu -i inventory -u ansible -b -m command -a "ls -a /root"
  79. 52 history
  80. 53 cd ansibleinthreeweeks/
  81. 54 ls
  82. 55 cd basics/
  83. 56 ls
  84. 57 cd ..
  85. 58 vim ansible.cfg
  86. 59 vim inventory
  87. 60 ansible all -m command -a "ls -a /root"
  88. 61 ansible-doc -l | wc
  89. 62 ansible-doc -l
  90. 63 ansible all -m ping
  91. 64 ansible all -m user -a "name=lisa"
  92. 65 ansible all -m command -a "useradd lisa"
  93. 66 ansible all -m command -a "id lisa"
  94. 67 ansible all -m user -a "name=lisa state=absent"
  95. 68 ansible all -m command -a "id lisa"
  96. 69 ansible-doc user
  97. 70 ansible rocky -m command -a "rpm -qa | grep python"
  98. 71 ansible rocky -m shell -a "rpm -qa | grep python"
  99. 72 ansible all -m copy -a 'content="hello world" dest=/tmp/testfile'
  100. 73 ansible all -a "cat /tmp/testfile"
  101. 74 ansible all -m package -a "name=nmap state=latest"
  102. 75 ansible all -m service -a "name=httpd state=started enabled=yes"
  103. 76 history
  104. 77 cat ansible.cfg
  105. 78 ls
  106. 79 cd basics/
  107. 80 ls
  108. 81 cp ../ansible.cfg .
  109. 82 cp ../inventory .
  110. 83 ls
  111. 84 vim install_and_start_httpt.yaml
  112. 85 ansible-playbook install_and_start_httpt.yaml
  113. 86 vim install_and_start_httpt.yaml
  114. 87 ../countdown 18
  115. 88 vim install_and_start_httpt.yaml
  116. 89 ansible-playbook install_and_start_httpt.yaml
  117. 90 ansible-playbook install_and_start_httpt.yaml -vvvv
  118. 91 ls
  119. 92 vim run_and_test_httpd.yaml
  120. 93 ansible-playbook run_and_test_httpd.yaml
  121. 94 ansible-doc -l | grep ufw
  122. 95 cat ansible.cfg
  123. 96 vim run_and_test_httpd.yaml
  124. 97 ansible-playbook run_and_test_httpd.yaml
  125. 98 vim variables_example.yaml
  126. 99 ansible-playbook variables_example.yaml
  127. 100 ansible-playbook variables_example.yaml -e user=anna
  128. 101 ansible ubuntu -m setup > ubuntu_facts.txt
  129. 102 less ubuntu_facts.txt
  130. 103 vim gather_facts.yaml
  131. 104 ansible-playbook gather_facts.yaml
  132. 105 vim old_facts.yaml
  133. 106 vim new_facts.yaml
  134. 107 ansible-playbook new_facts.yaml
  135. 108 vim new_facts.yaml
  136. 109 ansible-playbook new_facts.yaml
  137. 110 ls
  138. 111 cat new_facts.yaml
  139. 112 vim myvars.yaml
  140. 113 vim vars_file.yaml
  141. 114 ansible-playbook myvars.yaml
  142. 115 vim vars_file.yaml
  143. 116 vim myvars.yaml
  144. 117 ansible-playbook myvars.yaml
  145. 118 cat myvars.yaml
  146. 119 cat vars_file.yaml
  147. 120 mv myvars.yaml myvars
  148. 121 vimn vars_file.yaml
  149. 122 vim vars_file.yaml
  150. 123 ansible-playbook myvars.yaml
  151. 124 ansible-playbook vars_file.yaml
  152. 125 ip a
  153. 126 cat /etc/hosts
  154. 127 history
  155. 128 ansible all -a "poweroff"
  156. 129 sudo poweroff
  157. 130 cd ansibleinthreeweeks/
  158. 131 ./countdown 13
  159. 132 history
  160. 133 history | grep git
  161. 134 ls
  162. 135 cd ansibleinthreeweeks/
  163. 136 ls
  164. 137 cd basics/
  165. 138 ls
  166. 139 ip a
  167. 140 sudo poweroff
  168. 141 history
  169. 142 cd ansibleinthreeweeks/
  170. 143 ls
  171. 144 ansible localhost -m debug -a 'var=hostvars["localhost"]'
  172. 145 find . -name "register.yaml"
  173. 146 vim register.yaml
  174. 147 ansible-playbook register.yaml
  175. 148 vim register.yaml
  176. 149 ls
  177. 150 vim secret.yml
  178. 151 rm secret.yml
  179. 152 ansible-vault --help
  180. 153 ansible-vault create secret.yml
  181. 154 vim create-user.yml
  182. 155 ansible-playbook create-user.yml
  183. 156 ansible-playbook --ask-vault-pass create-user.yml
  184. 157 ansible all -a "tail /etc/shadow"
  185. 158 echo password > vault-pass
  186. 159 ansible-playbook --vault-password-file=vault-pass create-users.yml
  187. 160 ansible-playbook --vault-password-file=vault-pass create-user.yml
  188. 161 sudo dnf install -y redis
  189. 162 sudo systemctl enable --now redis
  190. 163 sudo systemctl status redis
  191. 164 sudo pip3 install redis
  192. 165 ls
  193. 166 git pull
  194. 167 ls
  195. 168 cd ..
  196. 169 ls
  197. 170 mv ansibleinthreeweeks ansibleinthreeweeks.old
  198. 171 git clone https://github.com/sandervanvugt/ansibleinthreeweeks
  199. 172 cd ansibleinthreeweeks
  200. 173 ls
  201. 174 cd factcache/
  202. 175 ls
  203. 176 vim ansible.cfg
  204. 177 vim checkcache.py
  205. 178 ./checkcache.py
  206. 179 ansible all -m setup
  207. 180 vim inventory
  208. 181 ansible all -m setup
  209. 182 ./checkcache.py
  210. 183 vim checkfacts.yaml
  211. 184 ansible-playbook checkfacts.yaml
  212. 185 sudo crontab -e
  213. 186 crontab -e
  214. 187 cd ..
  215. 188 ls
  216. 189 cd templates/
  217. 190 ls
  218. 191 cp ../factcache/ansible.cfg .
  219. 192 cp ../factcache/inventory .
  220. 193 vim vsftpd.j2
  221. 194 vim vsftpd-template.yml
  222. 195 ansible-playbook vsftpd-template.yml
  223. 196 ansible rocky -a "cat /etc/vsftpd/vsftpd.conf"
  224. 197 vim vsftpd-template.yml
  225. 198 cd ..
  226. 199 ls
  227. 200 cd task_control/
  228. 201 ls
  229. 202 vim handlers.yml
  230. 203 ansible-playbook handlers.yml
  231. 204 ls
  232. 205 cp ../factcache/ansible.cfg .
  233. 206 cp ../factcache/inventory .
  234. 207 vim handlers.yml
  235. 208 ansible-playbook handlers.yml
  236. 209 touch /tmp/index.html
  237. 210 ansible-playbook handlers.yml
  238. 211 vim handlers.yml
  239. 212 ansible-playbook handlers.yml
  240. 213 ansible rocky -m file -a "name=/var/www/html/index.html state=absent"
  241. 214 ansible-playbook handlers.yml
  242. 215 cd ..
  243. 216 ls
  244. 217 ./countdown 12
  245. 218 ls
  246. 219 cd task_control/
  247. 220 ls
  248. 221 vim loopservices.yml
  249. 222 rpm -qf $(which crond)
  250. 223 rpm -qf $(which sshd)
  251. 224 vim loopservices.yml
  252. 225 ansible-playbook loopservices.yml
  253. 226 vim loopservices.yml
  254. 227 ansible-doc service
  255. 228 ansible-doc yum
  256. 229 ansible-doc package
  257. 230 ls
  258. 231 vim ifsize.yml
  259. 232 vim when_multiple.yml
  260. 233 sudo vim /etc/hosts
  261. 234 vim inventory
  262. 235 vim ../factcache/inventory
  263. 236 vim when_multiple.yml
  264. 237 ansible-playbook when_multiple.yml
  265. 238 ansible all -m setup
  266. 239 ssh-copy-id ansible@tower
  267. 240 ansible all -m setup
  268. 241 ansible tower -m setup
  269. 242 ansible-playbook when_multiple.yml
  270. 243 vim when_multiple.yml
  271. 244 ls
  272. 245 vim ifsize.yml
  273. 246 ansible-playbook ifsize.yml
  274. 247 cd ..
  275. 248 ls
  276. 249 ansible --version
  277. 250 ansible-galaxy install geerlingguy.nginx
  278. 251 cd
  279. 252 cd .ansible/roles/geerlingguy.nginx/
  280. 253 ls
  281. 254 cd tasks/
  282. 255 ls
  283. 256 vim main.yml
  284. 257 cd
  285. 258 cd ansibleinthreeweeks
  286. 259 ls
  287. 260 cd roles/
  288. 261 ls
  289. 262 vim nginx-role.yml
  290. 263 cp ../factcache/inventory .
  291. 264 cp ../factcache/ansible.cfg .
  292. 265 ansible-playbook nginx-role.yml
  293. 266 ls
  294. 267 vim pretasks.yml
  295. 268 vim ../../.ansible/roles/geerlingguy.nginx/tasks/main.yml
  296. 269 ansible ubuntu -m setup -a "filter=ansible_os_family"
  297. 270 pwd
  298. 271 ../countdown 12
  299. 272 ansible-galaxy --help
  300. 273 ansible-galaxy collection -l
  301. 274 ansible-galaxy collection
  302. 275 ansible-galaxy collection list
  303. 276 ansible-doc -l
  304. 277 ansible-doc --help
  305. 278 cd
  306. 279 cd ansibleinthreeweeks
  307. 280 git pull
  308. 281 vim listing731.yaml
  309. 282 vim inventory
  310. 283 cp factcache/ansible.cfg .
  311. 284 vim listing731.yaml
  312. 285 ansible-playbook listing731.yaml
  313. 286 sudo vim /etc/ansible/ansible.cfg
  314. 287 ./countdown 18
  315. 288 ls
  316. 289 cd filters/
  317. 290 ls
  318. 291 vim int-filter.yaml
  319. 292 cp int-filter.yaml int-filter-wring.yaml
  320. 293 vim int-filter-wring.yaml
  321. 294 ansible-playbook int-filter-wring.yaml
  322. 295 ls
  323. 296 vim int-filter.yaml
  324. 297 ansible-playbook int-filter.yaml
  325. 298 vim ansible.cfg
  326. 299 vim int-filter.yaml
  327. 300 sudo ls /
  328. 301 ansible-playbook int-filter.yaml -K
  329. 302 cp ../factcache/ansible.cfg .
  330. 303 cp ../factcache/inventory .
  331. 304 vim storage-filter.yaml
  332. 305 ansible-playbook storage-filter.yaml
  333. 306 vim storage-filter.yaml
  334. 307 ansible all -m setup
  335. 308 ansible-playbook storage-filter.yaml
  336. 309 ansible-playbook storage-filter.yaml --flush-cache
  337. 310 ssh root@tower
  338. 311 ansible-playbook storage-filter.yaml
  339. 312 ansible-playbook storage-filter.yaml --flush-cache
  340. 313 ansible all -m setup
  341. 314 ansible-playbook storage-filter.yaml --flush-cache
  342. 315 vim ansible.cfg
  343. 316 vim storage-filter.yaml
  344. 317 ansible-playbook storage-filter.yaml
  345. 318 vim storage-filter.yaml
  346. 319 vim ansible.cfg
  347. 320 ansible all -m setup
  348. 321 ansible-playbook storage-filter.yaml
  349. 322 vim assert_filter.yaml
  350. 323 ansible-playbook assert_filter.yaml
  351. 324 vim assert_filter.yaml
  352. 325 ansible-playbook assert_filter.yaml
  353. 326 vim assert_filter.yaml
  354. 327 ansible-playbook assert_filter.yaml
  355. 328 ls
  356. 329 vim password_hash.yaml
  357. 330 ansible-playbook password_hash.yaml
  358. 331 ../countdown 12
  359. 332 ls
  360. 333 cd ..
  361. 334 find . -name "readkeys.*"
  362. 335 cd plugins/
  363. 336 vim readkeys.yaml
  364. 337 ansible doc -t lookup -l
  365. 338 ansible-doc -t lookup -l
  366. 339 ls
  367. 340 vim hello.yml
  368. 341 ansible-doc -t callback -l
  369. 342 ls
  370. 343 vim ansible.cfg
  371. 344 ansible-playbook hello.yml
  372. 345 vim hello.yml
  373. 346 find ../ -name "mytempl*"
  374. 347 cp ../templates/mytemplate.j2 .
  375. 348 ansible-playbook hello.yml -K
  376. 349 sudo vim /etc/ansible/ansible.cfg
  377. 350 cd ..
  378. 351 cat windows/inventory
  379. 352 ansible-inventory --yaml -i windows/inventory --list --output winventroy.yaml
  380. 353 ls
  381. 354 vim winventroy.yaml
  382. 355 ansible-doc -t inventory -l
  383. 356 ansible-doc -t inventory nmap
  384. 357 ansible-doc -t inventory -l
  385. 358 history
  386. 359 sudo poweroff
  387. 360 echo $(( 3600 * 5 ))
  388. 362 ansible-doc file
  389. 363 ssh root@kubuntu
  390. 364 ssh ansible@kubuntu
  391. 365 cd ..
  392. 366 ls
  393. 367 git pull
  394. 368 cd provision-kvm/
  395. 369 ls
  396. 370 cd ..
  397. 371 ./countdown 12
  398. 372 sudo pip3 install 'ansible[azure]'
  399. 373 cd azure/
  400. 374 ls
  401. 375 vim create-azure-stuff-old.yaml
  402. 376 ansible-playbook create-azure-stuff-old.yaml
  403. 377 vim create-azure-stuff-old.yaml
  404. 378 ansible-playbook create-azure-stuff-old.yaml
  405. 379 ansible-playbook remove-azure-stuff-old.yaml
  406. 380 cd ../
  407. 381 ls
  408. 382 cd docker/
  409. 383 ls
  410. 384 vim podman.yaml
  411. 385 ansible-playbook podman.yaml
  412. 386 ansible-playbook podman.yaml -K
  413. 387 ansible rocky -a "podman ps -a"
  414. 388 ip a
  415. 389 sudo pip3 install python-boto
  416. 390 sudo pip3 install boto boto3
  417. 391 cd ../ec2
  418. 392 ls
  419. 393 vim list-instances.yml
  420. 394 ansible-playbook --ask-vault-pass list-instances.yml
  421. 395 ls
  422. 396 ansible-playbook --ask-vault-pass ubuntu-new.yaml
  423. 397 history
  424.  
Advertisement
Add Comment
Please, Sign In to add comment