Ansible role to provision a zone on OpenIndiana
Olaf Bohlen
2020-08-25 e7b69ff4c5a13600b9fc1e20a93ff8fec4237bc7
fixes and include sudo
2 files modified
12 ■■■■■ changed files
tasks/main.yml 9 ●●●●● patch | view | raw | blame | history
templates/sysding.j2 3 ●●●●● patch | view | raw | blame | history
tasks/main.yml
@@ -2,6 +2,14 @@
# tasks file for oi-zone
- name: creating zone for you
  block:
    # jump into rescue if we want to uninstall
    - name: check for uninstall
      fail:
        msg: "uninstall is set to true, deleting resources"
      when:
        - oizone['uninstall'] is defined
        - oizone['uninstall']
    - name: create VNICs with VLAN
      dladm_vnic:
        name: "{{ item['logical'] }}"
@@ -30,6 +38,7 @@
        name: "{{ oizone['name'] }}"
        state: installed
        path: "{{ oizone['zoneroot'] }}/{{ oizone['name'] }}"
        install_options: "-e pkg:/security/sudo"
        config: >
          set brand={{ oizone['brand'] }};
          set autoboot={{ oizone['autoboot'] }};
templates/sysding.j2
@@ -16,6 +16,9 @@
{% endif %}
chown -R {{ user['name'] }}:{{ user['gid'] }} {{ user['home'] }}
{% endif %}
{% if user['sudoers'] is defined %}
echo "{{ user['sudoers'] }}" >/etc/sudoers.d/"{{ user['name'] }}"
{% endif %}
setup_user_password {{ user['name'] }} '{{ user["hashedpassword"] }}'
{% endfor %}