Skip to content

Instantly share code, notes, and snippets.

@Toasterson
Last active September 14, 2016 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Toasterson/7d520f5869480e1bc014145f44c42e0c to your computer and use it in GitHub Desktop.
Save Toasterson/7d520f5869480e1bc014145f44c42e0c to your computer and use it in GitHub Desktop.
Solaris Zone Ansible Sample with sysding
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
#!/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