123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- # Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- ---
- - name: Saving distribution of os
- set_fact:
- compute_os: "{{ ansible_facts['distribution'] | lower }}"
- - name: Create a custom fact directory on each host
- file:
- path: "{{ custom_fact_dir }}"
- state: directory
- mode: "{{ custom_fact_dir_mode }}"
- - name: Install accelerator discovery script
- copy:
- src: inventory.fact
- dest: "{{ accelerator_discovery_script_dest }}"
- owner: root
- group: root
- mode: "{{ accelerator_discovery_script_mode }}"
- - block:
- - name: Add epel-release repo
- package:
- name: epel-release
- state: present
- tags: install
-
- - name: Add elrepo GPG key
- rpm_key:
- state: present
- key: "{{ elrepo_gpg_key_url }}"
- register: elrepo_gpg_key
- until: elrepo_gpg_key is not failed
- retries: "{{ max_retries }}"
- delay: "{{ max_delay }}"
- tags: install
- - name: Add elrepo (nvidia kmod drivers)
- package:
- name: "{{ elrepo_rpm_url }}"
- state: present
- register: elrepo
- until: elrepo is not failed
- retries: "{{ max_retries }}"
- delay: "{{ max_delay }}"
- tags: install
-
- - name: Add docker community edition repository
- get_url:
- url: "{{ docker_repo_url }}"
- dest: "{{ docker_repo_dest }}"
- register: docker_repo
- until: docker_repo is not failed
- retries: "{{ max_retries }}"
- delay: "{{ max_delay }}"
- tags: install
- - name: Permanently Disable swap
- mount:
- name: "swap"
- fstype: swap
- state: absent
- - name: Disable selinux
- selinux:
- state: disabled
- tags: install
- - name: Install common packages
- package:
- name: "{{ common_packages }}"
- state: present
- tags: install
- - name: Install common packages
- package:
- name: "{{ common_packages_for_non_leap }}"
- state: present
- tags: install
- - name: Versionlock docker
- command: "yum versionlock '{{ item }}'"
- args:
- warn: false
- with_items:
- - "{{ docker_packages }}"
- changed_when: true
- tags: install
- - name: Collect host facts (including acclerator information)
- setup: ~
- - name: Install infiniBand support
- package:
- name: "@Infiniband Support"
- state: present
- tags: install
- when: ( os_supported_leap not in compute_os )
- - block:
- - name: Add leap repos
- zypper_repository:
- name: "{{ item.name }}"
- repo: "{{ item.repo }}"
- state: present
- autorefresh: yes
- with_items:
- - "{{ leap_repo }}"
- tags: install
-
- - name: Installing python-xml
- package:
- name: python-xml
- state: present
- tags: install
- - name: Add nvidia repo
- zypper_repository:
- name: NVIDIA
- repo: "{{ nvidia_repo }}"
- state: present
- disable_gpg_check: yes
- auto_import_keys: yes
- autorefresh: yes
- tags: install
- - name: Install nvidia(This might take 10-15 minutes)
- command: zypper --gpg-auto-import-keys install -l -y x11-video-nvidiaG06
- changed_when: true
- tags: install
- - name: Add docker community edition repository
- get_url:
- url: "{{ docker_repo_url_leap }}"
- dest: "{{ docker_repo_dest_leap }}"
- register: docker_repo
- until: docker_repo is not failed
- retries: "{{ max_retries }}"
- delay: "{{ max_delay }}"
- tags: install
- - name: Permanently Disable swap
- mount:
- name: "swap"
- fstype: swap
- state: absent
- tags: install
- - name: Install common packages
- package:
- name: "{{ common_packages }}"
- state: present
- tags: install
- - name: Install docker-compose
- package:
- name: docker-compose
- state: present
- tags: install
- - name: Collect host facts (including acclerator information)
- setup: ~
- tags: install
- - name: Install infiniBand support
- package:
- name: infiniband-diags
- state: present
- tags: install
- when: ( os_supported_leap in compute_os ) and ( ansible_distribution_version >= os_supported_leap_version )
- - name: Deploy time ntp/chrony
- include_tasks: ntp.yml
- tags: install
- - name: Install Nvidia drivers and software components
- include_tasks: nvidia.yml
- when:
- - ansible_local.inventory.nvidia_gpu > 0
- - ( ansible_facts['distribution'] == os_name and ansible_facts['distribution_major_version'] == os_version) or
- ( os_supported_leap in compute_os ) and ( ansible_distribution_version >= os_supported_leap_version )
- tags: install
- - name: Install AMD GPU drivers and software components
- include_tasks: amd.yml
- when:
- - ansible_local.inventory.amd_gpu > 0
- - ansible_facts['distribution'] == os_name or
- ( os_supported_leap in compute_os ) and ( ansible_distribution_version >= os_supported_leap_version )
- tags: install
- - name: Get the hostname
- command: hostname
- register: machine_hostname
- changed_when: true
- - name: Set facts for node hostname and ip
- set_fact:
- node_ip: "{{ inventory_hostname }}"
- node_hostname: "{{ machine_hostname.stdout }}"
- - name: Add host name in hosts file
- lineinfile:
- dest: "{{ hosts_file_dest }}"
- line: "{{ inventory_hostname }} {{ machine_hostname.stdout }}"
- state: present
- create: yes
- mode: "{{ hosts_file_mode }}"
- - name: Add compute hosts info in manager node hosts file
- lineinfile:
- dest: "{{ hosts_file_dest }}"
- line: "{{ hostvars[item].node_ip }} {{ hostvars[item].node_hostname }}"
- state: present
- create: yes
- mode: "{{ hosts_file_mode }}"
- with_items:
- - "{{ groups['compute'] }}"
- when: "'manager' in group_names"
- - name: Add manager hosts info in compute node hosts file
- lineinfile:
- dest: "{{ hosts_file_dest }}"
- line: "{{ hostvars[item].node_ip }} {{ hostvars[item].node_hostname }}"
- state: present
- create: yes
- mode: "{{ hosts_file_mode }}"
- with_items:
- - "{{ groups['manager'] }}"
- when: "'compute' in group_names"
- - name: Add login node info in /etc/hosts of manager node
- lineinfile:
- dest: "{{ hosts_file_dest }}"
- line: "{{ hostvars[item].node_ip }} {{ hostvars[item].node_hostname }}"
- state: present
- create: yes
- mode: "{{ hosts_file_mode }}"
- with_items:
- - "{{ groups['login_node'] }}"
- when:
- - '"manager" in group_names'
- - hostvars["127.0.0.1"]["login_node_required"]
- - name: Add manager info in /etc/hosts of login node
- lineinfile:
- dest: "{{ hosts_file_dest }}"
- line: "{{ hostvars[item].node_ip }} {{ hostvars[item].node_hostname }}"
- state: present
- create: yes
- mode: "{{ hosts_file_mode }}"
- with_items:
- - "{{ groups['manager'] }}"
- when:
- - '"login_node" in group_names'
- - hostvars["127.0.0.1"]["login_node_required"]
- - name: Add compute info in /etc/hosts of login node
- lineinfile:
- dest: "{{ hosts_file_dest }}"
- line: "{{ hostvars[item].node_ip }} {{ hostvars[item].node_hostname }}"
- state: present
- create: yes
- mode: "{{ hosts_file_mode }}"
- with_items:
- - "{{ groups['compute'] }}"
- when:
- - hostvars["127.0.0.1"]["login_node_required"]
- - '"login_node" in group_names'
|