Advertisement
sandervanvugt

ansible4H oct22

Oct 31st, 2022
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.88 KB | None | 0 0
  1. [ansible@control ansiblefundamentals]$ history
  2. 1 sudo vim /etc/hosts
  3. 2 ssh ansible1
  4. 3 ssh ansible2
  5. 4 ssh control
  6. 5 sudo dnf install ansible-core
  7. 6 ansible --version
  8. 7 id
  9. 8 sudo ls -l /root
  10. 9 cat /etc/hosts
  11. 10 ping ansible1
  12. 11 ls -l /etc/ansible/hosts
  13. 12 ansible --version
  14. 13 history
  15. 14 sudo systemctl status sshd
  16. 15 sudo rpm -qa | grep python
  17. 16 sudo firewall-cmd --list-all
  18. 17 cat > inventory <<EOF
  19. ansible1
  20. ansible2
  21. EOF
  22.  
  23. 18 cat inventory
  24. 19 ansible -i inventory all -u root -k -m command -a "useradd bob"
  25. 20 ansible -i inventory all -u root -k -m command -a "id bob"
  26. 21 ansible -i inventory all -u ansible -k -b -K -m command -a "useradd linda"
  27. 22 sudo useradd bob
  28. 23 sudo -i
  29. 24 ansible -i inventory all -u ansible -k -m command -a "rpm -qa | grep bash"
  30. 25 ansible -i inventory all -u ansible -k -m shell -a "rpm -qa | grep bash"
  31. 26 ansible -i inventory all -u root -k -m shell -a "echo password | passwd --stdin ansible"
  32. 27 sudo dnf install git
  33. 28 git clone https://github.com/sandervanvugt/ansiblefundamentals
  34. 29 ansiblefundamentals/countdown 12
  35. 30 history
  36. 31 ansible all -i inventory -u ansible -k -m command -a "whoami"
  37. 32 ansible all -i inventory -u ansible -k -m command -a "sudo ls -l /root"
  38. 33 ansible all -i inventory -u ansible -k -b -K -m command -a "ls -l /root"
  39. 34 ansible all -i inventory -u root -k -m copy -a 'content="ansible ALL=(ALL) NOPASSWD: ALL" dest=/etc/sudoers.d/ansible'
  40. 35 ansible all -i inventory -u ansible -k -b -m command -a "ls -l /root"
  41. 36 ansible-doc copy
  42. 37 ssh-keygen
  43. 38 ssh-copy-id ansible1
  44. 39 ssh-copy-id ansible2
  45. 40 ansible all -i inventory -u ansible -b -m command -a "ls -l /root"
  46. 41 history
  47. 42 cd ansiblefundamentals/
  48. 43 vim ansible.cfg
  49. 44 ansible all -a "whoami"
  50. 45 cp ../inventory .
  51. 46 ansible all -a "ls -l /root"
  52. 47 ansible-doc -l
  53. 48 ansible-doc -l | wc
  54. 49 ansible-doc copy
  55. 50 ansible-doc -l
  56. 51 ansible ansible1 -m package -a "name=nmap"
  57. 52 ansible all -m ping
  58. 53 ansible all -m user -a "name=lisa"
  59. 54 ansible all -m command -a "id lisa"
  60. 55 ansible all -m user -a "name=lisa state=absent"
  61. 56 ansible all -m command -a "id lisa"
  62. 57 ansible all -m copy "src=/etc/hosts dest=/etc/hosts"
  63. 58 ansible all -m copy -a "src=/etc/hosts dest=/etc/hosts"
  64. 59 ansible all -m package -a "name=nmap state=latest"
  65. 60 ansible all -m service -a "name=httpd state=started enabled=yes"
  66. 61 ansible all -m command -a "useradd jason"
  67. 62 ansible all -m user -a "name=jason"
  68. 63 ls
  69. 64 vim install_and_start_httpt.yaml
  70. 65 ansible-doc service
  71. 66 ansible-playbook install_and_start_httpt.yaml
  72. 67 ./countdown 12
  73. 68 ansible-playbook -v install_and_start_httpt.yaml
  74. 69 ansible-playbook -vvvv install_and_start_httpt.yaml
  75. 70 ansible-playbook --syntax-check install_and_start_httpt.yaml
  76. 71 ls
  77. 72 ansible-playbook enforce-selinux.yml
  78. 73 ansible-galaxy collection install ansible.posix
  79. 74 ansible-doc -l
  80. 75 vim enforce-selinux.yml
  81. 76 ansible-playbook enforce-selinux.yml
  82. 77 history | grep sudoers.d
  83. 78 ansible localhost -u root -k -m copy -a 'content="ansible ALL=(ALL) NOPASSWD: ALL" dest=/etc/sudoers.d/ansible'
  84. 79 ansible localhost -u ansible -k -K -m copy -a 'content="ansible ALL=(ALL) NOPASSWD: ALL" dest=/etc/sudoers.d/ansible'
  85. 80 ansible-playbook enforce-selinux.yml
  86. 81 vim enforce-selinux-simplified.yml
  87. 82 ansible-playbook enforce-selinux-simplified.yml
  88. 83 ./countdown 1
  89. 84 vim run_and_test_httpd.yaml
  90. 85 ansible-playbook run_and_test_httpd.yaml
  91. 86 vim run_and_test_httpd.yaml
  92. 87 ansible-playbook run_and_test_httpd.yaml
  93. 88 vim run_and_test_httpd.yaml
  94. 89 ansible all -a "firewall-cmd --list-all"
  95. 90 ansible-doc firewalld
  96. 91 vim run_and_test_httpd.yaml
  97. 92 ansible-playbook run_and_test_httpd.yaml
  98. 93 ping ansible1
  99. 94 curl http://ansible1
  100. 95 vim run_and_test_httpd.yaml
  101. 96 ansible-playbook run_and_test_httpd.yaml
  102. 97 curl http://ansible1
  103. 98 vim run_and_test_httpd.yaml
  104. 99 ansible-playbook run_and_test_httpd.yaml
  105. 100 vim multi_play.yaml
  106. 101 vim variables_example.yaml
  107. 102 ansible-playbook variables_example.yaml
  108. 103 ansible-playbook variables_example.yaml -e user=linda
  109. 104 ansible-playbook variables_example.yaml -e user=linda -v
  110. 105 ansible-playbook -v variables_example.yaml -e user=linda -v
  111. 106 vim variables_example.yaml
  112. 107 ansible-playbook -v variables_example.yaml -e user=linda
  113. 108 ./countdown 12
  114. 109 vim gather_facts.yaml
  115. 110 ansible-playbook gather_facts.yaml | less
  116. 111 vim old_facts.yaml
  117. 112 ansible-playbook old_facts.yaml
  118. 113 vim new_facts.yaml
  119. 114 ansible-playbook new_facts.yaml
  120. 115 ls
  121. 116 vim myvars.yaml
  122. 117 vim vars_file.yaml
  123. 118 ansible-playbook vars_file.yaml
  124. 119 vim vars_file.yaml
  125. 120 ansible-playbook vars_file.yaml
  126. 121 mkdir group_vars
  127. 122 vim group_vars/all
  128. 123 ansible-playbook vars_file.yaml
  129. 124 vim vars_file.yaml
  130. 125 mkdir host_vars
  131. 126 vim host_vars/ansible1
  132. 127 vim vars_file.yaml
  133. 128 ansible-playbook vars_file.yaml
  134. 129 vim register.yaml
  135. 130 ansible-playbook register.yaml
  136. 131 vim loop_packages.yaml
  137. 132 ansible-playbook loop_packages.yaml
  138. 133 vim when_test.yaml
  139. 134 ansible-playbook when_test.yaml
  140. 135 vim when_register.yaml
  141. 136 ansible-playbook when_register.yaml
  142. 137 vim using_handlers.yaml
  143. 138 ansible-playbook using_handlers.yaml
  144. 139 vim using_handlers.yaml
  145. 140 ansible-playbook using_handlers.yaml
  146. 141 ansible all -m file -a "name=/var/www/html/index.html state=absent"
  147. 142 ansible-playbook using_handlers.yaml
  148. 143 history
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement