Last active
September 14, 2016 09:22
-
-
Save Toasterson/7d520f5869480e1bc014145f44c42e0c to your computer and use it in GitHub Desktop.
Solaris Zone Ansible Sample with sysding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tasks: | |
- name: Zone Dataset | |
zfs: "name=rpool/SHARED/zones/{{ zone_name }} state=present mountpoint={{ zone_path }}" | |
- name: Zone VNIC | |
dladm_vnic: "name={{ zone_vnic }} link=stub0 state=present" | |
- name: Zone creation | |
solaris_zone: | |
name: "{{ zone_name }}" | |
state: present | |
path: "{{ zone_path }}" | |
root_password: "$PWDHASH" | |
config: 'set autoboot={{ zone_autoboot }}; set ip-type=exclusive; add net; set physical={{ zone_vnic }}; end' | |
- name: Zone Configuration | |
template: src=templates/sysding.conf.j2 dest=/etc/sysding.conf backup=no owner=root group=root | |
- name: NAT Configuration | |
shell: "echo 'rdr {{ host_int }} 0.0.0.0/0 port {{ zone_nat_port }} -> {{ zone_ip }} port 22 tcp' >> /etc/ipf/ipnat.conf" | |
notify: | |
- reload ipnat | |
- name: Zone Boot | |
solaris_zone: | |
name: "{{ zone_name }}" | |
state: started | |
path: "{{ zone_path }}" | |
handlers: | |
- name: reload ipnat | |
shell: ipnat -FC -f /etc/ipf/ipnat.conf | |
become: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ksh | |
setup_timezone Europe/Zurich | |
setup_locale en_US.UTF-8 | |
# setup_interface accepts nic names or the "PRIMARY" alias for the first NIC | |
setup_interface PRIMARY v4 {{ zone_ip }} | |
setup_ns_dns "{{ zone_domain }}" "{{ zone_search }}" "{{ zone_dns_servers }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment