commit | author | age
|
9cdfbb
|
1 |
Role Name |
OB |
2 |
========= |
|
3 |
|
4b5fae
|
4 |
This role is supposed to deploy a new OpenIndiana Zone, with different settings. It will also allow to provision (multiple) ZFS filesystems, |
OB |
5 |
vnics and other related resources. |
9cdfbb
|
6 |
|
OB |
7 |
Requirements |
|
8 |
------------ |
|
9 |
|
4b5fae
|
10 |
This role obiously requires an OpenIndiana host system and following ansible modules: |
OB |
11 |
- solaris_zone |
|
12 |
- zfs |
|
13 |
- dladm_vnic |
9cdfbb
|
14 |
|
OB |
15 |
Role Variables |
|
16 |
-------------- |
|
17 |
|
4b5fae
|
18 |
You need to create a data structure called "oizone". The mandatory minimum is shown here: |
OB |
19 |
`` |
|
20 |
oizone: |
f40a7d
|
21 |
name: samplezone # name of the zone |
OB |
22 |
zoneroot: /export/zones/ # basedir for zoneroot |
|
23 |
brand: ipkg # which brand does the zone shall have |
|
24 |
#uninstall: true # if set to true, we will remove all we would create |
|
25 |
updateinventory: true # will put the new zone on the first line of your local inventory |
|
26 |
autoboot: "true" # shall the zone boot upon system boot |
|
27 |
iptype: exclusive # exclusive-ip or shared-ip zone |
|
28 |
filesystems: # list of filesystems, zoneroot is mandatory |
|
29 |
- path: rpool/export/zones/samplezone # dataset for zoneroot |
|
30 |
type: zoneroot # type can be: zoneroot, dataset (add zfs dataset), lofs (mount loopback), volume (map a device) |
|
31 |
zfscreate: true # shall the role create this for you? |
|
32 |
extra_zfs_properties: # extra zfs parameters, see ansible-doc zfs |
|
33 |
mountpoint: /export/zones/samplezone # ensure providing the correct mountpoint |
|
34 |
nics: # list of NICs for the zone |
|
35 |
- physical: oce0 # physical interface of the host |
|
36 |
logical: samplezone0 # name of the VNIC |
|
37 |
address: 172.18.1.199/22 # IPaddr/CIDR |
|
38 |
addrsuffix: v4 # address suffix for ipadm |
|
39 |
sysding: # needed parameters for the sysding(1M) file |
|
40 |
timezone: CET # which timezone shall the zone be in |
|
41 |
locale: de_DE.UTF-8 # any special locale? |
|
42 |
ip: # IP configuration |
|
43 |
routes: # list of routes |
|
44 |
- target: default # can be a CIDR or a host ip or "default" |
|
45 |
router: 172.18.0.200 # IP of the router |
|
46 |
dns: # DNS settings |
|
47 |
nameservers: # list of nameservers |
4b5fae
|
48 |
- 1.1.1.1 |
f40a7d
|
49 |
- 8.8.8.8 |
OB |
50 |
search: # DNS search list |
4b5fae
|
51 |
- example.com |
OB |
52 |
- openindiana.org |
f40a7d
|
53 |
domain: notebook.lan # local DNS domain |
OB |
54 |
users: # list of users to be created |
|
55 |
- name: root # root is mandatory, only specify |
|
56 |
hashedpassword: "$5$..." # hashedpassword here, everything else is pre-defined |
|
57 |
- name: localadm # new user "localadm" |
|
58 |
uid: 100 |
4b5fae
|
59 |
gid: 10 |
OB |
60 |
shell: /usr/bin/bash |
|
61 |
gecos: "Local Admin Account" |
|
62 |
home: /export/home/localadm |
f40a7d
|
63 |
sudoers: "localadm ALL=(ALL) NOPASSWD: ALL" # line to be added to sudoers |
OB |
64 |
hashedpassword: "$5$..." # hashed password |
|
65 |
authorized_key: "ssh-rsa ..." # ssh public key to be added to authorized_keys |
|
66 |
|
4b5fae
|
67 |
`` |
OB |
68 |
|
|
69 |
A set of all possible attributes is here: |
|
70 |
|
|
71 |
`` |
|
72 |
oizone: |
|
73 |
name: oizone |
f40a7d
|
74 |
updateinventory: true |
OB |
75 |
#uninstall: true |
4b5fae
|
76 |
zoneroot: /export/zones/ |
OB |
77 |
autoboot: "true" |
|
78 |
bootargs: # -v |
|
79 |
iptype: exclusive |
|
80 |
cpus: dedicated # dedicated or capped-cpu |
|
81 |
ncpus: 1 |
|
82 |
mem: capped-memory # or nil |
|
83 |
ram: 1G |
|
84 |
swap: 1G |
|
85 |
locked: 1G |
|
86 |
brand: ipkg |
|
87 |
filesystems: |
|
88 |
- path: rpool/export/zones/oizone |
|
89 |
type: zoneroot |
|
90 |
zfscreate: true |
f40a7d
|
91 |
extra_zfs_properties: |
4b5fae
|
92 |
refquota: 10G |
OB |
93 |
mountpoint: /export/zones/oizone |
|
94 |
- path: apppool/oizone/datavol1 |
|
95 |
type: volume |
|
96 |
zfscreate: true |
f40a7d
|
97 |
extra_zfs_properties: |
4b5fae
|
98 |
volsize: 5G |
OB |
99 |
- path: apppool/oizone/dataset1 |
|
100 |
type: dataset |
|
101 |
zfscreate: true |
f40a7d
|
102 |
extra_zfs_properties: |
4b5fae
|
103 |
quota: 2G |
OB |
104 |
- path: /disk1 |
|
105 |
type: lofs |
|
106 |
mountpoint: /hostdisks/disk1 |
|
107 |
zfscreate: false |
|
108 |
options: |
|
109 |
- ro |
|
110 |
- nodevices |
|
111 |
nics: |
|
112 |
- physical: ixgbe0 |
|
113 |
logical: oizoneint0 |
|
114 |
vlan: 100 |
|
115 |
address: dhcp # can be "dhcp" or a regular IP address |
|
116 |
addrsuffix: v4 # can be a string, interface0/suffix will be the ipadm create-addr |
|
117 |
kvm: |
|
118 |
vnc: "on" |
|
119 |
bootorder: cd |
|
120 |
sysding: |
|
121 |
timezone: UTC |
|
122 |
locale: C |
|
123 |
ip: |
|
124 |
routes: |
|
125 |
- target: default # can be a CIDR or a host ip or "default" |
|
126 |
router: 172.18.0.200 # IP of the router |
|
127 |
dns: |
|
128 |
nameservers: |
|
129 |
- 1.1.1.1 |
|
130 |
- 8.8.8.8 |
|
131 |
search: |
|
132 |
- example.com |
|
133 |
- openindiana.org |
|
134 |
domain: example.com |
|
135 |
users: |
|
136 |
- name: root |
|
137 |
hashedpassword: "$5$foobar...." |
|
138 |
- name: localadm |
|
139 |
uid: 100 |
|
140 |
gid: 10 |
|
141 |
shell: /usr/bin/bash |
|
142 |
gecos: "Local Admin Account" |
|
143 |
home: /export/home/localadm |
|
144 |
hashedpassword: "$5$barfoo...." |
|
145 |
`` |
9cdfbb
|
146 |
|
OB |
147 |
Dependencies |
|
148 |
------------ |
|
149 |
|
4b5fae
|
150 |
No dependencies to others roles so far. |
9cdfbb
|
151 |
|
OB |
152 |
Example Playbook |
|
153 |
---------------- |
|
154 |
|
|
155 |
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: |
|
156 |
|
|
157 |
- hosts: servers |
4b5fae
|
158 |
vars: |
OB |
159 |
- oizone: |
|
160 |
[... see above ..] |
9cdfbb
|
161 |
roles: |
4b5fae
|
162 |
- role: oi-zone |
9cdfbb
|
163 |
|
OB |
164 |
License |
|
165 |
------- |
|
166 |
|
4b5fae
|
167 |
BSD 3-Clause |
OB |
168 |
|
|
169 |
Copyright 2020 Olaf Bohlen |
|
170 |
|
|
171 |
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: |
|
172 |
|
|
173 |
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. |
|
174 |
|
|
175 |
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. |
|
176 |
|
|
177 |
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. |
|
178 |
|
|
179 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
9cdfbb
|
180 |
|
OB |
181 |
Author Information |
|
182 |
------------------ |
|
183 |
|
4b5fae
|
184 |
Olaf Bohlen <olbohlen@eenfach.de> |