Ansible role to provision a zone on OpenIndiana
Olaf Bohlen
2020-08-25 e7b69ff4c5a13600b9fc1e20a93ff8fec4237bc7
commit | author | age
4b5fae 1 # created by oi-zone ansible role
47e9c1 2 setup_timezone {{ oizone['sysding']['timezone'] }}
OB 3 setup_locale {{ oizone['sysding']['locale'] }}
4
4b5fae 5 {% if oizone['sysding']['nfs4domain'] is defined and oizone['sysding']['nfs4domain'] | length %}
3ada41 6 setup_nfs4domain "{{ oizone['sysding']['nfs4domain'] }}"
OB 7 {% endif %}
8
9 {% for user in oizone['sysding']['users'] %}
10 {% if user['name'] != "root" %}
4b5fae 11 setup_user_account {{ user['name'] }} {{ user['uid'] }} {{ user['gid'] }} "{{ user['gecos'] }}" "{{ user['home'] }}" "{{ user['shell'] }}"
3ada41 12 mkdir -p {{ user['home'] }}
4b5fae 13 {% if user['authorized_key'] is defined %}
OB 14 mkdir -p "{{ user['home'] }}/.ssh"
15 echo "{{ user['authorized_key'] }}" > "{{ user['home'] }}/.ssh/authorized_keys"
16 {% endif %}
17 chown -R {{ user['name'] }}:{{ user['gid'] }} {{ user['home'] }}
3ada41 18 {% endif %}
e7b69f 19 {% if user['sudoers'] is defined %}
OB 20 echo "{{ user['sudoers'] }}" >/etc/sudoers.d/"{{ user['name'] }}"
21 {% endif %}
3ada41 22 setup_user_password {{ user['name'] }} '{{ user["hashedpassword"] }}'
OB 23 {% endfor %}
47e9c1 24
4b5fae 25 {% if oizone['iptype'] == "exclusive" %}
3ada41 26 {% for nic in oizone['nics'] %}
OB 27 setup_interface {{ nic['logical'] }} {{ nic['addrsuffix'] }} {{ nic['address'] }}
28 {% endfor %}
29 {% endif %}
30
31 {% for route in oizone['sysding']['ip']['routes'] %}
32 setup_route {{ route['target'] }} {{ route['router'] }}
33 {% endfor %}
34
4b5fae 35 {% if oizone['sysding']['ip']['dns'] is defined and oizone['sysding']['ip']['dns'] | length %}
47e9c1 36 setup_ns_dns "{{ oizone['sysding']['ip']['dns']['domain'] }}" "{{ oizone['sysding']['ip']['dns']['search'] | join(' ') }}" "{{ oizone['sysding']['ip']['dns']['nameservers'] | join(' ') }}"
3ada41 37 {% endif %}