Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. # This describes what is deployed by this template.
  2. description: NFS server and clients deployed with Heat on Chameleon
  3.  
  4. # This defines the minimum Heat version required by this template.
  5. heat_template_version: 2015-10-15
  6.  
  7. # The resources section defines what OpenStack resources are to be deployed and
  8. # how they should be configured.
  9. resources:
  10. nfs_server_floating_ip:
  11. type: OS::Nova::FloatingIP
  12. properties:
  13. pool: ext-net
  14.  
  15. nfs_server:
  16. type: OS::Nova::Server
  17. properties:
  18. flavor: baremetal
  19. image: CC-CentOS7
  20. key_name: { get_param: key_name }
  21. networks:
  22. - network: sharednet1
  23. scheduler_hints: { reservation: { get_param: reservation_id } }
  24. user_data: |
  25. #!/bin/bash
  26. yum install -y nfs-utils
  27. mkdir -p /exports/example
  28. chown -R cc:cc /exports
  29. echo '/exports/example 10.140.80.0/22(rw,async) 10.40.0.0/23(rw,async)' >> /etc/exports
  30. systemctl enable rpcbind && systemctl start rpcbind
  31. systemctl enable nfs-server && systemctl start nfs-server
  32. iptables -F
  33. iptables -P INPUT DROP
  34. iptables -P FORWARD DROP
  35. iptables -P OUTPUT ACCEPT
  36. iptables -A INPUT -i lo -j ACCEPT
  37. iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
  38. iptables -A INPUT -p tcp --dport 22 -j ACCEPT
  39. iptables -A INPUT -p tcp --dport 111 -j ACCEPT
  40. iptables -A INPUT -p udp --dport 111 -j ACCEPT
  41. iptables -A INPUT -p tcp --dport 2049 -j ACCEPT
  42. iptables -A INPUT -p udp --dport 2049 -j ACCEPT
  43. iptables -A INPUT -p icmp -j ACCEPT
  44. service iptables save
  45.  
  46. nfs_server_ip_association:
  47. type: OS::Nova::FloatingIPAssociation
  48. properties:
  49. floating_ip: { get_resource: nfs_server_floating_ip }
  50. server_id: { get_resource: nfs_server }
  51.  
  52. nfs_clients:
  53. type: OS::Heat::ResourceGroup
  54. properties:
  55. count: { get_param: nfs_client_count }
  56. resource_def:
  57. type: OS::Nova::Server
  58. properties:
  59. flavor: baremetal
  60. image: CC-CentOS7
  61. key_name: { get_param: key_name }
  62. networks:
  63. - network: sharednet1
  64. scheduler_hints: { reservation: { get_param: reservation_id } }
  65. user_data:
  66. str_replace:
  67. template: |
  68. #!/bin/bash
  69. yum install -y nfs-utils
  70. echo "$nfs_server_ip:/exports/example /mnt/ nfs" > /etc/fstab
  71. mount -a
  72. params:
  73. $nfs_server_ip: { get_attr: [nfs_server, first_address] }
  74.  
  75. # The parameters section gathers configuration from the user.
  76. parameters:
  77. nfs_client_count:
  78. type: number
  79. description: Number of NFS client instances
  80. default: 1
  81. constraints:
  82. - range: { min: 1 }
  83. description: There must be at least one client.
  84. key_name:
  85. type: string
  86. description: Name of a KeyPair to enable SSH access to the instance
  87. default: default
  88. constraints:
  89. - custom_constraint: nova.keypair
  90. reservation_id:
  91. type: string
  92. description: ID of the Blazar reservation to use for launching instances.
  93. constraints:
  94. - custom_constraint: blazar.reservation
  95.  
  96. outputs:
  97. server_ip:
  98. description: Public IP address of the NFS server
  99. value: { get_attr: [nfs_server_floating_ip, ip] }
  100. client_ips:
  101. description: Private IP addresses of the NFS clients
  102. value: { get_attr: [nfs_clients, first_address] }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement