Ansible role to provision a zone on OpenIndiana
Olaf Bohlen
2020-08-25 a9c6b8a0d39219fe12790c3e33ca8646b865e676
make role aware if a zone exists, also require python-27 as ansible modules for illumos are not python3 aware
2 files modified
16 ■■■■ changed files
README.md 3 ●●●● patch | view | raw | blame | history
tasks/main.yml 13 ●●●● patch | view | raw | blame | history
README.md
@@ -153,13 +153,14 @@
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
```
    - hosts: servers
      vars:
        - oizone:
        [... see above ..]
      roles:
         - role: oi-zone
```
License
-------
tasks/main.yml
@@ -32,13 +32,19 @@
        extra_zfs_properties: "{{ item['extra_zfs_properties'] }}"
      loop: "{{ oizone['filesystems'] }}"
      when: item['zfscreate']
    - name: is the zone already there?
      shell: zoneadm -z {{ oizone['name'] }} list
      register: zoneout
      changed_when: false
      ignore_errors: true
    - name: set up VM zones for master
      solaris_zone:
        name: "{{ oizone['name'] }}"
        state: installed
        path: "{{ oizone['zoneroot'] }}/{{ oizone['name'] }}"
        install_options: "-e pkg:/security/sudo"
        install_options: "-e pkg:/security/sudo -e runtime/python-27"
        config: >
          set brand={{ oizone['brand'] }};
          set autoboot={{ oizone['autoboot'] }};
@@ -114,7 +120,8 @@
          set value="{{ oizone['ram'] }}";
          end;
          {% endif %}
      when: zoneout.rc == 1
    - name: create a sysding.conf
      template:
        dest: "{{ oizone['zoneroot'] }}/{{ oizone['name'] }}/root/etc/sysding.conf"