Advertisement
Guest User

Untitled

a guest
Apr 7th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. # ansible.cfg
  2.  
  3. [defaults]
  4. host_key_checking = False
  5.  
  6. # hosts
  7.  
  8. all:
  9. hosts:
  10. 192.168.3.12:
  11. 192.168.3.13:
  12. 192.168.3.14:
  13. 192.168.3.17:
  14. 192.168.3.18:
  15. ansible_python_interpreter: /usr/local/bin/python2.7
  16. ansible_connection: paramiko
  17. 192.168.3.19:
  18. ansible_connection: local
  19. 192.168.13.11:
  20. 192.168.13.12:
  21. 192.168.13.13:
  22. 192.168.13.15:
  23.  
  24.  
  25. # playbook.yml
  26.  
  27. ---
  28. - hosts: all
  29. vars:
  30. ansible_user: root
  31. ansible_ssh_pass: propersecure54
  32. remote_user: root
  33. tasks:
  34. - name: print debug
  35. debug:
  36. msg: "{{ ansible_facts['os_family'] }}"
  37. - name: create users
  38. user:
  39. name: "{{ item.name }}"
  40. password: "{{ item.pass | password_hash('sha256_crypt') }}"
  41. shell: "{{ '/bin/sh' if ansible_facts['os_family'] == 'FreeBSD' else '/bin/bash' }}"
  42. groups: "{{ 'sudo' if ansible_facts['os_family'] == 'Debian' else 'wheel' }}"
  43. loop:
  44. - { name: 'sam', pass: 'annualresist00dprk' }
  45. - { name: 'matt', pass: 'showersocial94czhu' }
  46. - { name: 'alfonzo', pass: 'cornermatter52fyre' }
  47. - name: fix ghostbsd env
  48. shell: cp -f /root/.xinitrc /home/{{ item }}
  49. loop: ['sam', 'matt', 'alfonzo']
  50. when: ansible_facts['os_family'] == 'FreeBSD'
  51. - name: chown su
  52. file:
  53. path: "{{ '/usr/bin/su' if ansible_facts['os_family'] == 'FreeBSD' else '/bin/su' }}"
  54. owner: root
  55. group: "{{ 'sudo' if ansible_facts['os_family'] == 'Debian' else 'wheel' }}"
  56. mode: '4754'
  57. - name: lock root
  58. user:
  59. name: root
  60. password: '!'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement