Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ansible.cfg
- [defaults]
- host_key_checking = False
- # hosts
- all:
- hosts:
- 192.168.3.12:
- 192.168.3.13:
- 192.168.3.14:
- 192.168.3.17:
- 192.168.3.18:
- ansible_python_interpreter: /usr/local/bin/python2.7
- ansible_connection: paramiko
- 192.168.3.19:
- ansible_connection: local
- 192.168.13.11:
- 192.168.13.12:
- 192.168.13.13:
- 192.168.13.15:
- # playbook.yml
- ---
- - hosts: all
- vars:
- ansible_user: root
- ansible_ssh_pass: propersecure54
- remote_user: root
- tasks:
- - name: print debug
- debug:
- msg: "{{ ansible_facts['os_family'] }}"
- - name: create users
- user:
- name: "{{ item.name }}"
- password: "{{ item.pass | password_hash('sha256_crypt') }}"
- shell: "{{ '/bin/sh' if ansible_facts['os_family'] == 'FreeBSD' else '/bin/bash' }}"
- groups: "{{ 'sudo' if ansible_facts['os_family'] == 'Debian' else 'wheel' }}"
- loop:
- - { name: 'sam', pass: 'annualresist00dprk' }
- - { name: 'matt', pass: 'showersocial94czhu' }
- - { name: 'alfonzo', pass: 'cornermatter52fyre' }
- - name: fix ghostbsd env
- shell: cp -f /root/.xinitrc /home/{{ item }}
- loop: ['sam', 'matt', 'alfonzo']
- when: ansible_facts['os_family'] == 'FreeBSD'
- - name: chown su
- file:
- path: "{{ '/usr/bin/su' if ansible_facts['os_family'] == 'FreeBSD' else '/bin/su' }}"
- owner: root
- group: "{{ 'sudo' if ansible_facts['os_family'] == 'Debian' else 'wheel' }}"
- mode: '4754'
- - name: lock root
- user:
- name: root
- password: '!'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement