Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- network private ( provider_id = 'GRID-CERTIFICATION-wan' )
- network public ( outports = '9618/tcp,9618/udp,8899/tcp' and outbound = 'yes' and provider_id = 'GRID-CERTIFICATION-wan' and pool_name = 'Ext' )
- system wn (
- disk.0.os.credentials.username = 'centos' and
- instance_type = 'cldareapd.medium' and
- net_interface.0.connection = 'private' and
- disk.0.os.name = 'linux' and
- #Image for CentOS 7
- disk.0.image.url = 'ost://cloud-areapd.pd.infn.it/7544a870-90a6-4409-9a7d-5b376c278688'
- )
- system front (
- net_interface.1.dns_name = 'htcondorm' and
- disk.0.os.credentials.username = 'centos' and
- queue_system = 'htcondor' and
- cpu.count >= 1 and
- net_interface.1.connection = 'private' and
- instance_type = 'cldareapd.small' and
- net_interface.0.connection = 'public' and
- memory.size >= 512m and
- disk.0.os.name = 'linux' and
- #Image for CentOS 7
- disk.0.image.url = 'ost://cloud-areapd.pd.infn.it/7544a870-90a6-4409-9a7d-5b376c278688'
- )
- configure munge_repo_front (
- @begin
- - apt: name=munge update_cache=yes cache_valid_time=3600
- when: ansible_os_family == "Debian"
- - when: ansible_os_family == "RedHat"
- yum: name=munge
- - shell: echo -n "foo" | sha512sum | cut -d' ' -f1 >/etc/munge/munge.key
- - shell: chown munge.munge /etc/munge/munge.key
- - shell: chmod 400 /etc/munge/munge.key
- - file: path=/var/log/munge state=directory mode=0700
- - file: path=/var/log state=directory mode=0755
- - service: name=munge state=restarted
- @end
- )
- configure sudo_copy (
- @begin
- - local_action: command sudo cp {{src}} /tmp/._sudo_cp_{{ src | basename }}
- with_items: loop|default([0])
- - local_action: command sudo chmod +r /tmp/._sudo_cp_{{ src | basename }}
- with_items: loop|default([0])
- - copy:
- dest: '{{ dest }}'
- group: '{{ group | default(None) }}'
- mode: '{{ mode | default(None) }}'
- owner: '{{ owner | default(None) }}'
- src: /tmp/._sudo_cp_{{ src | basename }}
- with_items: loop|default([0])
- @end
- )
- configure wn (
- @begin
- - tasks:
- - include_vars: '{{item}}'
- with_first_found:
- - '{{ ansible_os_family }}.yml'
- - RedHat.yml
- - name: Create User {{item.name}}
- user: name={{item.name}} password={{item.password}} shell=/bin/bash
- with_items: USERS
- - authorized_key: user={{item.name}} key="{{ lookup('file', '/tmp/' + item.name + '_id_rsa.pub') }}"
- name: Add the authorized_key to the user {{item.name}}
- with_items: USERS
- - include: sudo_copy.yml src=/home/{{item.name}}/.ssh/id_rsa.pub dest=/home/{{item.name}}/.ssh/id_rsa.pub
- owner={{item.name}} group={{item.name}} mode=0644 loop={{USERS}}
- name: Copy the id_rsa.pub file to the user
- - include: sudo_copy.yml src=/home/{{item.name}}/.ssh/id_rsa dest=/home/{{item.name}}/.ssh/id_rsa
- owner={{item.name}} group={{item.name}} mode=0600 loop={{USERS}}
- name: Copy the id_rsa file to the user
- - template: src=utils/templates/ssh_known_hosts.conf dest=/etc/ssh/ssh_known_hosts
- - name: create epel.repo
- template: src=utils/templates/epel-es.repo dest=/etc/yum.repos.d/epel.repo
- when: ansible_os_family == "RedHat"
- - name: install wget
- yum: name=wget
- when: ansible_os_family == "RedHat"
- - name: create HTCondor repo
- 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
- when: ansible_os_family == "RedHat"
- - name: install HTCondor
- yum: name=condor
- when: ansible_os_family == "RedHat"
- - copy:
- content: '## Where have you installed the bin, sbin and lib condor directories?
- RELEASE_DIR = /usr
- ## Where is the local condor directory for each host? This is where the local config file(s), logs and
- ## spool/execute directories are located. this is the default for Linux and Unix systems.
- LOCAL_DIR = /var
- ## Pathnames
- RUN = $(LOCAL_DIR)/run/condor
- LOG = $(LOCAL_DIR)/log/condor
- SPOOL = $(LOCAL_DIR)/lib/condor/spool
- EXECUTE = $(LOCAL_DIR)/lib/condor/execute
- ## Central Manager
- CONDOR_HOST = htcondorm.localdomain
- ALLOW_WRITE = $(CONDOR_HOST)
- ALLOW_ADMINISTRATOR = $(CONDOR_HOST)
- ## Daemons running (specify machine type)
- #DAEMON_LIST = MASTER,COLLECTOR, NEGOTIATOR, SCHEDD, STARTD
- DAEMON_LIST = MASTER,STARTD
- '
- dest: '/etc/condor/condor_config'
- group: root
- mode: 0644
- owner: root
- name: Create the condor_config file
- - copy:
- content: '## Always run jobs
- START = True
- SUSPEND = False
- CONTINUE = True
- PREEMPT = False
- KILL = False
- '
- dest: '/etc/condor/condor_config.local'
- mode: 0644
- owner: root
- name: Create the condor_config.local file
- - service: name={{CONDOR_SERVICE}} state=started pattern=/usr/sbin/condor_master
- vars:
- USERS:
- - name: user1
- password: $6$Ehg4GHQT5y$6ZCTLffp.epiNEhS1M3ZB.P6Kii1wELySe/DCwUInGt8r7zgdAHfHw66DuPwpS6pfOiZ9PS/KaTiBKjoCn23t0
- - name: dteam001
- password: $6$Ehg4GHQT5y$6ZCTLffp.epiNEhS1M3ZB.P6Kii1wELySe/DCwUInGt8r7zgdAHfHw66DuPwpS6pfOiZ9PS/KaTiBKjoCn23t0
- @end
- )
- configure RedHat (
- @begin
- CONDOR_SERVICE: condor
- @end
- )
- configure front (
- @begin
- - tasks:
- - include_vars: '{{item}}'
- with_first_found:
- - '{{ ansible_os_family }}.yml'
- - RedHat.yml
- - command: hostname htcondorm
- - name: create epel.repo
- template: src=utils/templates/epel-es.repo dest=/etc/yum.repos.d/epel.repo
- when: ansible_os_family == "RedHat"
- - user: name={{item.name}} password={{item.password}} generate_ssh_key=yes shell=/bin/bash
- with_items: USERS
- - local_action: command cp /home/{{item.name}}/.ssh/id_rsa.pub /tmp/{{item.name}}_id_rsa.pub
- creates=/tmp/{{item.name}}_id_rsa.pub
- with_items: USERS
- - authorized_key: user={{item.name}} key="{{ lookup('file', '/tmp/' + item.name + '_id_rsa.pub') }}"
- name: Add the authorized_key to the user {{item.name}}
- with_items: USERS
- - template: src=utils/templates/ssh_known_hosts.conf dest=/etc/ssh/ssh_known_hosts
- - name: install wget
- yum: name=wget
- when: ansible_os_family == "RedHat"
- - name: create HTCondor repo
- 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
- when: ansible_os_family == "RedHat"
- - name: install HTCondor
- yum: name=condor
- when: ansible_os_family == "RedHat"
- - copy:
- content: '## Where have you installed the bin, sbin and lib condor directories?
- RELEASE_DIR = /usr
- ## Where is the local condor directory for each host? This is where the local config file(s), logs and
- ## spool/execute directories are located. this is the default for Linux and Unix systems.
- LOCAL_DIR = /var
- ## Pathnames
- RUN = $(LOCAL_DIR)/run/condor
- LOG = $(LOCAL_DIR)/log/condor
- SPOOL = $(LOCAL_DIR)/lib/condor/spool
- EXECUTE = $(LOCAL_DIR)/lib/condor/execute
- ## Central Manager
- CONDOR_HOST = htcondorm.localdomain
- ALLOW_WRITE = *.localdomain
- ALLOW_ADMINISTRATOR = $(ALLOW_ADMINISTRATOR), $(CONDOR_HOST)
- COLLECTOR_NAME = INFN-PD
- COLLECTOR_UPDATE_INTERVAL = 60
- MAX_HISTORY_LOG = 83886080
- MAX_HISTORY_ROTATIONS = 60
- ## Daemons running (specify machine type)
- #DAEMON_LIST = MASTER,COLLECTOR, NEGOTIATOR, SCHEDD, STARTD
- DAEMON_LIST = MASTER,COLLECTOR,NEGOTIATOR,SCHEDD,STARTD
- '
- dest: '/etc/condor/condor_config'
- group: root
- mode: 0644
- owner: root
- name: Create the condor_config file
- - copy:
- content: '## Always run jobs
- START = True
- SUSPEND = False
- CONTINUE = True
- PREEMPT = False
- KILL = False
- '
- dest: '/etc/condor/condor_config.local'
- mode: 0644
- owner: root
- name: Create the condor_config.local file
- - copy:
- content: 'universe = vanilla
- executable = test.sh
- output = test.out.$(process)
- should_transfer_files = if_needed
- when_to_transfer_output = on_exit
- queue 10
- '
- dest: '/home/centos/test.job'
- mode: 0755
- owner: centos
- name: Create the test job
- - copy:
- content: '#!/bin/bash
- hostname
- date
- sleep 10
- '
- dest: '/home/centos/test.sh'
- mode: 0755
- owner: centos
- name: Create the test script
- - service: name={{CONDOR_SERVICE}} state=started pattern=/usr/sbin/condor_master
- vars:
- USERS:
- - name: user1
- password: $6$Ehg4GHQT5y$6ZCTLffp.epiNEhS1M3ZB.P6Kii1wELySe/DCwUInGt8r7zgdAHfHw66DuPwpS6pfOiZ9PS/KaTiBKjoCn23t0
- - name: dteam001
- password: $6$Ehg4GHQT5y$6ZCTLffp.epiNEhS1M3ZB.P6Kii1wELySe/DCwUInGt8r7zgdAHfHw66DuPwpS6pfOiZ9PS/KaTiBKjoCn23t0
- NNODES: '@input.NumNodes@'
- @end
- )
- configure munge_repo_wn (
- @begin
- - apt: name=munge update_cache=yes cache_valid_time=3600
- when: ansible_os_family == "Debian"
- - when: ansible_os_family == "RedHat"
- yum: name=munge
- - shell: echo -n "foo" | sha512sum | cut -d' ' -f1 >/etc/munge/munge.key
- - shell: chown munge.munge /etc/munge/munge.key
- - shell: chmod 400 /etc/munge/munge.key
- - file: path=/var/log/munge state=directory mode=0700
- - file: path=/var/log state=directory mode=0755
- - service: name=munge state=restarted
- @end
- )
- configure Debian (
- @begin
- CONDOR_SERVICE: condor
- @end
- )
- contextualize (
- system front configure front step 1
- system wn configure wn step 2
- )
- deploy front 1 ost
- deploy wn @input.NumNodes@ ost
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement