From a9c6b8a0d39219fe12790c3e33ca8646b865e676 Mon Sep 17 00:00:00 2001 From: Olaf Bohlen <olbohlen@eenfach.de> Date: Tue, 25 Aug 2020 15:51:01 +0200 Subject: [PATCH] make role aware if a zone exists, also require python-27 as ansible modules for illumos are not python3 aware --- tasks/main.yml | 13 ++++++++++--- README.md | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d7ac6f3..333d0de 100644 --- a/README.md +++ b/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 ------- diff --git a/tasks/main.yml b/tasks/main.yml index 0d6f6d4..d71ab12 100644 --- a/tasks/main.yml +++ b/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" -- Gitblit v1.9.3