Advertisement
sandervanvugt

ansible4H august 22

Aug 1st, 2022
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.38 KB | None | 0 0
  1. [ansible@control ansiblefundamentals]$ history
  2. 1 ip a
  3. 2 sudo vim /etc/hosts
  4. 3 ping ansible1
  5. 4 ping ansible2
  6. 5 sudo hostnamectl set-hostname control.example.com
  7. 6 exit
  8. 7 cat /etc/hosts
  9. 8 free -m
  10. 9 df -h
  11. 10 sudo dnf install ansible-core
  12. 11 ansible --version
  13. 12 whoami
  14. 13 sudo ls /root
  15. 14 cat /etc/hosts
  16. 15 ansible --version
  17. 16 ssh root@ansible1
  18. 17 ssh root@ansible2
  19. 18 cat > inventory << EOF
  20. ansible1
  21. ansible2
  22. EOF
  23.  
  24. 19 cat inventory
  25. 20 ansible -i inventory all -u root -k -m command -a "useradd ansible"
  26. 21 ansible -i inventory all -u root -k -m shell -a "echo password | passwd --stdin ansible"
  27. 22 ansible -i inventory all -u root -k -m command -a "rpm -qa | grep tools"
  28. 23 ansible -i inventory all -u root -k -m shell -a "rpm -qa | grep tools"
  29. 24 ansible -i inventory all -u ansible -k -m command -a "whoami"
  30. 25 ansible -i inventory all -u ansible -k -m command -a "ls -l /root"
  31. 26 ansible -i inventory all -u root -k -m copy -a 'content="ansible ALL=(ALL) NOPASSWD: ALL" dest=/etc/sudoers.d/ansible'
  32. 27 ansible -i inventory all -u ansible -k -m command -a "ls -l /root"
  33. 28 ansible -i inventory all -u ansible -k -b -m command -a "ls -l /root"
  34. 29 history
  35. 30 ssh-keygen
  36. 31 ssh-copy-id ansible1
  37. 32 ssh-copy-id ansible2
  38. 33 ansible -i inventory all -u ansible -b -m command -a "ls -l /root"
  39. 34 cd ansiblefundamentals/
  40. 35 ls
  41. 36 vim ansible.cfg
  42. 37 ansible all -a "whoami"
  43. 38 cat ansible.cfg
  44. 39 cp ../inventory ..
  45. 40 cp ../inventory .
  46. 41 ansible all -a "whoami"
  47. 42 ansible-doc -l
  48. 43 ansible-doc -l | wc
  49. 44 ansible-galaxy collection install ansible.windows
  50. 45 ansible-doc -l | wc
  51. 46 ansible-doc -l
  52. 47 pwd
  53. 48 ls
  54. 49 ansible all -m ping
  55. 50 ansible all -m user -a "name=lisa"
  56. 51 ansible-doc user
  57. 52 ansible all -m command -a "id lisa"
  58. 53 ansible all -m user -a "name=lisa state=absent"
  59. 54 ansible all -m copy -a "src=/etc/hosts dest=/etc/hosts"
  60. 55 ansible all -a "cat /etc/hosts"
  61. 56 ansible ansible1 -m command -a "rpm -qa | grep python"
  62. 57 ansible ansible1 -m shell -a "rpm -qa | grep python"
  63. 58 ansible all -m copy -a 'content="hello world" dest=/etc/motd'
  64. 59 ansible all -a "cat /etc/motd"
  65. 60 ansible all -m dnf -a "name=nmap state=latest"
  66. 61 ansible all -m service -a "name=httpd state=started enabled=yes"
  67. 62 ansible ansible1 -m command -a "useradd bob"
  68. 63 ansible ansible1 -m user -a "name=bob"
  69. 64 vim install_and_start_httpt.yaml
  70. 65 ansible-playbook install_and_start_httpt.yaml
  71. 66 vim enforce-selinux.yml
  72. 67 ansible-playbook enforce-selinux.yml
  73. 68 history | grep collection
  74. 69 ansible-galaxy collection install ansible.posix
  75. 70 ansible-playbook enforce-selinux.yml
  76. 71 vim enforce-selinux.yml
  77. 72 ansible-playbook enforce-selinux.yml
  78. 73 vim enforce-selinux-simplified.yml
  79. 74 ansible-playbook enforce-selinux-simplified.yml
  80. 75 ./countdown 12
  81. 76 ansible-doc -l
  82. 77 ansible-doc -l | grep firewalld
  83. 78 ansible-doc ansible.posix.firewalld
  84. 79 vim install_and_start_httpt.yaml
  85. 80 ansible-playbook install_and_start_httpt.yaml
  86. 81 ansible-doc ansible.posix.firewalld
  87. 82 vim install_and_start_httpt.yaml
  88. 83 ansible-playbook install_and_start_httpt.yaml
  89. 84 ansible -a "firewall-cmd --list-all"
  90. 85 ansible -a "firewall-cmd list-all"
  91. 86 firewall-cmd --list-all
  92. 87 ansible all -a "firewall-cmd --list-all"
  93. 88 ansible-doc -l | grep posix
  94. 89 vim run_and_test_httpd.yaml
  95. 90 ansible-playbook run_and_test_httpd.yaml
  96. 91 vim run_and_test_httpd.yaml
  97. 92 ansible-playbook run_and_test_httpd.yaml
  98. 93 vim run_and_test_httpd.yaml
  99. 94 vim multi_play.yaml
  100. 95 ansible-playbook multi_play.yaml
  101. 96 vim multi_play.yaml
  102. 97 ansible-doc yum
  103. 98 vim multi_play.yaml
  104. 99 ansible-playbook multi_play.yaml
  105. 100 sudo dnf provides */ansible-lint
  106. 101 ansible-playbook playbook_with_errors.yaml
  107. 102 vim playbook_with_errors.yaml
  108. 103 ansible-playbook playbook_with_errors.yaml
  109. 104 vim playbook_with_errors.yaml
  110. 105 ansible-playbook playbook_with_errors.yaml
  111. 106 vim playbook_with_errors.yaml
  112. 107 vim variables_example.yaml
  113. 108 ansible-playbook variables_example.yaml
  114. 109 ansible ansible1 -a "hostname"
  115. 110 ansible ansible1 -a "hostnamectl set-hostname ansible1.example.com"
  116. 111 ansible ansible1 -a "hostname"
  117. 112 ansible ansible2 -a "hostnamectl set-hostname ansible2.example.com"
  118. 113 ansible-playbook variables_example.yaml
  119. 114 vim gather_facts.yaml
  120. 115 ansible-playbook variables_example.yaml
  121. 116 ansible-playbook gather_facts.yaml
  122. 117 ansible ansible1 -m setup > facts.txt
  123. 118 less facts.txt
  124. 119 vim old_facts.yaml
  125. 120 ansible-playbook old_facts.yaml
  126. 121 vim new_facts.yaml
  127. 122 ansible-playbook new_facts.yaml
  128. 123 vim new_facts.yaml
  129. 124 ./countdown 12
  130. 125 vim vars_file.yaml
  131. 126 ansible-playbook vars_file.yaml
  132. 127 vim vars/common
  133. 128 ansible-playbook vars_file.yaml
  134. 129 ls
  135. 130 mkdir group_vars
  136. 131 vim group_vars/all
  137. 132 vim vars_file.yaml
  138. 133 ansible-playbook vars_file.yaml
  139. 134 cat group_vars/all
  140. 135 vim register.yaml
  141. 136 ansible-playbook register.yaml
  142. 137 vim register.yaml
  143. 138 ansible-playbook register.yaml
  144. 139 vim register.yaml
  145. 140 ansible-playbook register.yaml
  146. 141 vim loop_packages.yaml
  147. 142 ansible-playbook loop_packages.yaml
  148. 143 vim loop_on_vars.yaml
  149. 144 cat loop_on_vars.yaml
  150. 145 cat vars/users-list
  151. 146 ansible-playbook loop_on_vars.yaml
  152. 147 vim when_test.yaml
  153. 148 ansible-playbook when_test.yaml
  154. 149 vim when_test.yaml
  155. 150 vim when_complex.yaml
  156. 151 ansible-playbook when_complex.yaml
  157. 152 ansible-playbook -vv when_complex.yaml
  158. 153 vim when_register.yaml
  159. 154 ansible-playbook when_register.yaml
  160. 155 vim using_handlers.yaml
  161. 156 ansible-playbook using_handlers.yaml
  162. 157 vim using_handlers.yaml
  163. 158 ansible-playbook using_handlers.yaml
  164. 159 vim using_handlers.yaml
  165. 160 ansible-playbook using_handlers.yaml
  166. 161 ansible all -m file -a "name=/var/www/html/index.html state=absent"
  167. 162 ansible-playbook using_handlers.yaml
  168. 163 history
  169.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement