Advertisement
marcoverl

os-c7-htcondor.radl

Oct 6th, 2016
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.20 KB | None | 0 0
  1. network private ( provider_id = 'GRID-CERTIFICATION-wan' )
  2. network public ( outports = '9618/tcp,9618/udp,8899/tcp' and outbound = 'yes' and provider_id = 'GRID-CERTIFICATION-wan' and pool_name = 'Ext' )
  3.  
  4. system wn (
  5. disk.0.os.credentials.username = 'centos' and
  6. instance_type = 'cldareapd.medium' and
  7. net_interface.0.connection = 'private' and
  8. disk.0.os.name = 'linux' and
  9. #Image for CentOS 7
  10. disk.0.image.url = 'ost://cloud-areapd.pd.infn.it/7544a870-90a6-4409-9a7d-5b376c278688'
  11. )
  12.  
  13. system front (
  14. net_interface.1.dns_name = 'htcondorm' and
  15. disk.0.os.credentials.username = 'centos' and
  16. queue_system = 'htcondor' and
  17. cpu.count >= 1 and
  18. net_interface.1.connection = 'private' and
  19. instance_type = 'cldareapd.small' and
  20. net_interface.0.connection = 'public' and
  21. memory.size >= 512m and
  22. disk.0.os.name = 'linux' and
  23. #Image for CentOS 7
  24. disk.0.image.url = 'ost://cloud-areapd.pd.infn.it/7544a870-90a6-4409-9a7d-5b376c278688'
  25. )
  26.  
  27. configure munge_repo_front (
  28. @begin
  29.  
  30. - apt: name=munge update_cache=yes cache_valid_time=3600
  31. when: ansible_os_family == "Debian"
  32. - when: ansible_os_family == "RedHat"
  33. yum: name=munge
  34. - shell: echo -n "foo" | sha512sum | cut -d' ' -f1 >/etc/munge/munge.key
  35. - shell: chown munge.munge /etc/munge/munge.key
  36. - shell: chmod 400 /etc/munge/munge.key
  37. - file: path=/var/log/munge state=directory mode=0700
  38. - file: path=/var/log state=directory mode=0755
  39. - service: name=munge state=restarted
  40.  
  41.  
  42. @end
  43. )
  44. configure sudo_copy (
  45. @begin
  46.  
  47. - local_action: command sudo cp {{src}} /tmp/._sudo_cp_{{ src | basename }}
  48. with_items: loop|default([0])
  49. - local_action: command sudo chmod +r /tmp/._sudo_cp_{{ src | basename }}
  50. with_items: loop|default([0])
  51. - copy:
  52. dest: '{{ dest }}'
  53. group: '{{ group | default(None) }}'
  54. mode: '{{ mode | default(None) }}'
  55. owner: '{{ owner | default(None) }}'
  56. src: /tmp/._sudo_cp_{{ src | basename }}
  57. with_items: loop|default([0])
  58.  
  59.  
  60. @end
  61. )
  62. configure wn (
  63. @begin
  64.  
  65. - tasks:
  66. - include_vars: '{{item}}'
  67. with_first_found:
  68. - '{{ ansible_os_family }}.yml'
  69. - RedHat.yml
  70. - name: Create User {{item.name}}
  71. user: name={{item.name}} password={{item.password}} shell=/bin/bash
  72. with_items: USERS
  73. - authorized_key: user={{item.name}} key="{{ lookup('file', '/tmp/' + item.name + '_id_rsa.pub') }}"
  74. name: Add the authorized_key to the user {{item.name}}
  75. with_items: USERS
  76. - include: sudo_copy.yml src=/home/{{item.name}}/.ssh/id_rsa.pub dest=/home/{{item.name}}/.ssh/id_rsa.pub
  77. owner={{item.name}} group={{item.name}} mode=0644 loop={{USERS}}
  78. name: Copy the id_rsa.pub file to the user
  79. - include: sudo_copy.yml src=/home/{{item.name}}/.ssh/id_rsa dest=/home/{{item.name}}/.ssh/id_rsa
  80. owner={{item.name}} group={{item.name}} mode=0600 loop={{USERS}}
  81. name: Copy the id_rsa file to the user
  82. - template: src=utils/templates/ssh_known_hosts.conf dest=/etc/ssh/ssh_known_hosts
  83. - name: create epel.repo
  84. template: src=utils/templates/epel-es.repo dest=/etc/yum.repos.d/epel.repo
  85. when: ansible_os_family == "RedHat"
  86. - name: install wget
  87. yum: name=wget
  88. when: ansible_os_family == "RedHat"
  89. - name: create HTCondor repo
  90. command: wget http://research.cs.wisc.edu/htcondor/yum/repo.d/htcondor-stable-rhel7.repo chdir=/etc/yum.repos.d creates=/etc/yum.repos.d/htcondor-stable-rhel7.repo
  91. when: ansible_os_family == "RedHat"
  92. - name: install HTCondor
  93. yum: name=condor
  94. when: ansible_os_family == "RedHat"
  95. - copy:
  96. content: '## Where have you installed the bin, sbin and lib condor directories?
  97.  
  98. RELEASE_DIR = /usr
  99.  
  100. ## Where is the local condor directory for each host? This is where the local config file(s), logs and
  101. ## spool/execute directories are located. this is the default for Linux and Unix systems.
  102.  
  103. LOCAL_DIR = /var
  104.  
  105. ## Pathnames
  106.  
  107. RUN = $(LOCAL_DIR)/run/condor
  108.  
  109. LOG = $(LOCAL_DIR)/log/condor
  110.  
  111. SPOOL = $(LOCAL_DIR)/lib/condor/spool
  112.  
  113. EXECUTE = $(LOCAL_DIR)/lib/condor/execute
  114.  
  115. ## Central Manager
  116.  
  117. CONDOR_HOST = htcondorm.localdomain
  118.  
  119. ALLOW_WRITE = $(CONDOR_HOST)
  120.  
  121. ALLOW_ADMINISTRATOR = $(CONDOR_HOST)
  122.  
  123. ## Daemons running (specify machine type)
  124.  
  125. #DAEMON_LIST = MASTER,COLLECTOR, NEGOTIATOR, SCHEDD, STARTD
  126.  
  127. DAEMON_LIST = MASTER,STARTD
  128.  
  129. '
  130. dest: '/etc/condor/condor_config'
  131. group: root
  132. mode: 0644
  133. owner: root
  134. name: Create the condor_config file
  135. - copy:
  136. content: '## Always run jobs
  137.  
  138. START = True
  139.  
  140. SUSPEND = False
  141.  
  142. CONTINUE = True
  143.  
  144. PREEMPT = False
  145.  
  146. KILL = False
  147. '
  148. dest: '/etc/condor/condor_config.local'
  149. mode: 0644
  150. owner: root
  151. name: Create the condor_config.local file
  152. - service: name={{CONDOR_SERVICE}} state=started pattern=/usr/sbin/condor_master
  153. vars:
  154. USERS:
  155. - name: user1
  156. password: $6$Ehg4GHQT5y$6ZCTLffp.epiNEhS1M3ZB.P6Kii1wELySe/DCwUInGt8r7zgdAHfHw66DuPwpS6pfOiZ9PS/KaTiBKjoCn23t0
  157. - name: dteam001
  158. password: $6$Ehg4GHQT5y$6ZCTLffp.epiNEhS1M3ZB.P6Kii1wELySe/DCwUInGt8r7zgdAHfHw66DuPwpS6pfOiZ9PS/KaTiBKjoCn23t0
  159. @end
  160. )
  161. configure RedHat (
  162. @begin
  163.  
  164. CONDOR_SERVICE: condor
  165.  
  166. @end
  167. )
  168. configure front (
  169. @begin
  170.  
  171. - tasks:
  172. - include_vars: '{{item}}'
  173. with_first_found:
  174. - '{{ ansible_os_family }}.yml'
  175. - RedHat.yml
  176. - command: hostname htcondorm
  177. - name: create epel.repo
  178. template: src=utils/templates/epel-es.repo dest=/etc/yum.repos.d/epel.repo
  179. when: ansible_os_family == "RedHat"
  180. - user: name={{item.name}} password={{item.password}} generate_ssh_key=yes shell=/bin/bash
  181. with_items: USERS
  182. - local_action: command cp /home/{{item.name}}/.ssh/id_rsa.pub /tmp/{{item.name}}_id_rsa.pub
  183. creates=/tmp/{{item.name}}_id_rsa.pub
  184. with_items: USERS
  185. - authorized_key: user={{item.name}} key="{{ lookup('file', '/tmp/' + item.name + '_id_rsa.pub') }}"
  186. name: Add the authorized_key to the user {{item.name}}
  187. with_items: USERS
  188. - template: src=utils/templates/ssh_known_hosts.conf dest=/etc/ssh/ssh_known_hosts
  189. - name: install wget
  190. yum: name=wget
  191. when: ansible_os_family == "RedHat"
  192. - name: create HTCondor repo
  193. command: wget http://research.cs.wisc.edu/htcondor/yum/repo.d/htcondor-stable-rhel7.repo chdir=/etc/yum.repos.d creates=/etc/yum.repos.d/htcondor-stable-rhel7.repo
  194. when: ansible_os_family == "RedHat"
  195. - name: install HTCondor
  196. yum: name=condor
  197. when: ansible_os_family == "RedHat"
  198. - copy:
  199. content: '## Where have you installed the bin, sbin and lib condor directories?
  200.  
  201. RELEASE_DIR = /usr
  202.  
  203. ## Where is the local condor directory for each host? This is where the local config file(s), logs and
  204. ## spool/execute directories are located. this is the default for Linux and Unix systems.
  205.  
  206. LOCAL_DIR = /var
  207.  
  208. ## Pathnames
  209.  
  210. RUN = $(LOCAL_DIR)/run/condor
  211.  
  212. LOG = $(LOCAL_DIR)/log/condor
  213.  
  214. SPOOL = $(LOCAL_DIR)/lib/condor/spool
  215.  
  216. EXECUTE = $(LOCAL_DIR)/lib/condor/execute
  217.  
  218. ## Central Manager
  219.  
  220. CONDOR_HOST = htcondorm.localdomain
  221.  
  222. ALLOW_WRITE = *.localdomain
  223.  
  224. ALLOW_ADMINISTRATOR = $(ALLOW_ADMINISTRATOR), $(CONDOR_HOST)
  225.  
  226. COLLECTOR_NAME = INFN-PD
  227.  
  228. COLLECTOR_UPDATE_INTERVAL = 60
  229.  
  230. MAX_HISTORY_LOG = 83886080
  231.  
  232. MAX_HISTORY_ROTATIONS = 60
  233.  
  234. ## Daemons running (specify machine type)
  235.  
  236. #DAEMON_LIST = MASTER,COLLECTOR, NEGOTIATOR, SCHEDD, STARTD
  237.  
  238. DAEMON_LIST = MASTER,COLLECTOR,NEGOTIATOR,SCHEDD,STARTD
  239.  
  240. '
  241. dest: '/etc/condor/condor_config'
  242. group: root
  243. mode: 0644
  244. owner: root
  245. name: Create the condor_config file
  246. - copy:
  247. content: '## Always run jobs
  248.  
  249. START = True
  250.  
  251. SUSPEND = False
  252.  
  253. CONTINUE = True
  254.  
  255. PREEMPT = False
  256.  
  257. KILL = False
  258.  
  259. '
  260. dest: '/etc/condor/condor_config.local'
  261. mode: 0644
  262. owner: root
  263. name: Create the condor_config.local file
  264. - copy:
  265. content: 'universe = vanilla
  266.  
  267. executable = test.sh
  268.  
  269. output = test.out.$(process)
  270.  
  271. should_transfer_files = if_needed
  272.  
  273. when_to_transfer_output = on_exit
  274.  
  275. queue 10
  276.  
  277. '
  278. dest: '/home/centos/test.job'
  279. mode: 0755
  280. owner: centos
  281. name: Create the test job
  282. - copy:
  283. content: '#!/bin/bash
  284.  
  285. hostname
  286.  
  287. date
  288.  
  289. sleep 10
  290. '
  291. dest: '/home/centos/test.sh'
  292. mode: 0755
  293. owner: centos
  294. name: Create the test script
  295. - service: name={{CONDOR_SERVICE}} state=started pattern=/usr/sbin/condor_master
  296. vars:
  297. USERS:
  298. - name: user1
  299. password: $6$Ehg4GHQT5y$6ZCTLffp.epiNEhS1M3ZB.P6Kii1wELySe/DCwUInGt8r7zgdAHfHw66DuPwpS6pfOiZ9PS/KaTiBKjoCn23t0
  300. - name: dteam001
  301. password: $6$Ehg4GHQT5y$6ZCTLffp.epiNEhS1M3ZB.P6Kii1wELySe/DCwUInGt8r7zgdAHfHw66DuPwpS6pfOiZ9PS/KaTiBKjoCn23t0
  302. NNODES: '@input.NumNodes@'
  303.  
  304. @end
  305. )
  306. configure munge_repo_wn (
  307. @begin
  308.  
  309. - apt: name=munge update_cache=yes cache_valid_time=3600
  310. when: ansible_os_family == "Debian"
  311. - when: ansible_os_family == "RedHat"
  312. yum: name=munge
  313. - shell: echo -n "foo" | sha512sum | cut -d' ' -f1 >/etc/munge/munge.key
  314. - shell: chown munge.munge /etc/munge/munge.key
  315. - shell: chmod 400 /etc/munge/munge.key
  316. - file: path=/var/log/munge state=directory mode=0700
  317. - file: path=/var/log state=directory mode=0755
  318. - service: name=munge state=restarted
  319.  
  320.  
  321. @end
  322. )
  323. configure Debian (
  324. @begin
  325.  
  326. CONDOR_SERVICE: condor
  327.  
  328. @end
  329. )
  330.  
  331. contextualize (
  332. system front configure front step 1
  333. system wn configure wn step 2
  334. )
  335.  
  336. deploy front 1 ost
  337. deploy wn @input.NumNodes@ ost
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement