sandervanvugt

Ansible3W day2 July21

Jul 16th, 2021
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.69 KB | None | 0 0
  1. [defaults]
  2. inventory = inventory
  3. remote_user = ansible
  4. host_key_checking = false
  5. callback_whitelist = timer,profile_tasks,profile_roles
  6.  
  7. [privilege_escalation]
  8. become = True
  9. become_method = sudo
  10. become_user = root
  11. become_ask_pass = False
  12.  
  13. ******ROCKY
  14. [ansible@a3wrcontrol timer]$ history
  15. 2 ip a
  16. 3 sudo yum install epel-release
  17. 4 sudo dnf install -y ansible
  18. 5 ansible --version
  19. 6 history
  20. 7 sudo vim /etc/ansible/hosts
  21. 8 sudo dnf install -y vim git
  22. 9 git clone https://github.com/sandervanvugt/ansibleinthreeweeks
  23. 10 cd ansibleinthreeweeks/
  24. 11 ls
  25. 12 cd cisco/
  26. 13 ls
  27. 14 cat inventory
  28. 15 cd ../windows/
  29. 16 cat inventory
  30. 17 ansible --version
  31. 18 cd
  32. 19 ansible --version
  33. 20 vim /etc/ansible/ansible.cfg
  34. 21 cd -
  35. 22 ansible --version
  36. 23 ansible-doc -l
  37. 24 ansible-doc -l | wc
  38. 25 cd..
  39. 26 cd ..
  40. 27 cd
  41. 28 ansible all -m ping
  42. 29 ssh-keygen
  43. 30 ssh-copy-id rocky
  44. 31 ssh-copy-id fedora
  45. 32 ssh-copy-id ubuntu
  46. 33 ssh-copy-id centos7
  47. 34 ssh-copy-id rhel8
  48. 35 ansible all -m ping
  49. 36 cat inventory
  50. 37 ansible rhelfamily -m command -a "useradd lisa"
  51. 38 ansible rhelfamily -m user -a "name=linda"
  52. 39 history
  53. 40 cat ansible.cfg
  54. 41 ansible ubuntu -K -m package -a "name=nmap"
  55. 42 cat /etc/hosts
  56. 43 ansible ubuntu -K -m package -a "name=nmap"
  57. 44 ssh-copy-id ubuntu
  58. 45 ansible ubuntu -K -m package -a "name=nmap"
  59. 46 history
  60. 47 git clone https://github.com/sandervanvugt/ansible-3h
  61. 48 cd ansible-3h/
  62. 49 ls
  63. 50 cd install/
  64. 51 ls
  65. 52 cd ../..
  66. 53 find . -name "install_and*"
  67. 54 cd ansible-3h/
  68. 55 cd install/
  69. 56 vim vsftpd.yml
  70. 57 ansible-playbook vsftpd.yml
  71. 58 ls
  72. 59 cat inventory
  73. 60 ansible-playbook -i ../../ansibleinthreeweeks/inventory vsftpd.yml
  74. 61 cp ../../ansibleinthreeweeks/inventory .
  75. 62 vim inventory
  76. 63 ansible-playbook vsftpd.yml
  77. 64 vim inventory
  78. 65 ansible-playbook vsftpd.yml
  79. 66 vim vsftpd.yml
  80. 67 ansible-playbook vsftpd.yml
  81. 68 cat vsftpd.yml
  82. 69 ansible-doc yum
  83. 70 ansible-doc copy
  84. 71 vim vsftpd.yml
  85. 72 ansible-playbook --syntax-check vsftpd.yml
  86. 73 ansible-playbook vsftpd.yml
  87. 74 ansible-playbook --syntax-check vsftpd.yml
  88. 75 vim vsftpd.yml
  89. 76 ansible-playbook --syntax-check vsftpd.yml -v
  90. 77 ansible-playbook --syntax-check vsftpd.yml -vv
  91. 78 ansible-playbook --syntax-check vsftpd.yml -vvv
  92. 79 ansible-playbook vsftpd.yml -vvv
  93. 80 ansible-playbook vsftpd.yml -vvvv
  94. 81 ansible-doc user
  95. 82 ansible-doc yum
  96. 83 ansible-doc -l | grep ufw
  97. 84 ansible-doc -l | grep firewall
  98. 85 ansible-doc ufw
  99. 86 cd ../..
  100. 87 find . -name "run_and_test_httpd.yaml"
  101. 88 ls
  102. 89 git clone https://github.com/sandervanvugt/ansible-advanced
  103. 90 find . -name "run_and_test_httpd.yaml"
  104. 91 cd ansible-3h/
  105. 92 cd base
  106. 93 ls
  107. 94 vim installpackage.yaml
  108. 95 ip a
  109. 96 cd..
  110. 97 cd ..
  111. 98 ;s
  112. 99 ls
  113. 100 cd ansible-3h/
  114. 101 cd base/
  115. 102 ls
  116. 103 vim variables.yml
  117. 104 vim installpackage.yaml
  118. 105 ansible-playbook installpackage.yaml
  119. 106 vim inventory
  120. 107 ansible-playbook installpackage.yaml
  121. 108 vim inventory
  122. 109 cat installpackage.yaml
  123. 110 ansible-playbook --help | less
  124. 111 ansible-playbook installpackage.yaml -e package=nmap
  125. 112 ls
  126. 113 vim variables.yml
  127. 114 ansible-playbook variables.yml
  128. 115 vim variables.yml
  129. 116 ansible centos7 -m setup | less
  130. 117 ls
  131. 118 head installpackage.yaml
  132. 119 head variables.yml
  133. 120 ansible-doc -l | grep facts
  134. 121 ansible-doc -l | grep facts | wc
  135. 122 ls
  136. 123 vim thefacts.yaml
  137. 124 ansible-playbook thefacts.yaml
  138. 125 vim thefacts.yaml
  139. 126 ansible-playbook thefacts.yaml
  140. 127 ls
  141. 128 vim when-test.yml
  142. 129 ansible-playbook when-test.yml
  143. 130 vim when-test.yml
  144. 131 vim inventory
  145. 132 vim when-test.yml
  146. 133 ansible-playbook when-test.yml
  147. 134 vim when-test.yml
  148. 135 ansible-playbook when-test.yml
  149. 136 history
  150. 137 cd
  151. 138 vim paster
  152. 139 vim .bashrc
  153. 140 history -d 135
  154. 141 history -d 137
  155. 142 history -d 138
  156. 143 ls
  157. 144 chmod +x paster
  158. 145 history
  159. 146 history -d 134
  160. 147 history -d 135
  161. 148 history -d 140-
  162. 149 history -d 140-144
  163. 150 history -d 140
  164. 151 hist
  165. 152 history -d 134
  166. 153 history
  167. 154 history -d 138
  168. 155 history -d 137
  169. 156 history
  170. 157 chmod +x paster
  171. 158 ./paster
  172. 159 vim .bashrc
  173. 160 source .bashrc
  174. 161 ./paster
  175. 162 ./paster test
  176. 163 vim paster
  177. 164 ./paster "my-title" "$(history)"
  178. 165 sudo poweroff
  179. 166 history
  180. 167 ls
  181. 168 cd ansibleinthreeweeks/
  182. 169 ls
  183. 170 cat inventory
  184. 171 ansible localhost -m debug -a 'var=hostvars["fedora"]'
  185. 172 ls
  186. 173 cd ..
  187. 174 git pull https://github.com/sandervanvugt/ansibleinthreeweeks
  188. 175 git clone https://github.com/sandervanvugt/ansibleinthreeweeks
  189. 176 rm -rf ansibleinthreeweeks/
  190. 177 git clone https://github.com/sandervanvugt/ansibleinthreeweeks
  191. 178 cd ansibleinthreeweeks/
  192. 179 ls
  193. 180 vim register.yaml
  194. 181 ansible-playbook register.yaml
  195. 182 vim inventory
  196. 183 ansible-playbook register.yaml
  197. 184 ls
  198. 185 cat secret.yml
  199. 186 rm secret.yml
  200. 187 ansible-vault -h
  201. 188 ansible-vault create secret.yml
  202. 189 vim create-user.yml
  203. 190 ansible-playbook create-user.yml
  204. 191 ansible-playbook --ask-vault-pass create-user.yml
  205. 192 ansible fedora -a "cat /etc/shadow"
  206. 193 echo password > vault-pass
  207. 194 ansible-playbook --vault-password-file=vault-pass create-users.yml
  208. 195 ansible-playbook --vault-password-file=vault-pass create-user.yml
  209. 196 ls
  210. 197 cd templates/
  211. 198 ls
  212. 199 cp ../inventory .
  213. 200 cp ../ansible.cfg .
  214. 201 vim vsftpd-template.yml
  215. 202 vim vsftpd.j2
  216. 203 ansible-playbook vsftpd-template.yml
  217. 204 cat /etc/hosts
  218. 205 cd
  219. 206 cd ansibleinthreeweeks/
  220. 207 ls
  221. 208 vim exercise134.yaml
  222. 209 ansible-playbook --list-tags exercise134.yaml
  223. 210 cd ..
  224. 211 git clone https://github.com/sandervanvugt/rhce8-book
  225. 212 cd -
  226. 213 cp ../rhce8-book/*134* .
  227. 214 ls
  228. 215 ansible-playbook --list-tags exercise134.yaml
  229. 216 ansible-playbook --tags setuplocal exercise134.yaml
  230. 217 vim exercise134.yaml
  231. 218 vim exercise134-tasks.yaml
  232. 219 vim exercise134.yaml
  233. 220 ansible all -m setup
  234. 221 cd templates/; ansible-playbook -vvv vsftpd-template.yml
  235. 222 cd ..
  236. 223 ../luth/countdown 12
  237. 224 ls
  238. 225 mkdir perf
  239. 226 cd perf
  240. 227 cp ../inventory .
  241. 228 cp ../ansible.cfg
  242. 229 cp ../ansible.cfg .
  243. 230 vim ansible.cfg
  244. 231 sudo cgcreate -a ansible:ansible -t ansible:ansible -g cpuacct,memory,pids:ansible_profile
  245. 232 sudo yum provides */cgcreate
  246. 233 sudo yum install libcgroup-tools
  247. 234 sudo cgcreate -a ansible:ansible -t ansible:ansible -g cpuacct,memory,pids:ansible_profile
  248. 235 ls ..
  249. 236 cd ../basics/
  250. 237 ls
  251. 238 cat install_and_start_httpt.yaml
  252. 239 cp ../perf/
  253. 240 cp install_and_start_httpt.yaml ../perf/
  254. 241 cd ../perf
  255. 242 #cgexec -g cpuacct,memory,pids:ansible_profile ansible-playbook
  256. 243 ls
  257. 244 cgexec -g cpuacct,memory,pids:ansible_profile ansible-playbook install_and_start_httpt.yaml
  258. 245 cd ../
  259. 246 mkdir timer
  260. 247 cp perf/* timer/
  261. 248 cd timer/
  262. 249 vim ansible.cfg
  263. 250 ls
  264. 251 ansible-playbook install_and_start_httpt.yaml
  265. 252 ansible-doc -t callback -l
  266. 253 cd ..
  267. 254 ls
  268. 255 cd filters/
  269. 256 ls
  270. 257 cp ../inventory .
  271. 258 cp ../ansible.cfg .
  272. 259 vim int-filter.yaml
  273. 260 cp int-filter.yaml int-nofilter.yaml
  274. 261 vim int-nofilter.yaml
  275. 262 ansible-playbook int-nofilter.yaml
  276. 263 vim int-filter.yaml
  277. 264 ansible-playbook int-filter.yaml
  278. 265 ls
  279. 266 vim password_hash.yaml
  280. 267 ansible-playbook password_hash.yaml
  281. 268 vim password_hash.yaml
  282. 269 ansible-playbook password_hash.yaml
  283. 270 ansible centos7 -a "tail /etc/shadow"
  284. 271 vim password_hash.yaml
  285. 272 vim assert_filter.yaml
  286. 273 ansible-playbook assert_filter.yaml
  287. 274 vim assert_filter.yaml
  288. 275 cd ../timer/
  289. 276 cat ansible.cfg
  290. 277 history
  291.  
  292. ******FEDORA
  293. history
  294. [ansible@fedora basics]$
  295. [ansible@fedora basics]$
  296. [ansible@fedora basics]$ history
  297. 1 ssh rocky
  298. 2 sudo poweroff
  299. 3 ip a
  300. 4 sudo systemctl status sshd
  301. 5 sudo systemctl enable sshd
  302. 6 sudo dnf install python3-pip
  303. 7 pip3 install ansible --user
  304. 8 ansible --version
  305. 9 sudo systemctl enable sshd
  306. 10 sudo dnf install -y git vim
  307. 11 git clone https://github.com/sandervanvugt/ansibleinthreeweeks
  308. 12 cd ansibleinthreeweeks/
  309. 13 ls
  310. 14 cd ..
  311. 15 git clone https://github.com/sandervanvugt/luth
  312. 16 luth/countdown 12
  313. 17 sudo vim /etc/hosts
  314. 18 i pa
  315. 19 ip a
  316. 20 sudo vim /etc/hosts
  317. 21 ping ubuntu
  318. 22 vim inventory
  319. 23 #sudo useradd ansible
  320. 24 #passwd ansible
  321. 25 id
  322. 26 sudo ls -l /root
  323. 27 sudo -i
  324. 28 ansible all -i inventory -u root -k -m raw -a "useradd -G wheel ansible"
  325. 29 ansible all -i inventory -u root -k -m raw -a "useradd bob"
  326. 30 ansible ubuntu -i inventory -u ansible -k -K -m raw -a "useradd bob"
  327. 31 vim inventory
  328. 32 sudo /tmp/sudoers /etc/sudoers.d/ansible
  329. 33 sudo cp /tmp/sudoers /etc/sudoers.d/ansible
  330. 34 sudo ls -l /root
  331. 35 ssh-keygen
  332. 36 ssh-copy-id fedora
  333. 37 ssh-copy-id rocky
  334. 38 ssh-copy-id rhel8
  335. 39 ssh-copy-id centos7
  336. 40 ansible rocky,rhel8,centos7 -i inventory -u root -k -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  337. 41 history
  338. 42 sudo systemctl status sshd
  339. 43 sudo systemctl enable --now sshd
  340. 44 ansible rhelfamily -i inventory -u root -k -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  341. 45 vim inventory
  342. 46 ansible rhelfamily -i inventory -u root -k -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  343. 47 ansible rhelfamily -u root -k -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
  344. 48 cat inventory
  345. 49 history
  346. 50 ansible centos7 -i inventory -u ansible -m command -a "id"
  347. 51 vim ansible.cfg
  348. 52 ansible centos7 -m command -a "id"
  349. 53 cat ansible.cfg
  350. 54 luth/countdown 12
  351. 55 cat ansible.cfg
  352. 56 cat inventory
  353. 57 sudo vim /etc/ansible/hosts
  354. 58 ls -a
  355. 59 cd .ansible/
  356. 60 ls
  357. 61 cd cp
  358. 62 ls
  359. 63 cd ../..
  360. 64 find / -name "hosts"
  361. 65 sudo find / -name "hosts" 2>/dev/null
  362. 66 history | grep '^ansible'
  363. 67 history
  364. 68 history | grep 'ansible'
  365. 69 cat /etc/hosts
  366. 70 history | grep ansible
  367. 71 history | grep copy
  368. 72 ansible rocky -m copy -a "src=/etc/hosts dest=/etc/hosts"
  369. 73 cat inventory
  370. 74 ansible rocky -m copy -a "src=inventory dest=/home/ansible"
  371. 75 ansible rocky -m copy -a "src=ansible.cfg dest=/home/ansible"
  372. 76 history
  373. 77 ansible-doc copy
  374. 78 luth/countdown 18
  375. 79 ls
  376. 80 luth/countdown 12
  377. 81 history
  378. 82 ansible-galaxy --help
  379. 83 ansible-galaxy collection install ansible.posix
  380. 84 tree .ansible/collections/ansible_collections/ansible/posix/
  381. 85 ansible-doc ansible.posix.selinux
  382. 86 ansible-doc --help | less
  383. 87 ansible-galaxy collection --help | less
  384. 88 ansible-galaxy collection list
  385. 89 ansible-doc ansible.windows
  386. 90 ansible-doc ansible.posix.acl
  387. 91 ls
  388. 92 rm -rf ansibleinthreeweeks/
  389. 93 git clone https://github.com/sandervanvugt/ansibleinthreeweeks
  390. 94 cd ansibleinthreeweeks/
  391. 95 ls
  392. 96 cd collections/
  393. 97 ls
  394. 98 vim enforce-selinux-simplified.yml
  395. 99 ansible-playbook enforce-selinux-simplified.yml
  396. 100 vim enforce-selinux.yml
  397. 101 cat enforce-selinux.yml
  398. 102 cat enforce-selinux-simplified.yml
  399. 103 cd
  400. 104 ls
  401. 105 luth/countdown 18
  402. 106 tree .ansible/collections/ansible_collections/ansible/posix/
  403. 107 tree .ansible/collections/ansible_collections/ansible/posix/ | less
  404. 108 ansible-galaxy collection install cisco.ios
  405. 109 ansible-doc -l | less
  406. 110 ansible-doc -l | grep '^ansible.posix'
  407. 111 cd ansibleinthreeweeks/
  408. 112 ls
  409. 113 cd basics/
  410. 114 ls
  411. 115 vim run_and_test_httpd.yaml
  412. 116 cp ../inventory .
  413. 117 cp ../ansible.cfg .
  414. 118 vim inventory
  415. 119 cat /etc/hosts
  416. 120 vim run_and_test_httpd.yaml
  417. 121 ansible-playbook run_and_test_httpd.yaml
  418. 122 vim httpd.yaml
  419. 123 vim run_and_test_httpd.yaml
  420. 124 ansible-doc -l | grep yum 2>/dev/null
  421. 125 history
  422.  
Advertisement
Add Comment
Please, Sign In to add comment