Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- heat_template_version: 2013-05-23
- description: Creiamo due risorse Nova::Server. Una un server NFS, una un client NFS. Gli IP questa volta sono fissati per le VM per far in modo che l'NFS server sappia giĆ (senza intervento dell'utente) a quale client esportare via NFS.
- resources:
- my_volume:
- type: OS::Cinder::Volume
- properties:
- name: "myVolume"
- size: 3
- NFS_Sec_Group:
- type: OS::Neutron::SecurityGroup
- properties:
- description: "Access to NFS protocol"
- name: NFS-farm
- rules: [{"direction": ingress, "remote_ip_prefix": 192.168.1.0/24, "port_range_min": 111, "remote_mode": remote_ip_prefix, "port_range_max": 111, "protocol": TCP}, {"direction": ingress, "remote_ip_prefix": 192.168.1.0/24, "port_range_min": 2049, "remote_mode": remote_ip_prefix, "port_range_max": 2049, "protocol": TCP}, {"direction": ingress, "remote_ip_prefix": 192.168.1.0/24, "port_range_min": 32768, "remote_mode": remote_ip_prefix, "port_range_max": 32768, "protocol": TCP}, {"direction": ingress, "remote_ip_prefix": 192.168.1.0/24, "port_range_min": 44182, "remote_mode": remote_ip_prefix, "port_range_max": 44182, "protocol": TCP}, {"direction": ingress, "remote_ip_prefix": 192.168.1.0/24, "port_range_min": 54508, "remote_mode": remote_ip_prefix, "port_range_max": 54508, "protocol": TCP}, {"direction": ingress, "remote_ip_prefix": 192.168.1.0/24, "port_range_min": 111, "remote_mode": remote_ip_prefix, "port_range_max": 111, "protocol": UDP}, {"direction": ingress, "remote_ip_prefix": 192.168.1.0/24, "port_range_min": 2049, "remote_mode": remote_ip_prefix, "port_range_max": 2049, "protocol": UDP}, {"direction": ingress, "remote_ip_prefix": 192.168.1.0/24, "port_range_min": 32768, "remote_mode": remote_ip_prefix, "port_range_max": 32768, "protocol": UDP}, {"direction": ingress, "remote_ip_prefix": 192.168.1.0/24, "port_range_min": 32770, "remote_mode": remote_ip_prefix, "port_range_max": 32800, "protocol": UDP}]
- SSH_Sec_Group:
- type: OS::Neutron::SecurityGroup
- properties:
- description: "Access to SSH"
- name: SSH-farm
- rules: [{"direction": ingress, "remote_ip_prefix": 192.168.1.0/24, "port_range_min": 22, "remote_mode": remote_ip_prefix, "port_range_max": 22, "protocol": TCP}, {"direction": ingress, "remote_ip_prefix": 192.168.135.0/24, "port_range_min": 22, "remote_mode": remote_ip_prefix, "port_range_max": 22, "protocol": TCP}, {"direction": ingress, "remote_ip_prefix": 192.168.1.0/24, "remote_mode": remote_ip_prefix, "protocol": ICMP}, {"direction": ingress, "remote_ip_prefix": 192.168.135.0/24, "remote_mode": remote_ip_prefix, "protocol": ICMP} ]
- my_instance_1:
- type: OS::Nova::Server
- properties:
- name: "NFS-Server"
- key_name: KeyStudenteXY
- image: Ubuntu x86_64
- flavor: m1.small
- security_groups: [{Ref: NFS_Sec_Group}, {Ref: SSH_Sec_Group}]
- admin_pass: heattest1
- networks: [{"network": NetStudenteXY, "fixed_ip": 192.168.1.113}]
- user_data: |
- #!/bin/bash
- apt-get update
- apt-get install --yes nfs-common nfs-server
- cat << EOF >> /etc/exports
- /nfsexport 192.168.1.114(rw,insecure,sync,no_root_squash)
- EOF
- mkdir /nfsexport
- /etc/init.d/nfs-kernel-server start
- exportfs -av
- cat << EOF > /root/fdisk.sh
- n
- p
- 1
- wq
- EOF
- fdisk /dev/vdb < /root/fdisk.sh
- mkfs.ext4 /dev/vdb1
- mount /dev/vdb1 /nfsexport
- my_instance_2:
- type: OS::Nova::Server
- properties:
- name: "NFS-Client"
- key_name: KeyStudenteXY
- image: Ubuntu x86_64
- flavor: m1.small
- security_groups: [{Ref: NFS_Sec_Group}, {Ref: SSH_Sec_Group}]
- admin_pass: heattest2
- networks: [{"network": NetStudenteXY, "fixed_ip": 192.168.1.114}]
- user_data: |
- #!/bin/bash
- apt-get update
- apt-get install --yes nfs-common
- my_volume_attachment:
- type: OS::Cinder::VolumeAttachment
- properties:
- volume_id: { get_resource: my_volume }
- instance_uuid: { get_resource: my_instance_1 }
- my_fip:
- type: OS::Nova::FloatingIP
- properties:
- pool: External
- my_fip_association:
- type: OS::Nova::FloatingIPAssociation
- properties:
- floating_ip: { get_resource: my_fip }
- server_id: { get_resource: my_instance_2 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement