Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • hpc-team/HPCasCode
  • chines/ansible_cluster_in_a_box
2 results
Show changes
Showing
with 129 additions and 56 deletions
---
- name: install tmux
yum: name=tmux state=present
become: true
when: ansible_os_family == "RedHat"
- name: "sshkeepalive restart sshd"
service: name=sshd state=restarted
become: true
when: ansible_os_family == "RedHat"
- name: "sshkeepalive restart ssh"
service: name=ssh state=restarted
become: true
when: ansible_os_family == "Debian"
- name: "Set ClientAliveInterval"
lineinfile:
args:
dest: /etc/ssh/sshd_config
regexp: "#?ClientAliveInterval [0-9]+"
line: "ClientAliveInterval 60"
backrefs: yes
become: true
notify:
- sshkeepalive restart sshd
- sshkeepalive restart ssh
- name: "SetClientAliveCountMax"
lineinfile:
args:
dest: /etc/ssh/sshd_config
regexp: "#?ClientAliveCountMax [0-9]+"
line: "ClientAliveCountMax 5"
backrefs: yes
become: true
notify:
- sshkeepalive restart sshd
- sshkeepalive restart ssh
- name: "restart sshd"
service: name=sshd state=restarted
become: true
when: ansible_os_family == "RedHat"
- name: "restart ssh"
service: name=ssh state=restarted
become: true
when: ansible_os_family == "Debian"
- name: "Disable Challenge Response"
lineinfile:
args:
dest: /etc/ssh/sshd_config
regexp: "ChallengeResponseAuthentication yes"
line: "ChallengeResponseAuthentication no"
backrefs: yes
become: true
notify:
- restart sshd
- restart ssh
- name: "Disable Password"
lineinfile:
args:
dest: /etc/ssh/sshd_config
regexp: "PasswordAuthentication yes"
line: "PasswordAuthentication no"
backrefs: yes
become: true
notify:
- restart sshd
- restart ssh
- name: "restart sshd" - name: "restart sshd"
service: name=sshd state=restarted service: name=sshd state=restarted
sudo: true become: true
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
- name: "restart ssh" - name: "restart ssh"
service: name=ssh state=restarted service: name=ssh state=restarted
sudo: true become: true
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
...@@ -3,34 +3,22 @@ ...@@ -3,34 +3,22 @@
args: args:
dest: /etc/ssh/sshd_config dest: /etc/ssh/sshd_config
regexp: "ChallengeResponseAuthentication no" regexp: "ChallengeResponseAuthentication no"
line: "ChallengeResponseAuthentication yes" line: "ChallengeResponseAuthentication yes"
backrefs: yes backrefs: yes
sudo: true become: true
notify: notify:
- restart sshd - restart sshd
- restart ssh - restart ssh
- name: "Enable Challenge Response" - name: "Disable Password"
lineinfile:
args:
dest: /etc/ssh/sshd_config
regexp: "PasswordAuthentication no"
line: "PasswordAuthentication yes"
backrefs: yes
sudo: true
notify:
- restart sshd
- restart ssh
- name: "Disable Challenge Response"
lineinfile: lineinfile:
args: args:
dest: /etc/ssh/sshd_config dest: /etc/ssh/sshd_config
regexp: "PasswordAuthentication yes" regexp: "PasswordAuthentication yes"
line: "PasswordAuthentication no" line: "PasswordAuthentication no"
backrefs: yes backrefs: yes
sudo: true become: true
notify: notify:
- restart sshd - restart sshd
- restart ssh - restart ssh
---
- name: copy ssh host keys
template: src=files/ssh_host_{{ item }}_key dest=/etc/ssh/ssh_host_{{ item }}_key mode=600 owner=root group=root
become: true
become_user: root
with_items:
- rsa
- dsa
- ecdsa
- ed25519
register: host_keys
- name: restart sshd
service: name=sshd state=restarted
become: true
become_user: root
when: host_keys is changed
...@@ -5,27 +5,20 @@ ...@@ -5,27 +5,20 @@
- name: add epel on CentOS 7 - name: add epel on CentOS 7
shell: rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm shell: rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
sudo: true become: true
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7" when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
ignore_errors: true ignore_errors: true
- name: add epel on CentOS 7
shell: yum -y update
sudo: true
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
- name: install system packages apt - name: install system packages apt
apt: name={{ item }} state=installed update_cache=true apt: name={{ item }} state=present update_cache=true
sudo: true become: true
with_items: system_packages with_items: system_packages
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'
- name: install system packages yum - name: install system packages yum
yum: name={{ item }} state=installed yum: name={{ item }} state=present
sudo: true become: true
with_items: system_packages with_items: system_packages
when: ansible_os_family == 'RedHat' when: ansible_os_family == 'RedHat'
...@@ -38,13 +31,13 @@ ...@@ -38,13 +31,13 @@
- name: install pip packages - name: install pip packages
command: pip install {{ item }} command: pip install {{ item }}
sudo: true become: true
with_items: pip_packages with_items: pip_packages
when: pip_packages is defined when: pip_packages is defined
#- name: install pkg deps #- name: install pkg deps
# shell: /tmp/strudel/system_build_scripts/{{ install_prerequisites }} chdir=/tmp/strudel # shell: /tmp/strudel/system_build_scripts/{{ install_prerequisites }} chdir=/tmp/strudel
# sudo: true # become: true
# when: ansible_os_family == 'RedHat' # when: ansible_os_family == 'RedHat'
- name: build - name: build
......
...@@ -68,6 +68,6 @@ ...@@ -68,6 +68,6 @@
- python-psutil - python-psutil
pkg_name: ./rpmbuild/RPMS/x86_64/strudel-{{ strudel_ver }}-1.x86_64.rpm pkg_name: ./rpmbuild/RPMS/x86_64/strudel-{{ strudel_ver }}-1.x86_64.rpm
dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_major_version }}_{{ strudel_ver }}_x86_64.rpm dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_major_version }}_{{ strudel_ver }}_x86_64.rpm
...@@ -65,6 +65,6 @@ ...@@ -65,6 +65,6 @@
- python-psutil - python-psutil
pkg_name: ./rpmbuild/RPMS/x86_64/strudel-{{ strudel_ver }}-1.x86_64.rpm pkg_name: ./rpmbuild/RPMS/x86_64/strudel-{{ strudel_ver }}-1.x86_64.rpm
dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_major_version }}_{{ strudel_ver }}_x86_64.rpm dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_major_version }}_{{ strudel_ver }}_x86_64.rpm
...@@ -66,6 +66,6 @@ ...@@ -66,6 +66,6 @@
- python-psutil - python-psutil
pkg_name: ./rpmbuild/RPMS/x86_64/strudel-0.6.0-1.x86_64.rpm pkg_name: ./rpmbuild/RPMS/x86_64/strudel-0.6.0-1.x86_64.rpm
dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_version }}_{{ hostvars[ansible_hostname]['ansible_date_time']['date'] }}_x86_64.rpm dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_version }}_{{ hostvars[ansible_hostname]['ansible_date_time']['date'] }}_x86_64.rpm
...@@ -67,6 +67,6 @@ ...@@ -67,6 +67,6 @@
- python-psutil - python-psutil
pkg_name: ./rpmbuild/RPMS/x86_64/strudel-{{ strudel_ver }}-1.x86_64.rpm pkg_name: ./rpmbuild/RPMS/x86_64/strudel-{{ strudel_ver }}-1.x86_64.rpm
dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_major_version }}_{{ strudel_ver }}_x86_64.rpm dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_major_version }}_{{ strudel_ver }}_x86_64.rpm
- name: "Set login node" - name: "Set login node"
set_fact: set_fact:
loginNode: "{{ ansible_eth0.ipv4.address }}" loginNode: "{{ ansible_eth0.ipv4.address }}"
- name: "Temlate Strudel config" - name: "Temlate Strudel config"
......
[ [
[ [
"GenericDesktops" {% for partition in slurmqueues %}
"{{ partition.name }}"{% if not loop.last %},{% endif %}
{% endfor %}
], ],
{ {
"GenericDesktops": { {% for partition in slurmqueues %}
"{{ partition.name }}": {
"__class__": "siteConfig", "__class__": "siteConfig",
"__module__": "siteConfig", "__module__": "siteConfig",
"agent": { "agent": {
...@@ -121,7 +124,7 @@ ...@@ -121,7 +124,7 @@
"__class__": "cmdRegEx", "__class__": "cmdRegEx",
"__module__": "siteConfig", "__module__": "siteConfig",
"async": false, "async": false,
"cmd": "{{ slurm_dir }}/bin/squeue -u {username} -o \\\"%i %L\\\" | tail -n -1", "cmd": "\"{{ slurm_dir }}/bin/squeue -u {username} -o \\\"%i %L\\\" | tail -n -1\"",
"failFatal": true, "failFatal": true,
"formatFatal": false, "formatFatal": false,
"host": "login", "host": "login",
...@@ -268,7 +271,7 @@ ...@@ -268,7 +271,7 @@
"__class__": "cmdRegEx", "__class__": "cmdRegEx",
"__module__": "siteConfig", "__module__": "siteConfig",
"async": false, "async": false,
"cmd": "\"mkdir ~/.vnc ; rm -f ~/.vnc/clearpass ; touch ~/.vnc/clearpass ; chmod 600 ~/.vnc/clearpass ; passwd=\"'$'\"( dd if=/dev/urandom bs=1 count=8 2>/dev/null | md5sum | cut -b 1-8 ) ; echo \"'$'\"passwd > ~/.vnc/clearpass ; cat ~/.vnc/clearpass | vncpasswd -f > ~/.vnc/passwd ; chmod 600 ~/.vnc/passwd ; echo -e '#!/bin/bash\\nvncserver ; sleep 36000000 ' | {{slurm_dir}}/bin/sbatch -p batch -N {nodes} -n {ppn} --time={hours}:00:00 -J desktop_{username} -o .vnc/slurm-%j.out \"", "cmd": "\"mkdir ~/.vnc ; rm -f ~/.vnc/clearpass ; touch ~/.vnc/clearpass ; chmod 600 ~/.vnc/clearpass ; passwd=\"'$'\"( dd if=/dev/urandom bs=1 count=8 2>/dev/null | md5sum | cut -b 1-8 ) ; echo \"'$'\"passwd > ~/.vnc/clearpass ; cat ~/.vnc/clearpass | vncpasswd -f > ~/.vnc/passwd ; chmod 600 ~/.vnc/passwd ; echo -e '#!/bin/bash\\nexport PATH=\"'$'\"PATH:/bin ; vncserver ; sleep 36000000 ' | {{slurm_dir}}/bin/sbatch -p {{ partition.name }} -N {nodes} -n {ppn} --time={hours}:00:00 -J desktop_{username} -o .vnc/slurm-%j.out \"",
"failFatal": true, "failFatal": true,
"formatFatal": false, "formatFatal": false,
"host": "login", "host": "login",
...@@ -345,7 +348,7 @@ ...@@ -345,7 +348,7 @@
"host": "exec", "host": "exec",
"loop": false, "loop": false,
"regex": [ "regex": [
"^.*?New 'X' desktop is \\S+(?P<vncDisplay>:[0-9]+)\\s*$" "^.*?New .* desktop is \\S+(?P<vncDisplay>:[0-9]+)\\s*$"
], ],
"requireMatch": true "requireMatch": true
}, },
...@@ -447,6 +450,7 @@ ...@@ -447,6 +450,7 @@
], ],
"requireMatch": true "requireMatch": true
} }
} }{% if not loop.last %},{% endif %}
{% endfor %}
} }
] ]
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
"__class__": "cmdRegEx", "__class__": "cmdRegEx",
"__module__": "siteConfig", "__module__": "siteConfig",
"async": false, "async": false,
"cmd": "squeue -u {username} -o \\\"%i %L\\\" | tail -n -1", "cmd": "\"squeue -u {username} -o \\\"%i %L\\\" | tail -n -1\"",
"failFatal": true, "failFatal": true,
"formatFatal": false, "formatFatal": false,
"host": "login", "host": "login",
...@@ -449,4 +449,4 @@ ...@@ -449,4 +449,4 @@
} }
} }
} }
] ]
\ No newline at end of file
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
- include_vars: "{{ ansible_distribution }}_{{ ansible_distribution_major_version }}_{{ ansible_architecture }}.yml" - include_vars: "{{ ansible_distribution }}_{{ ansible_distribution_major_version }}_{{ ansible_architecture }}.yml"
- name: get turbovnc - name: get turbovnc
shell: wget http://sourceforge.net/projects/turbovnc/files/1.2.3/turbovnc_1.2.3_amd64.deb shell: wget http://sourceforge.net/projects/turbovnc/files/1.2.3/turbovnc_1.2.3_amd64.deb
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: install turobvnc - name: install turobvnc
apt: deb=turbovnc_1.2.3_amd64.deb apt: deb=turbovnc_1.2.3_amd64.deb
sudo: true become: true
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: get turbovnc - name: get turbovnc
...@@ -16,19 +16,19 @@ ...@@ -16,19 +16,19 @@
- name: install turobvnc - name: install turobvnc
yum: src=turbovnc-1.2.3.x86_64.rpm yum: src=turbovnc-1.2.3.x86_64.rpm
sudo: true become: true
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
- name: copy launcher - name: copy launcher
copy: src=/tmp/{{ dest_pkg_name }} dest=/tmp/{{ dest_pkg_name }} copy: src=/tmp/{{ dest_pkg_name }} dest=/tmp/{{ dest_pkg_name }}
- name: install launhcer - name: install launhcer
apt: deb=/tmp/{{ dest_pkg_name }} apt: deb=/tmp/{{ dest_pkg_name }}
sudo: true become: true
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: install launcher - name: install launcher
yum: src=/tmp/{{ dest_pkg_name }} yum: src=/tmp/{{ dest_pkg_name }}
sudo: true become: true
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
...@@ -68,6 +68,6 @@ ...@@ -68,6 +68,6 @@
- python-psutil - python-psutil
pkg_name: ./rpmbuild/RPMS/x86_64/strudel-{{ strudel_ver }}-1.x86_64.rpm pkg_name: ./rpmbuild/RPMS/x86_64/strudel-{{ strudel_ver }}-1.x86_64.rpm
dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_major_version }}_{{ strudel_ver }}_x86_64.rpm dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_major_version }}_{{ strudel_ver }}_x86_64.rpm
...@@ -65,6 +65,6 @@ ...@@ -65,6 +65,6 @@
- python-psutil - python-psutil
pkg_name: ./rpmbuild/RPMS/x86_64/strudel-{{ strudel_ver }}-1.x86_64.rpm pkg_name: ./rpmbuild/RPMS/x86_64/strudel-{{ strudel_ver }}-1.x86_64.rpm
dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_major_version }}_{{ strudel_ver }}_x86_64.rpm dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_major_version }}_{{ strudel_ver }}_x86_64.rpm
...@@ -66,6 +66,6 @@ ...@@ -66,6 +66,6 @@
- python-psutil - python-psutil
pkg_name: ./rpmbuild/RPMS/x86_64/strudel-0.6.0-1.x86_64.rpm pkg_name: ./rpmbuild/RPMS/x86_64/strudel-0.6.0-1.x86_64.rpm
dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_version }}_{{ hostvars[ansible_hostname]['ansible_date_time']['date'] }}_x86_64.rpm dest_pkg_name: strudel_{{ ansible_distribution }}_{{ ansible_distribution_version }}_{{ hostvars[ansible_hostname]['ansible_date_time']['date'] }}_x86_64.rpm