Skip to content
Snippets Groups Projects
Commit abbf9aa5 authored by Chris Hines's avatar Chris Hines
Browse files

Merge branch 'desktoponubuntu' into 'master'

ubuntu20 desktop changes

See merge request !489
parents c4134e3b b7895b6d
No related branches found
No related tags found
1 merge request!489ubuntu20 desktop changes
#!/bin/python -E #!/usr/bin/python3 -E
from jinja2 import Template, Environment, FileSystemLoader from jinja2 import Template, Environment, FileSystemLoader
import itertools import itertools
import subprocess import subprocess
...@@ -13,18 +13,18 @@ import json ...@@ -13,18 +13,18 @@ import json
def grab_card_ids(): def grab_card_ids():
# This method runs nvidia-smi to grab the card ids, then returns a list # This method runs nvidia-smi to grab the card ids, then returns a list
if not os.path.isfile("/bin/nvidia-smi"): if not os.path.isfile("/bin/nvidia-smi"):
print("nvidia-smi binary not found!") print("nvidia-smi binary not found!")
exit(1) exit(1)
cmd = ["/bin/nvidia-smi", "--query-gpu=pci.bus_id","--format=csv,noheader"] cmd = ["/bin/nvidia-smi", "--query-gpu=pci.bus_id","--format=csv,noheader"]
p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
cards = [] cards = []
for line in p.stdout.readlines(): for line in p.stdout.readlines():
line = line.rstrip().split(":")[2] line = line.decode().rstrip().split(":")[2]
pcibus_num = int(re.sub('[.:]', '', line).rstrip("0"),16) pcibus_num = int(re.sub('[.:]', '', line).rstrip("0"),16)
card = "PCI:0:{}:0".format(str(pcibus_num)) card = "PCI:0:{}:0".format(str(pcibus_num))
cards.append(card) cards.append(card)
...@@ -39,7 +39,7 @@ def grab_card_boardname(): ...@@ -39,7 +39,7 @@ def grab_card_boardname():
cards = [] cards = []
p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in p.stdout.readlines(): for line in p.stdout.readlines():
line = line.rstrip() line = line.decode().rstrip()
cards.append(line) cards.append(line)
return cards return cards
...@@ -68,5 +68,3 @@ if __name__ == "__main__": ...@@ -68,5 +68,3 @@ if __name__ == "__main__":
cards = grab_card_ids() cards = grab_card_ids()
write_xorg_conf(cards) write_xorg_conf(cards)
...@@ -37,3 +37,31 @@ ...@@ -37,3 +37,31 @@
become: yes become: yes
command: '/opt/generate-xorg/nvidia-xconf-gen.py' command: '/opt/generate-xorg/nvidia-xconf-gen.py'
when: xorg_template.changed or gen.changed when: xorg_template.changed or gen.changed
- name: deploy desktop related packages
package:
name:
- python-is-python2 # compatibility package for get-xorg.py
- python-tk #this is to get the Desktop Walltime script to work
- python-pexpect #this is to make the ansible expect module work
state: present
become: true
when: ansible_os_family=="Debian"
- name: change allowed_user variable in Xwrapper.config
replace:
path: /etc/X11/Xwrapper.config
regexp: 'allowed_users=console'
replace: 'allowed_users=anybody'
become: true
register: xwrapperalloweduser
when: ansible_os_family=="Debian"
- name: "Run `dpkg-reconfigure xserver-xorg-legacy` to make sure /etc/X11/Xwrapper.config doesn't get overridden during update"
expect:
command: 'dpkg-reconfigure -freadline xserver-xorg-legacy'
responses:
'(.*)Users allowed to start the X server(.*)': 3
when: xwrapperalloweduser.changed
become: true
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
when: default_modules == "modulecmd" when: default_modules == "modulecmd"
- name: template lmod bash - name: template lmod bash
template: src=lmod_{{ ansible_os_family }}.sh.j2 dest=/etc/profile.d/lmod.sh template: src=lmod_{{ ansible_os_family }}.sh.j2 dest=/etc/profile.d/lmod.sh
become: true become: true
become_user: root become_user: root
when: default_modules == "lmod" when: default_modules == "lmod"
...@@ -73,4 +73,12 @@ ...@@ -73,4 +73,12 @@
state: link state: link
mode: u=rwx,g=rx,o=rx mode: u=rwx,g=rx,o=rx
become: true become: true
when: ansible_os_family == 'Debian' and default_modules == 'modulecmd' when: ansible_os_family == 'Debian' and default_modules == 'modulecmd'
\ No newline at end of file
- name: load modulecmd in /etc/bash.bashrc this is to get module command to work from terminal on the desktop
lineinfile:
path: /etc/bash.bashrc
line: 'if [ -f /etc/profile.d/modulecmd.sh ]; then source /etc/profile.d/modulecmd.sh; fi'
become: true
when: ansible_os_family=="Debian" and default_modules == 'modulecmd'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment