Advertisement
sandervanvugt

RHCE oct21 day1

Oct 26th, 2021
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.78 KB | None | 0 0
  1.  
  2. [ansible@control lesson5]$ cat todayis.yml
  3. ---
  4. - name: printing stuff
  5. hosts: ansible1.example.com
  6. tasks:
  7. - name: classic notation
  8. debug:
  9. msg: today is {{ ansible_date_time.date }}
  10. - name: since 2.5
  11. debug:
  12. msg: today is {{ ansible_facts.date_time.date }}
  13. - name: avoided deprecated syntax
  14. debug:
  15. msg: today is {{ ansible_facts['date_time']['date'] }}
  16. - name: avoiding deprecated in injected variables
  17. debug:
  18. msg: today is {{ ansible_date_time['date'] }}
  19. [ansible@control lesson5]$ cat user.yml
  20. ---
  21. - name: create a user using a variable
  22. hosts: all
  23. vars_files:
  24. - vars/users.yml
  25. tasks:
  26. - name: create a user {{ user }}
  27. debug:
  28. msg: "{{ user }} will be added to {{ mygroups }}"
  29. - name: once more
  30. debug:
  31. var: user
  32. [ansible@control lesson5]$ history
  33. 1 sudo vim /etc/hosts
  34. 2 ip a
  35. 3 ping ansible1
  36. 4 ping ansible2
  37. 5 sudo yum install epel-release
  38. 6 sudo yum install ansible
  39. 7 ansible --version
  40. 8 sudo dnf install -y vim git
  41. 9 git clone https://github.com/sandervanvugt/rhce8-live
  42. 10 git clone https://github.com/sandervanvugt/rhce8-book
  43. 11 cd rhce8-live/
  44. 12 ls
  45. 13 cd lesson2/
  46. 14 ls
  47. 15 vim inventory
  48. 16 history
  49. 17 pwd
  50. 18 vim inventory
  51. 19 sudo vim /etc/ansible/hosts
  52. 20 pwd
  53. 21 ansible all -m ping
  54. 22 cat ansible.cfg
  55. 23 ansible -i inventory all --list-hosts
  56. 24 ansible file --list-hosts
  57. 25 cat inventory
  58. 26 ansible web --list-hosts
  59. 27 ls ..
  60. 28 ../countdown 15
  61. 29 vim ansible.cfg
  62. 30 ansible --version
  63. 31 sudo vim /etc/ansible/ansible.cfg
  64. 32 ansible all -m user -a "name=lisa"
  65. 33 ansible --help | less
  66. 34 #ansible all -m user -a "name=ansible groups=wheel" -u root -k
  67. 35 ansible-doc user
  68. 36 ansible all -m user -a "name=ansible groups=wheel" -u root -k
  69. 37 vim inventory
  70. 38 ansible all -m user -a "name=ansible groups=wheel" -u root -k
  71. 39 ansible all -m command -a "cat /etc/shadow" -u root -k
  72. 40 #ansible all -m command -a "echo password | passwd --stdin ansible"
  73. 41 ansible all -m command -a "cat /etc/passwd | grep ansible" -u root -k
  74. 42 ansible all -m shell -a "cat /etc/passwd | grep ansible" -u root -k
  75. 43 ansible all -m shell -a "echo password | passwd --stdin ansible" -u root -k
  76. 44 ansible all -m command -a "cat /etc/shadow" -k
  77. 45 cat ansible.cfg
  78. 46 ansible all -m command -a "cat /etc/shadow" -k -K
  79. 47 ansible all -m command -a "cat /etc/shadow" -K
  80. 48 ansible all -m shell -a 'echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ansible' -K
  81. 49 ssh ansible1
  82. 50 ansible all -m shell -a 'echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ansible' -K -k
  83. 51 ansible all -m shell -a 'cat /etc/shadow' -k
  84. 52 ssh-keygen
  85. 53 ssh-copy-id ansible1
  86. 54 ssh-copy-id ansible2
  87. 55 ansible all -m shell -a 'cat /etc/shadow'
  88. 56 history
  89. 57 ansible-doc -l | less
  90. 58 ansible-doc -l | wc
  91. 59 ansible-doc user
  92. 60 less /usr/lib/python3.6/site-packages/ansible/modules/system/user.py
  93. 61 ansible all -m ping
  94. 62 ansible all -m service -a "name=httpd state=started"
  95. 63 ansible all -m user -a "name=linda state=present"
  96. 64 ansible all -m command -a "useradd lisa"
  97. 65 history
  98. 66 ../countdown 15
  99. 67 ansible all -m package -a "name=namp state=present"
  100. 68 ansible all -m package -a "name=nmap state=present"
  101. 69 ansible all -m shell -a "rpm -qa | grep nmap"
  102. 70 cd ../lesson4/
  103. 71 l
  104. 72 ls
  105. 73 cat inventory
  106. 74 ls
  107. 75 vim vsftpd.yml
  108. 76 ansible-playbook vsftpd.yml
  109. 77*
  110. 78 vim vsftpd.yml
  111. 79 ansible ansible2.example.com -a "cat /var/ftp/pub/README"
  112. 80 ansible -v ansible2.example.com -a "cat /var/ftp/pub/README
  113. 81 history
  114. 82 ansible-playbook -v vsftpd.yml
  115. 83 ansible-playbook -vvvv vsftpd.yml
  116. 84 vim vsftpd.yml
  117. 85 ansible-playbook vsftpd.yml
  118. 86 vim vsftpd.yml
  119. 87 ansible-playbook vsftpd.yml
  120. 88 sudo yum provides */ansible-lint
  121. 89 sudo yum install -y python3-ansible-lint
  122. 90 ansible-lint vsftpd.yml
  123. 91 vim vsftpd.yml
  124. 92 ansible-lint --help | less
  125. 93 ansible-lint -L
  126. 94 ls
  127. 95 vim web-setup-and-test.yml
  128. 96 ansible-playbook web-setup-and-test.yml
  129. 97 vim web-setup-and-test.yml
  130. 98 ../countdown 17
  131. 99 vim es.yaml
  132. 100 ansible-playbook es.yaml
  133. 101 vim es.yaml
  134. 102 ansible-playbook es.yaml
  135. 103 vim es.yaml
  136. 104 ansible-playbook es.yaml
  137. 105 cd ../lesson5/
  138. 106 ls
  139. 107 vim user.yml
  140. 108 ansible-playbook user.yml
  141. 109 vim user.yml
  142. 110 ansible-playbook user.yml
  143. 111 vim inventory
  144. 112 ansible-playbook user.yml -e user=bob
  145. 113 vim user.yml
  146. 114 ansible-doc user
  147. 115 vim user.yml
  148. 116 ansible-playbook user.yml
  149. 117 vim user.yml
  150. 118 ansible-playbook user.yml
  151. 119 grep vars_file
  152. 120 grep vars_file *
  153. 121 mkdir vars
  154. 122 vim vars/users
  155. 123 vim user.yml
  156. 124 ansible-playbook user.yml
  157. 125 cd vars
  158. 126 mv users users.yml
  159. 127 cd ..
  160. 128 ansible-playbook user.yml
  161. 129 cat user.yml
  162. 130 ansible-playbook user.yml
  163. 131 vim user.yml
  164. 132 ansible-playbook user.yml
  165. 133 vim user.yml
  166. 134 ansible ansible1.example.com -m setup > facts.txt
  167. 135 less facts.txt
  168. 136 vim todayis.yml
  169. 137 less facts.txt
  170. 138 vim todayis.yml
  171. 139 ansible-playbook todayis.yml
  172. 140 vim todayis.yml
  173. 141* ansible-playbook todayis.yml
  174. 142 ansible-playbook todayis.yml
  175. 143 vim todayis.yml
  176. 144 ansible-playbook todayis.yml
  177. 145 vim todayis.yml
  178. 146 ansible-playbook todayis.yml
  179. 147 cat user.yml
  180. 148 cat todayis.yml
  181. 149 cat user.yml
  182. 150 history
  183.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement