Advertisement
sandervanvugt

Ansible3W day2 July21

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