Temp public repository

This commit is contained in:
Jakub Delicat 2022-06-14 18:53:16 +02:00
commit 3bf9de7924
61 changed files with 1893 additions and 0 deletions

21
README.md Normal file
View File

@ -0,0 +1,21 @@
# Lab1.5 App
Python, Qt app to manage computers in the Laboratory of Autonomous Robots.
Is shows status and basic informations of computers.
# After Cloning
After cloning image from `/var/iso/StationIMG/2021-09-29-15-img-lab15-9_CompleteUbuntu20.04` use
`ansible-playbook playbooks/after_cloning.yaml --extra-vars "variable_host=lab15-x" -K `
# Dependencies
- ansible
To install it use: `ansible-galaxy collection install community.general`
# use
>`ansible-playbook playbooks/playbook.yaml --extra-vars "variable_host=all" -K `
# Autorized keys
To auto login into computer put your public key into `authorized_pub_sshkeys` an type:
>`ansible-playbook playbooks/send_authorized_sshkeys.yaml --extra-vars "variable_host=<computer-name>" -K -k`

528
ansible.cfg Normal file
View File

@ -0,0 +1,528 @@
# Example config file for ansible -- https://ansible.com/
# =======================================================
# Nearly all parameters can be overridden in ansible-playbook
# or with command line flags. Ansible will read ANSIBLE_CONFIG,
# ansible.cfg in the current working directory, .ansible.cfg in
# the home directory, or /etc/ansible/ansible.cfg, whichever it
# finds first
# For a full list of available options, run ansible-config list or see the
# documentation: https://docs.ansible.com/ansible/latest/reference_appendices/config.html.
[defaults]
inventory = ./inventory/hosts.ini
host_key_checking = false
#library = ~/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
#module_utils = ~/.ansible/plugins/module_utils:/usr/share/ansible/plugins/module_utils
#remote_tmp = ~/.ansible/tmp
#local_tmp = ~/.ansible/tmp
#forks = 5
#poll_interval = 0.001
#ask_pass = False
#transport = smart
# Plays will gather facts by default, which contain information about
# the remote system.
#
# smart - gather by default, but don't regather if already gathered
# implicit - gather by default, turn off with gather_facts: False
# explicit - do not gather by default, must say gather_facts: True
#gathering = implicit
# This only affects the gathering done by a play's gather_facts directive,
# by default gathering retrieves all facts subsets
# all - gather all subsets
# network - gather min and network facts
# hardware - gather hardware facts (longest facts to retrieve)
# virtual - gather min and virtual facts
# facter - import facts from facter
# ohai - import facts from ohai
# You can combine them using comma (ex: network,virtual)
# You can negate them using ! (ex: !hardware,!facter,!ohai)
# A minimal set of facts is always gathered.
#
#gather_subset = all
# some hardware related facts are collected
# with a maximum timeout of 10 seconds. This
# option lets you increase or decrease that
# timeout to something more suitable for the
# environment.
#
#gather_timeout = 10
# Ansible facts are available inside the ansible_facts.* dictionary
# namespace. This setting maintains the behaviour which was the default prior
# to 2.5, duplicating these variables into the main namespace, each with a
# prefix of 'ansible_'.
# This variable is set to True by default for backwards compatibility. It
# will be changed to a default of 'False' in a future release.
#
#inject_facts_as_vars = True
# Paths to search for collections, colon separated
# collections_paths = ~/.ansible/collections:/usr/share/ansible/collections
# Paths to search for roles, colon separated
#roles_path = ~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
# Host key checking is enabled by default
#host_key_checking = True
# You can only have one 'stdout' callback type enabled at a time. The default
# is 'default'. The 'yaml' or 'debug' stdout callback plugins are easier to read.
#
#stdout_callback = default
#stdout_callback = yaml
#stdout_callback = debug
# Ansible ships with some plugins that require enabling
# this is done to avoid running all of a type by default.
# These setting lists those that you want enabled for your system.
# Custom plugins should not need this unless plugin author disables them
# by default.
#
# Enable callback plugins, they can output to stdout but cannot be 'stdout' type.
#callbacks_enabled = timer, mail
# Determine whether includes in tasks and handlers are "static" by
# default. As of 2.0, includes are dynamic by default. Setting these
# values to True will make includes behave more like they did in the
# 1.x versions.
#
#task_includes_static = False
#handler_includes_static = False
# Controls if a missing handler for a notification event is an error or a warning
#error_on_missing_handler = True
# Default timeout for connection plugins
#timeout = 10
# Default user to use for playbooks if user is not specified
# Uses the connection plugin's default, normally the user currently executing Ansible,
# unless a different user is specified here.
#
remote_user = lab
# Logging is off by default unless this path is defined.
log_path = ./ansible.log
# Default module to use when running ad-hoc commands
#module_name = command
# Use this shell for commands executed under sudo.
# you may need to change this to /bin/bash in rare instances
# if sudo is constrained.
#
#executable = /bin/sh
# By default, variables from roles will be visible in the global variable
# scope. To prevent this, set the following option to True, and only
# tasks and handlers within the role will see the variables there
#
#private_role_vars = False
# List any Jinja2 extensions to enable here.
#jinja2_extensions = jinja2.ext.do,jinja2.ext.i18n
# If set, always use this private key file for authentication, same as
# if passing --private-key to ansible or ansible-playbook
#
#private_key_file = /path/to/file
# If set, configures the path to the Vault password file as an alternative to
# specifying --vault-password-file on the command line. This can also be
# an executable script that returns the vault password to stdout.
#
#vault_password_file = /path/to/vault_password_file
# Format of string {{ ansible_managed }} available within Jinja2
# templates indicates to users editing templates files will be replaced.
# replacing {file}, {host} and {uid} and strftime codes with proper values.
#
#ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
# {file}, {host}, {uid}, and the timestamp can all interfere with idempotence
# in some situations so the default is a static string:
#
#ansible_managed = Ansible managed
# By default, ansible-playbook will display "Skipping [host]" if it determines a task
# should not be run on a host. Set this to "False" if you don't want to see these "Skipping"
# messages. NOTE: the task header will still be shown regardless of whether or not the
# task is skipped.
#
#display_skipped_hosts = True
# By default, if a task in a playbook does not include a name: field then
# ansible-playbook will construct a header that includes the task's action but
# not the task's args. This is a security feature because ansible cannot know
# if the *module* considers an argument to be no_log at the time that the
# header is printed. If your environment doesn't have a problem securing
# stdout from ansible-playbook (or you have manually specified no_log in your
# playbook on all of the tasks where you have secret information) then you can
# safely set this to True to get more informative messages.
#
#display_args_to_stdout = False
# Ansible will raise errors when attempting to dereference
# Jinja2 variables that are not set in templates or action lines. Uncomment this line
# to change this behavior.
#
#error_on_undefined_vars = False
# Ansible may display warnings based on the configuration of the
# system running ansible itself. This may include warnings about 3rd party packages or
# other conditions that should be resolved if possible.
# To disable these warnings, set the following value to False:
#
#system_warnings = True
# Ansible may display deprecation warnings for language
# features that should no longer be used and will be removed in future versions.
# To disable these warnings, set the following value to False:
#
#deprecation_warnings = True
# Ansible can optionally warn when usage of the shell and
# command module appear to be simplified by using a default Ansible module
# instead. These warnings can be silenced by adjusting the following
# setting or adding warn=yes or warn=no to the end of the command line
# parameter string. This will for example suggest using the git module
# instead of shelling out to the git command.
#
#command_warnings = False
# set plugin path directories here, separate with colons
#action_plugins = /usr/share/ansible/plugins/action
#become_plugins = /usr/share/ansible/plugins/become
#cache_plugins = /usr/share/ansible/plugins/cache
#callback_plugins = /usr/share/ansible/plugins/callback
#connection_plugins = /usr/share/ansible/plugins/connection
#lookup_plugins = /usr/share/ansible/plugins/lookup
#inventory_plugins = /usr/share/ansible/plugins/inventory
#vars_plugins = /usr/share/ansible/plugins/vars
#filter_plugins = /usr/share/ansible/plugins/filter
#test_plugins = /usr/share/ansible/plugins/test
#terminal_plugins = /usr/share/ansible/plugins/terminal
#strategy_plugins = /usr/share/ansible/plugins/strategy
# Ansible will use the 'linear' strategy but you may want to try another one.
#strategy = linear
# By default, callbacks are not loaded for /bin/ansible. Enable this if you
# want, for example, a notification or logging callback to also apply to
# /bin/ansible runs
#
#bin_ansible_callbacks = False
# Don't like cows? that's unfortunate.
# set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1
#nocows = 1
# Set which cowsay stencil you'd like to use by default. When set to 'random',
# a random stencil will be selected for each task. The selection will be filtered
# against the `cow_enabled` option below.
#
#cow_selection = default
#cow_selection = random
# When using the 'random' option for cowsay, stencils will be restricted to this list.
# it should be formatted as a comma-separated list with no spaces between names.
# NOTE: line continuations here are for formatting purposes only, as the INI parser
# in python does not support them.
#
#cowsay_enabled_stencils=bud-frogs,bunny,cheese,daemon,default,dragon,elephant-in-snake,elephant,eyes,\
# hellokitty,kitty,luke-koala,meow,milk,moofasa,moose,ren,sheep,small,stegosaurus,\
# stimpy,supermilker,three-eyes,turkey,turtle,tux,udder,vader-koala,vader,www
# Don't like colors either?
# set to 1 if you don't want colors, or export ANSIBLE_NOCOLOR=1
#
#nocolor = 1
# If set to a persistent type (not 'memory', for example 'redis') fact values
# from previous runs in Ansible will be stored. This may be useful when
# wanting to use, for example, IP information from one group of servers
# without having to talk to them in the same playbook run to get their
# current IP information.
#
#fact_caching = memory
# This option tells Ansible where to cache facts. The value is plugin dependent.
# For the jsonfile plugin, it should be a path to a local directory.
# For the redis plugin, the value is a host:port:database triplet: fact_caching_connection = localhost:6379:0
#
#fact_caching_connection=/tmp
# retry files
# When a playbook fails a .retry file can be created that will be placed in ~/
# You can enable this feature by setting retry_files_enabled to True
# and you can change the location of the files by setting retry_files_save_path
#
#retry_files_enabled = False
#retry_files_save_path = ~/.ansible-retry
# prevents logging of task data, off by default
#no_log = False
# prevents logging of tasks, but only on the targets, data is still logged on the master/controller
#no_target_syslog = False
# Controls whether Ansible will raise an error or warning if a task has no
# choice but to create world readable temporary files to execute a module on
# the remote machine. This option is False by default for security. Users may
# turn this on to have behaviour more like Ansible prior to 2.1.x. See
# https://docs.ansible.com/ansible/latest/user_guide/become.html#risks-of-becoming-an-unprivileged-user
# for more secure ways to fix this than enabling this option.
#
#allow_world_readable_tmpfiles = False
# Controls what compression method is used for new-style ansible modules when
# they are sent to the remote system. The compression types depend on having
# support compiled into both the controller's python and the client's python.
# The names should match with the python Zipfile compression types:
# * ZIP_STORED (no compression. available everywhere)
# * ZIP_DEFLATED (uses zlib, the default)
# These values may be set per host via the ansible_module_compression inventory variable.
#
#module_compression = 'ZIP_DEFLATED'
# This controls the cutoff point (in bytes) on --diff for files
# set to 0 for unlimited (RAM may suffer!).
#
#max_diff_size = 104448
# Controls showing custom stats at the end, off by default
#show_custom_stats = False
# Controls which files to ignore when using a directory as inventory with
# possibly multiple sources (both static and dynamic)
#
#inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo
# This family of modules use an alternative execution path optimized for network appliances
# only update this setting if you know how this works, otherwise it can break module execution
#
#network_group_modules=eos, nxos, ios, iosxr, junos, vyos
# When enabled, this option allows lookups (via variables like {{lookup('foo')}} or when used as
# a loop with `with_foo`) to return data that is not marked "unsafe". This means the data may contain
# jinja2 templating language which will be run through the templating engine.
# ENABLING THIS COULD BE A SECURITY RISK
#
#allow_unsafe_lookups = False
# set default errors for all plays
#any_errors_fatal = False
[inventory]
# List of enabled inventory plugins and the order in which they are used.
#enable_plugins = host_list, script, auto, yaml, ini, toml
# Ignore these extensions when parsing a directory as inventory source
#ignore_extensions = .pyc, .pyo, .swp, .bak, ~, .rpm, .md, .txt, ~, .orig, .ini, .cfg, .retry
# ignore files matching these patterns when parsing a directory as inventory source
#ignore_patterns=
# If 'True' unparsed inventory sources become fatal errors, otherwise they are warnings.
#unparsed_is_failed = False
[privilege_escalation]
#become = False
#become_method = sudo
#become_ask_pass = False
## Connection Plugins ##
# Settings for each connection plugin go under a section titled '[[plugin_name]_connection]'
# To view available connection plugins, run ansible-doc -t connection -l
# To view available options for a connection plugin, run ansible-doc -t connection [plugin_name]
# https://docs.ansible.com/ansible/latest/plugins/connection.html
[paramiko_connection]
# uncomment this line to cause the paramiko connection plugin to not record new host
# keys encountered. Increases performance on new host additions. Setting works independently of the
# host key checking setting above.
#record_host_keys=False
# by default, Ansible requests a pseudo-terminal for commands executed under sudo. Uncomment this
# line to disable this behaviour.
#pty = False
# paramiko will default to looking for SSH keys initially when trying to
# authenticate to remote devices. This is a problem for some network devices
# that close the connection after a key failure. Uncomment this line to
# disable the Paramiko look for keys function
#look_for_keys = False
# When using persistent connections with Paramiko, the connection runs in a
# background process. If the host doesn't already have a valid SSH key, by
# default Ansible will prompt to add the host key. This will cause connections
# running in background processes to fail. Uncomment this line to have
# Paramiko automatically add host keys.
#host_key_auto_add = True
# To proxy for Denali
proxy_command = ssh -W "%h:%p" jdelicat@denali
[ssh_connection]
# ssh arguments to use
# Leaving off ControlPersist will result in poor performance, so use
# paramiko on older platforms rather than removing it, -C controls compression use
#ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s
# The base directory for the ControlPath sockets.
# This is the "%(directory)s" in the control_path option
#
# Example:
# control_path_dir = /tmp/.ansible/cp
#control_path_dir = ~/.ansible/cp
# The path to use for the ControlPath sockets. This defaults to a hashed string of the hostname,
# port and username (empty string in the config). The hash mitigates a common problem users
# found with long hostnames and the conventional %(directory)s/ansible-ssh-%%h-%%p-%%r format.
# In those cases, a "too long for Unix domain socket" ssh error would occur.
#
# Example:
# control_path = %(directory)s/%%C
#control_path =
# Enabling pipelining reduces the number of SSH operations required to
# execute a module on the remote server. This can result in a significant
# performance improvement when enabled, however when using "sudo:" you must
# first disable 'requiretty' in /etc/sudoers
#
# By default, this option is disabled to preserve compatibility with
# sudoers configurations that have requiretty (the default on many distros).
#
#pipelining = False
# Control the mechanism for transferring files (old)
# * smart = try sftp and then try scp [default]
# * True = use scp only
# * False = use sftp only
#scp_if_ssh = smart
# Control the mechanism for transferring files (new)
# If set, this will override the scp_if_ssh option
# * sftp = use sftp to transfer files
# * scp = use scp to transfer files
# * piped = use 'dd' over SSH to transfer files
# * smart = try sftp, scp, and piped, in that order [default]
#transfer_method = smart
# If False, sftp will not use batch mode to transfer files. This may cause some
# types of file transfer failures impossible to catch however, and should
# only be disabled if your sftp version has problems with batch mode
#sftp_batch_mode = False
# The -tt argument is passed to ssh when pipelining is not enabled because sudo
# requires a tty by default.
#usetty = True
# Number of times to retry an SSH connection to a host, in case of UNREACHABLE.
# For each retry attempt, there is an exponential backoff,
# so after the first attempt there is 1s wait, then 2s, 4s etc. up to 30s (max).
#retries = 3
[persistent_connection]
# Configures the persistent connection timeout value in seconds. This value is
# how long the persistent connection will remain idle before it is destroyed.
# If the connection doesn't receive a request before the timeout value
# expires, the connection is shutdown. The default value is 30 seconds.
#connect_timeout = 30
# The command timeout value defines the amount of time to wait for a command
# or RPC call before timing out. The value for the command timeout must
# be less than the value of the persistent connection idle timeout (connect_timeout)
# The default value is 30 second.
#command_timeout = 30
## Become Plugins ##
# Settings for become plugins go under a section named '[[plugin_name]_become_plugin]'
# To view available become plugins, run ansible-doc -t become -l
# To view available options for a specific plugin, run ansible-doc -t become [plugin_name]
# https://docs.ansible.com/ansible/latest/plugins/become.html
[sudo_become_plugin]
#flags = -H -S -n
#user = root
[selinux]
# file systems that require special treatment when dealing with security context
# the default behaviour that copies the existing context or uses the user default
# needs to be changed to use the file system dependent context.
#special_context_filesystems=fuse,nfs,vboxsf,ramfs,9p,vfat
# Set this to True to allow libvirt_lxc connections to work without SELinux.
#libvirt_lxc_noseclabel = False
[colors]
#highlight = white
#verbose = blue
#warn = bright purple
#error = red
#debug = dark gray
#deprecate = purple
#skip = cyan
#unreachable = red
#ok = green
#changed = yellow
#diff_add = green
#diff_remove = red
#diff_lines = cyan
[diff]
# Always print diff when running ( same as always running with -D/--diff )
#always = False
# Set how many context lines to show in diff
#context = 3
[galaxy]
# Controls whether the display wheel is shown or not
#display_progress=
# Validate TLS certificates for Galaxy server
#ignore_certs = False
# Role or collection skeleton directory to use as a template for
# the init action in ansible-galaxy command
#role_skeleton=
# Patterns of files to ignore inside a Galaxy role or collection
# skeleton directory
#role_skeleton_ignore="^.git$", "^.*/.git_keep$"
# Galaxy Server URL
#server=https://galaxy.ansible.com
# A list of Galaxy servers to use when installing a collection.
#server_list=automation_hub, release_galaxy
# Server specific details which are mentioned in server_list
#[galaxy_server.automation_hub]
#url=https://cloud.redhat.com/api/automation-hub/
#auth_url=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token
#token=my_ah_token
#
#[galaxy_server.release_galaxy]
#url=https://galaxy.ansible.com/
#token=my_token

BIN
gnome-shell-theme.gresource Normal file

Binary file not shown.

80
inventory/hosts.ini Normal file
View File

@ -0,0 +1,80 @@
[lab15_special]
lab15-19 ansible_host=10.104.16.29 ansible_connection=ssh ansible_user=lab
lab15-20 ansible_host=127.0.0.1 ansible_connection=ssh ansible_user=lab
[lab15_nvidia]
lab15-1 ansible_host=10.104.16.11 ansible_connection=ssh ansible_user=lab
lab15-10 ansible_host=10.104.16.20 ansible_connection=ssh ansible_user=lab
lab15-15 ansible_host=10.104.16.25 ansible_connection=ssh ansible_user=lab
lab15-16 ansible_host=10.104.16.26 ansible_connection=ssh ansible_user=lab
lab15-17 ansible_host=10.104.16.27 ansible_connection=ssh ansible_user=lab
lab15-18 ansible_host=10.104.16.28 ansible_connection=ssh ansible_user=lab
[pioniers]
pionier1 ansible_host=10.104.16.43 ansible_connection=ssh ansible_user=lab1_5
pionier2 ansible_host=10.104.16.41 ansible_connection=ssh ansible_user=lab1_5
pionier3 ansible_host=10.104.16.42 ansible_connection=ssh ansible_user=lab1_5
pionier4 ansible_host=10.104.16.44 ansible_connection=ssh ansible_user=lab1_5
pionier5 ansible_host=10.104.16.40 ansible_connection=ssh ansible_user=lab1_5
pionier6 ansible_host=10.104.16.45 ansible_connection=ssh ansible_user=lab1_5
[lab15_standard]
lab15-1 ansible_host=10.104.16.11 ansible_connection=ssh ansible_user=lab
lab15-2 ansible_host=10.104.16.12 ansible_connection=ssh ansible_user=lab
lab15-3 ansible_host=10.104.16.13 ansible_connection=ssh ansible_user=lab
lab15-4 ansible_host=10.104.16.14 ansible_connection=ssh ansible_user=lab
lab15-5 ansible_host=10.104.16.15 ansible_connection=ssh ansible_user=lab
lab15-6 ansible_host=10.104.16.16 ansible_connection=ssh ansible_user=lab
lab15-7 ansible_host=10.104.16.17 ansible_connection=ssh ansible_user=lab
lab15-8 ansible_host=10.104.16.18 ansible_connection=ssh ansible_user=lab
lab15-9 ansible_host=10.104.16.19 ansible_connection=ssh ansible_user=lab
lab15-10 ansible_host=10.104.16.20 ansible_connection=ssh ansible_user=lab
lab15-11 ansible_host=10.104.16.21 ansible_connection=ssh ansible_user=lab
lab15-12 ansible_host=10.104.16.22 ansible_connection=ssh ansible_user=lab
lab15-13 ansible_host=10.104.16.23 ansible_connection=ssh ansible_user=lab
lab15-14 ansible_host=10.104.16.24 ansible_connection=ssh ansible_user=lab
lab15-15 ansible_host=10.104.16.25 ansible_connection=ssh ansible_user=lab
lab15-16 ansible_host=10.104.16.26 ansible_connection=ssh ansible_user=lab
lab15-17 ansible_host=10.104.16.27 ansible_connection=ssh ansible_user=lab
lab15-18 ansible_host=10.104.16.28 ansible_connection=ssh ansible_user=lab
[all]
lab15-1 ansible_host=10.104.16.11 ansible_connection=ssh ansible_user=lab
lab15-2 ansible_host=10.104.16.12 ansible_connection=ssh ansible_user=lab
lab15-3 ansible_host=10.104.16.13 ansible_connection=ssh ansible_user=lab
lab15-4 ansible_host=10.104.16.14 ansible_connection=ssh ansible_user=lab
lab15-5 ansible_host=10.104.16.15 ansible_connection=ssh ansible_user=lab
lab15-6 ansible_host=10.104.16.16 ansible_connection=ssh ansible_user=lab
lab15-7 ansible_host=10.104.16.17 ansible_connection=ssh ansible_user=lab
lab15-8 ansible_host=10.104.16.18 ansible_connection=ssh ansible_user=lab
lab15-9 ansible_host=10.104.16.19 ansible_connection=ssh ansible_user=lab
lab15-10 ansible_host=10.104.16.20 ansible_connection=ssh ansible_user=lab
lab15-11 ansible_host=10.104.16.21 ansible_connection=ssh ansible_user=lab
lab15-12 ansible_host=10.104.16.22 ansible_connection=ssh ansible_user=lab
lab15-13 ansible_host=10.104.16.23 ansible_connection=ssh ansible_user=lab
lab15-14 ansible_host=10.104.16.24 ansible_connection=ssh ansible_user=lab
lab15-15 ansible_host=10.104.16.25 ansible_connection=ssh ansible_user=lab
lab15-16 ansible_host=10.104.16.26 ansible_connection=ssh ansible_user=lab
lab15-17 ansible_host=10.104.16.27 ansible_connection=ssh ansible_user=lab
lab15-18 ansible_host=10.104.16.28 ansible_connection=ssh ansible_user=lab
lab15-19 ansible_host=10.104.16.29 ansible_connection=ssh ansible_user=lab
lab15-20 ansible_host=127.0.0.1 ansible_connection=ssh ansible_user=lab
[lab15_standard:vars]
; ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q jdelicat@denali.kcir.pwr.edu.pl"'
ansible_python_interpreter=/usr/bin/python3
[lab15_special:vars]
ansible_python_interpreter=/usr/bin/python3
; ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q jdelicat@denali.kcir.pwr.edu.pl"'
[all:vars]
; ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q jdelicat@denali.kcir.pwr.edu.pl"'
ansible_python_interpreter=/usr/bin/python3
[pioniers:vars]
; ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q jdelicat@denali.kcir.pwr.edu.pl"'
ansible_python_interpreter=/usr/bin/python3

View File

@ -0,0 +1,66 @@
---
- hosts: '{{ variable_host | default("pioniers") }}'
gather_facts: no
become: yes
tasks:
- name: Recursively find /tmp files older than 2 days
find:
paths: /etc/netplan/00-installer-config-wifi.yaml
register: config_found
changed_when: config_found["matched"] == 0
- debug:
msg: "File doesn't exists"
when: config_found is changed
- name: Check wifi-configuration
lineinfile:
path: /etc/netplan/00-installer-config-wifi.yaml
regexp: '^LabL15_24'
state: absent
check_mode: yes
register: config_exists
when: config_found is succeeded
- name: Remove old wifi config
when:
- config_exists is changed
- config_found is succeeded
file:
path: /etc/netplan/00-installer-config-wifi.yaml
state: absent
- name: Create wifi file configuration
when:
# - config_exists is changed
- config_found is changed
file:
path: /etc/netplan/00-installer-config-wifi.yaml
state: touch
- name: Insert wifi-configuration
when:
- config_exists is changed
- config_found is succeeded
blockinfile:
path: /etc/netplan/00-installer-config-wifi.yaml
marker_begin: "Wifi configuration for pioniers ~Jakub Delicat"
marker_end: ""
block: |
# This is the network config written by 'subiquity'
network:
version: 2
wifis:
wlp1s0:
optional: true
access-points:
"LabL15_24":
password: "{{wifi_pass}}"
dhcp4: true

View File

@ -0,0 +1,34 @@
---
- hosts: '{{ variable_host | default("pioniers") }}'
gather_facts: no
become: yes
tasks:
- name: Update, upgrade
apt:
upgrade: yes
update_cache: yes
- name: Install git and docker
apt:
pkg:
- git
- docker.io
- name: Clone pioniers repository
git:
repo: https://denali.kcir.pwr.edu.pl/git/L1.5/rosaria.git
clone: yes
version: "docker20.04"
dest: /home/lab1_5/rosaria
- name: Install rosaria copy service
copy:
src: /home/lab1_5/rosaria/rosaria-docker.service
dest: /etc/systemd/system/rosaria-docker.service
remote_src: yes
- name: Enable and start service rosaria
systemd:
name: rosaria-docker
enabled: yes
state: restarted
daemon_reload: yes

View File

@ -0,0 +1,12 @@
---
- hosts: '{{ variable_host | default("pioniers") }}'
gather_facts: no
become: yes
tasks:
- name: Update pioniers repository
git:
repo: https://denali.kcir.pwr.edu.pl/git/L1.5/rosaria.git
clone: yes
update: yes
version: "docker20.04"
dest: /home/lab1_5/rosaria

View File

@ -0,0 +1,10 @@
---
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: Add Daniel ssh ublic key to lab
become: no
shell: echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDWH1G5Pavz/0oONeYQ/C7TGQ5lHNOPSeVEyhGE+N1jkwU54OFIVBQLCa6xR1cYXCKsXAx4mxoPUANl1ko7vsmRoatGEd7t7nIHoTzviLOH77Wt8FvgvIJ4x683ix3XMDlHfQ1r344fo3yzaINkIwz5wAhKo5cQfiNsmMmp1PCc2QW8Cv1RNVOJMkN8qFi3MAsX5NVzLBhOXS8wwObDR4ss6+HNOWUDazeNeOaOlc5gJFw7PuWlS/WiA0uqQ1Ze3lLkhDfRqvkFZfJI/kGSDuSCbS3R97iT6GF2i6XMQlEQmEhy2Zza8GD+dn9XhfBOvxeQ6pP5Bp0RbwhuG3RNNEcQZ2ssx4n0Cf/ecAgROblGgPdaIVGvzIqp8tAfZLPJlg6D5ec7+jRbKmvwl9ljAFl3aj/Lfxc6L1nIs0z8bxojLkytUKoYuYMV2rbNK+tCo1JODfvvT67qYlBMdpQXimcdkz3BfTH8zkLzIO5tdSCGzjiXByCjKGrmLhR1qFyB7+8= daniel.sadowski@pwr.edu.pl" >> .ssh/authorized_keys

View File

@ -0,0 +1,82 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
connection: local
tasks:
- debug:
msg: "{{ ansible_ssh_host }} {{ inventory_hostname}}"
# HOSTNAME
- name: Set /etc/hostname
ansible.builtin.hostname:
name: "{{ inventory_hostname }}"
- name: add a list of hosts to /etc/hosts
become: yes
lineinfile:
dest: /etc/hosts
regexp: "^{{ item['ip'] }}.*$"
line: "{{ item['ip'] }}\t\t{{ item['names'] | join(' ') }}"
state: present
with_items:
- ip: 127.0.0.1
names:
- localhost
- ip: 127.0.1.1
names:
- '{{ inventory_hostname }}'
- ip: 156.17.9.28
names:
- whitney.kcir.pwr.edu.pl
- whitney
- name: Set ROS_IP
community.general.ini_file:
path: /etc/environment
section: null
option: ROS_IP
value: "{{ansible_ssh_host}}"
backup: yes
no_extra_spaces: yes
- name: Disable autoupdate
debconf:
name: unattended-upgrades
question: unattended-upgrades/enable_auto_updates
value: 'false'
vtype: select
- name: Disable errors report
ini_file:
path: /etc/default/apport
section: null
option: enabled
value: '0'
backup: yes
no_extra_spaces: yes
- name: Create folder /etc/systemd/system/systemd-logind.service.d/
file:
path: /etc/systemd/system/systemd-logind.service.d/
state: directory
- name: Create file /etc/systemd/system/systemd-logind.service.d/override.conf
copy:
dest: /etc/systemd/system/systemd-logind.service.d/override.conf
content: |
[Service]
RestrictAddressFamilies=AF_INET
IPAddressAllow=156.17.9.28
- name: lab user password
user:
name: lab
password: "{{ 'Gandalf15' | password_hash('sha512') }}"

View File

@ -0,0 +1,54 @@
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
become: yes
tasks:
- name: Set GRUB_TIMEOUT_STYLE=menu
ini_file:
path: /etc/default/grub
section: null
option: GRUB_TIMEOUT_STYLE
value: menu
no_extra_spaces: yes
- name: Set GRUB_TIMEOUT=5
ini_file:
path: /etc/default/grub
section: null
option: GRUB_TIMEOUT
value: 5
no_extra_spaces: yes
- name: Set GRUB_SAVEDEFAULT=true
ini_file:
path: /etc/default/grub
section: null
option: GRUB_SAVEDEFAULT
value: 'true'
no_extra_spaces: yes
- name: Set GRUB_DEFAULT-saved
ini_file:
path: /etc/default/grub
section: null
option: GRUB_DEFAULT
value: saved
no_extra_spaces: yes
- name: Set GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nouveau.modeset=0 nvidia-drm.modeset=1"
ini_file:
path: /etc/default/grub
section: null
option: GRUB_CMDLINE_LINUX_DEFAULT
value: '"quiet splash nouveau.modeset=0 nvidia-drm.modeset=1"'
no_extra_spaces: yes
- name: update-grub
shell: update-grub2
register: grub_update
ignore_errors: true
- name: replace shimx64.efi with grubx64.efi
copy:
src: /boot/efi/EFI/ubuntu/grubx64.efi
dest: /boot/efi/EFI/ubuntu/shimx64.efi
remote_src: yes

View File

@ -0,0 +1,39 @@
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
become: yes
tasks:
- name: Ensure localisation files for '{{ config_system_locale }}' are available
locale_gen:
name: "{{ config_system_locale }}"
state: present
- name: Ensure localisation files for '{{ config_system_language }}' are available
locale_gen:
name: "{{ config_system_language }}"
state: present
- name: Get current locale and language configuration
command: localectl status
register: locale_status
changed_when: false
- name: Parse 'LANG' from current locale and language configuration
set_fact:
locale_lang: "{{ locale_status.stdout | regex_search('LANG=([^\n]+)', '\\1') | first }}"
- name: Parse 'LANGUAGE' from current locale and language configuration
set_fact:
locale_language: "{{ locale_status.stdout | regex_search('LANGUAGE=([^\n]+)', '\\1') | default([locale_lang], true) | first }}"
- name: LANGUAGE=pl_PL.UTF-8 in /etc/default/locale
ini_file:
path: /etc/default/locale
section: null
option: LANGUAGE
value: '{{ config_system_language }}'
no_extra_spaces: yes
- name: Configure locale to '{{ config_system_locale }}' and language to '{{ config_system_language }}'
command: localectl set-locale LANG='{{ config_system_locale }}' LANGUAGE='{{ config_system_language }}'
changed_when: locale_lang != config_system_locale or locale_language != config_system_language

View File

@ -0,0 +1,194 @@
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
become: yes
tasks:
- name: Install dependencies to LDAP and autofs
apt:
pkg:
- ssh
- openssh-server
- nscd
- autofs
- autofs-ldap
- libpam-ldap
- ldap-utils
- libnss-ldap
- name: /etc/ldap.conf set base dc=root,dc=kcir,dc=pwr,dc=edu,dc=pl
lineinfile:
path: /etc/ldap.conf
regexp: 'base dc'
line: 'base dc=root,dc=kcir,dc=pwr,dc=edu,dc=pl'
backrefs: yes
- name: /etc/ldap.conf set uri ldap://whitney.kcir.pwr.edu.pl/
lineinfile:
path: /etc/ldap.conf
regexp: 'ldapi'
line: 'uri ldap://whitney.kcir.pwr.edu.pl/'
backrefs: yes
- name: /etc/ldap.conf set ldap_version 3
lineinfile:
path: /etc/ldap.conf
regexp: 'ldap_version'
line: 'ldap_version 3'
backrefs: yes
- name: /etc/ldap.conf set binddn cn=ldap,dc=kcir,dc=pwr,dc=edu,dc=pl
lineinfile:
path: /etc/ldap.conf
regexp: 'binddn cn'
line: 'binddn cn=ldap,dc=kcir,dc=pwr,dc=edu,dc=pl'
backrefs: yes
- name: /etc/ldap.conf set bindpw .1kcir1.
lineinfile:
path: /etc/ldap.conf
regexp: 'bindpw'
line: 'bindpw .1kcir1.'
backrefs: yes
- name: /etc/ldap.conf set ssl start_tls
lineinfile:
path: /etc/ldap.conf
regexp: 'ssl start_tls'
line: 'ssl start_tls'
backrefs: yes
- name: /etc/nsswitch.conf automount files ldap
lineinfile:
path: /etc/nsswitch.conf
line: "automount:\tfiles ldap"
- name: /etc/nsswitch.conf passwd files systemd ldap
lineinfile:
path: /etc/ldap.conf
regexp: 'passwd:'
line: "passwd:\tfiles systemd ldap"
backrefs: yes
- name: /etc/nsswitch.conf group files systemd ldap
lineinfile:
path: /etc/ldap.conf
regexp: 'group:'
line: "group:\tfiles systemd ldap"
backrefs: yes
- name: /etc/nsswitch.conf shadow files ldap
lineinfile:
path: /etc/ldap.conf
regexp: 'shadow:'
line: "shadow:\tfiles ldap"
backrefs: yes
- name: Set /etc/autofs.conf ldap_uri = "ldap://whitney.kcir.pwr.edu.pl/"
ini_file:
path: /etc/autofs.conf
section: autofs
option: ldap_uri
value: '"ldap://whitney.kcir.pwr.edu.pl/"'
- name: Set /etc/autofs.conf search_base = "dc=kcir,dc=pwr,dc=edu,dc=pl"
ini_file:
path: /etc/autofs.conf
section: autofs
option: search_base
value: dc=kcir,dc=pwr,dc=edu,dc=pl
- name: Set /etc/autofs_ldap_auth.conf usetls
xml:
path: /etc/autofs_ldap_auth.conf
xpath: /autofs_ldap_sasl_conf
attribute: usetls
value: 'yes'
state: present
- name: Set /etc/autofs_ldap_auth.conf tlsrequired
xml:
path: /etc/autofs_ldap_auth.conf
xpath: /autofs_ldap_sasl_conf
attribute: tlsrequired
value: 'yes'
state: present
- name: Set /etc/autofs_ldap_auth.conf authrequired
xml:
path: /etc/autofs_ldap_auth.conf
xpath: /autofs_ldap_sasl_conf
attribute: authrequired
value: simple
state: present
- name: Set /etc/autofs_ldap_auth.conf user
xml:
path: /etc/autofs_ldap_auth.conf
xpath: /autofs_ldap_sasl_conf
attribute: user
value: cn=ldap,dc=kcir,dc=pwr,dc=edu,dc=pl
state: present
- name: Set /etc/autofs_ldap_auth.conf secret
xml:
path: /etc/autofs_ldap_auth.conf
xpath: /autofs_ldap_sasl_conf
attribute: secret
value: .1kcir1.
state: present
- name: make /etc/auto.home
file:
path: /etc/auto.home
state: touch
- name: /etc/auto.home lab localhost:/export/home/lab
lineinfile:
path: /etc/auto.home
line: "lab\tlocalhost:/export/home/lab"
- name: /etc/auto.home student localhost:/export/home/student
lineinfile:
path: /etc/auto.home
line: "student\tlocalhost:/export/home/student"
- name: /etc/auto.home +auto.home
lineinfile:
path: /etc/auto.home
line: '+auto.home'
- name: /etc/auto.master /home auto.home
lineinfile:
path: /etc/auto.master
line: "/home\tauto.home"
- name: mkdir mkdir -p /export/home
file:
path: /export/home
state: directory
- name: mv /home/* /export/home/
copy:
remote_src: true
src: /home/
dest: /export/home
owner: lab
group: lab
- name: Create folder /etc/systemd/system/systemd-logind.service.d/
file:
path: /etc/systemd/system/systemd-logind.service.d/
state: directory
- name: Create file /etc/systemd/system/systemd-logind.service.d/override.conf
copy:
dest: /etc/systemd/system/systemd-logind.service.d/override.conf
content: |
[Service]
RestrictAddressFamilies=AF_INET
IPAddressAllow=156.17.9.28
#FSTAB overlay /export/home/student overlay lowerdir=/export/home/student.base,upperdir=/export/home/student.upper,workdir=/export/home/student.work 0 0
#resolv.conf

View File

@ -0,0 +1,27 @@
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
become: yes
tasks:
- name: Install NTP
apt: package=ntp,ntpdate state=present update_cache=yes
tags: ntp
- name: Make sure NTP is stopped
service: name=ntp state=stopped enabled=yes
tags: ntp
- name: Sync time initialy
shell: ntpdate tempus1.gum.gov.pl
tags: ntp
- name: Make sure NTP is started up
service: name=ntp state=started enabled=yes
tags: ntp
- name: Sync hwclock
shell: hwclock -w
tags: ntp
handlers:
- name: restart ntpd
service: name=ntpd state=restarted

View File

@ -0,0 +1,22 @@
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: Create folder /etc/systemd/system/systemd-logind.service.d/
file:
path: /etc/systemd/system/systemd-logind.service.d/
state: directory
- name: Create file /etc/systemd/system/systemd-logind.service.d/override.conf
copy:
dest: /etc/systemd/system/systemd-logind.service.d/override.conf
content: |
[Service]
RestrictAddressFamilies=AF_INET
IPAddressAllow=156.17.9.28
# i deb conf

View File

@ -0,0 +1,10 @@
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
ignore_unreachable: yes
become: true
tasks:
- name: Add whitney to /etc/hosts
lineinfile:
path: /etc/hosts
line: '156.17.9.28\twhitney.kcir.pwr.edu.pl\twhitney'

View File

@ -0,0 +1,14 @@
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
ignore_unreachable: yes
become: true
tasks:
- name: Send file to
get_url:
url: https://denali.kcir.pwr.edu.pl/~jdelicat/gnome-shell-theme.gresource
dest: /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource
- name : restart gdm
service:
name: gdm
state: restarted

View File

@ -0,0 +1,15 @@
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
become: yes
tasks:
- name: Change lab15-9
replace:
path: /etc/hosts
regexp: 'lab15-9'
replace: '{{ inventory_hostname }}'
- name: Print this file
shell: cat /etc/hosts

View File

@ -0,0 +1,9 @@
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: Change wtmp log rotate time to one year
replace:
path: /etc/logrotate.d/wtmp
regexp: 'monthly'
replace: 'yearly'

View File

@ -0,0 +1,13 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
connection: local
tasks:
- name: Chown student base to student student
file:
path: /export/home/student.base
owner: student
group: student
state: directory
recurse: yes

View File

@ -0,0 +1,12 @@
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: Disable autoupdate
debconf:
name: unattended-upgrades
question: unattended-upgrades/enable_auto_updates
value: 'false'
vtype: select

View File

@ -0,0 +1,13 @@
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: Disable errors report
community.general.ini_file:
path: /etc/default/apport
section: null
option: enabled
value: '0'
backup: yes
no_extra_spaces: yes

View File

@ -0,0 +1,19 @@
---
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: add matlab alias to /etc/bash.bashrc
lineinfile:
path: /etc/bash.bashrc
line: 'alias matlab="matlab -desktop -softwareopengl"'
- name: add -softwareopengl to gnome icon
ini_file:
path: /usr/share/applications/matlab.desktop
section: Desktop Entry
option: Exec
value: matlab -desktop -softwareopengl
backup: yes
no_extra_spaces: yes

View File

@ -0,0 +1,21 @@
---
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: Remove old configuration
lineinfile:
path: /etc/default/locale
regexp: 'pl_PL.UTF-8'
state: absent
- name: Add LANG=pl_PL.UFT-8
ini_file:
path: /etc/default/locale
section: null
option: LANG
value: pl_PL.UTF-8
state: present

View File

@ -0,0 +1,13 @@
---
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
tasks:
- name: reboot the OS
reboot:
msg: "Reboot initiated by Ansible"
connect_timeout: 5
reboot_timeout: 30
pre_reboot_delay: 0
post_reboot_delay: 30
test_command: whoami
become: yes

View File

@ -0,0 +1,14 @@
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
become: yes
tasks:
- name: Comment rootbinddn in /etc/ldap.conf
lineinfile:
path: /etc/ldap.conf
regexp: 'rootbinddn cn=root,dc=kcir,dc=pwr,dc=edu,dc=pl'
line: '#rootbinddn cn=root,dc=kcir,dc=pwr,dc=edu,dc=pl'
backrefs: yes
- name: remove /etc/ldap.secret
shell: rm /etc/ldap.secret

View File

@ -0,0 +1,9 @@
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: matlab change licence from 27000 to 27001
replace:
path: /opt/matlab/R2020b/licenses/network.lic
regexp: '27000'
replace: '27001'

View File

@ -0,0 +1,9 @@
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
become: yes
tasks:
- name: Remove tmp from included path
lineinfile:
path: /opt/matlab/R2020b/toolbox/local/pathdef.m
state: absent
regexp: '^.*(/tmp/Editor_mmcjz:).*$'

View File

@ -0,0 +1,8 @@
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: Set nao license
become: yes
shell: /opt/choregraphe/bin/licensekey_cli_setter -s 654e-4564-153c-6518-2f44-7562-206e-4c60-5f47-5f45

View File

@ -0,0 +1,8 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
tasks:
- name: shutdown hosts
command: shutdown -h now
# when: ansible_facts['os_family'] == "Debian"
become: yes

View File

@ -0,0 +1,6 @@
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
become: yes
tasks:
- name: TEST
shell: echo dupa

View File

@ -0,0 +1,6 @@
---
- name: Send a magic Wake-on-LAN packet to 00:00:5E:00:53:66
community.general.wakeonlan:
mac: '40:a8:f0:56:2b:44'
broadcast: 10.104.16.30
delegate_to: localhost

View File

@ -0,0 +1 @@
# TODO:

View File

@ -0,0 +1,9 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: apt update
become: yes
shell: apt update -y

View File

@ -0,0 +1,9 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: apt upgrade
become: yes
shell: apt upgrade -y

View File

@ -0,0 +1,30 @@
---
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: create directories
file:
path: /opt/CodeComposer/TEMP
state: directory
- name: scp CodeComposer
become: no
shell: scp dsadowski@denali:/var/iso/Installers/CodeComposer.tar.gz ~
- name: mv Installer to TEMP
become: yes
shell: mv /home/lab/CodeComposer.tar.gz /opt/CodeComposer/TEMP
- name: unpack CodeComposer Installer
become: yes
shell: chdir=/opt/CodeComposer/TEMP tar xvf CodeComposer.tar.gz
- name: Run Installer
become: yes
shell: chdir=/opt/CodeComposer/TEMP/CCS11.1.0.00011_linux-x64 ./ccs_setup_11.1.0.00011.run --prefix /opt/CodeComposer --mode unattended --enable-components PF_MSP430,PF_MSP432,PF_CC2X,PF_CC3X,PF_CC2538,PF_C28,PF_TM4C,PF_HERCULES,PF_SITARA,PF_SITARA_MCU,PF_OMAPL,PF_DAVINCI,PF_OMAP,PF_TDA_DRA,PF_C55,PF_C6000SC,PF_C66AK_KEYSTONE,PF_MMWAVE,PF_C64MC,PF_DIGITAL_POWER,PF_PGA
- name: rm TEMP
become: yes
shell: chdir=/opt/CodeComposer rm -rf TEMP

View File

@ -0,0 +1,18 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: add apt key
apt_key:
url: https://packages.microsoft.com/keys/microsoft.asc
- name: add repository
apt_repository:
repo: deb [arch=amd64] https://packages.microsoft.com/repos/code stable main
- name: install code
apt:
name: code

View File

@ -0,0 +1,45 @@
---
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
connection: local
become: yes
tasks:
- name: remove snap eclipse
shell: snap remove eclipse
- name: download eclipse source
shell: wget https://rhlx01.hs-esslingen.de/pub/Mirrors/eclipse/technology/epp/downloads/release/2021-09/R/eclipse-java-2021-09-R-linux-gtk-x86_64.tar.gz -O /opt/eclipse.tar.gz
- name: unzip eclipse
shell: tar -xf /opt/eclipse.tar.gz --directory=/opt/
- name: remove downloaded .tar.gz
shell: rm -rf /opt/eclipse.tar.gz
- name: link eclipse to /usr/local/bin/
shell: ln -s /opt/eclipse/eclipse /usr/local/bin/
- name: download icon
shell: cp /opt/eclipse/icon.xpm /usr/share/icons/eclipse.xpm
- name: make icon to gnome
shell: printf '[Desktop Entry]\n
Version=1.0\n
Type=Application\n
Terminal=false\n
Exec=eclipse\n
Name=eclipse\n
Icon=eclipse\n
Categories=Development\n
Comment=Scientific computing environment\n
StartupNotify=true\n ' > /usr/share/applications/eclipse.desktop
- name: Download Papyrus
shell: wget https://denali.kcir.pwr.edu.pl/~jdelicat/papyrus.tar.gz -O /opt/papyrus.tar.gz
- name: untar
shell: tar -xf /opt/papyrus.tar.gz --directory=/opt/eclipse/dropins
- name: remove papyrus tar
shell: rm /opt/papyrus.tar.gz

View File

@ -0,0 +1,10 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: install ffmpeg
apt:
name: ffmpeg
state: present

View File

@ -0,0 +1,14 @@
---
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
connection: local
become: yes
tasks:
- name: read Geany repository
apt_repository:
repo: ppa:geany-dev/ppa
- name: install geany
apt:
pkg:
- geany

View File

@ -0,0 +1,10 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: install htop
apt:
name: htop
state: present

View File

@ -0,0 +1,10 @@
---
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
connection: local
become: yes
tasks:
- name: install ros-noetic-joy
apt:
pkg:
- ros-noetic-joy

View File

@ -0,0 +1,16 @@
---
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: install locate
apt:
name: locate
state: present
- name: Update database
become: yes
shell: updatedb

View File

@ -0,0 +1,10 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: install pydxl
pip:
name: pydxl

View File

@ -0,0 +1,15 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: install python
apt:
pkg:
- python3
- python3-pip
- python-is-python3
- python3-mock

View File

@ -0,0 +1,10 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: install python3-zmq
apt:
name: python3-zmq
state: present

View File

@ -0,0 +1,9 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: install python3-lxml
apt:
name: python3-lxml
state: present

View File

@ -0,0 +1,14 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: install libqt5serialport5
apt:
name: libqt5serialport5
state: present
- name: install libqt5serialport5-dev
apt:
name: libqt5serialport5-dev
state: present

View File

@ -0,0 +1,14 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: install rwho
apt:
name: rwho
state: present
- name: install rwhod
apt:
name: rwhod
state: present

View File

@ -0,0 +1,41 @@
---
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: Download saleae bin
get_url:
url: https://logic2api.saleae.com/download?os=linux
dest: /usr/local/bin/saleae
mode: '0755'
- name: Create new file
file:
path: /etc/udev/rules.d/99-SaleaeLogic.rules
state: touch
mode: '0644'
- name: rm old rules
shell: rm /etc/udev/rules.d/99-SaleaeLogic.rules
- name: Copy new rules
get_url:
url: https://denali.kcir.pwr.edu.pl/~jdelicat/files/99-SaleaeLogic.rules
dest: /etc/udev/rules.d/99-SaleaeLogic.rules
mode: '0644'
- name: Reload udev
shell: udevadm control --reload-rules
- name: make icon to gnome
shell: printf '[Desktop Entry]\n
Version=1.0\n
Type=Application\n
Terminal=false\n
Exec=saleae\n
Name=saleae\n
Icon=saleae\n
Categories=Development\n
Comment=Scientific computing environment\n
StartupNotify=true\n ' > /usr/share/applications/saleae.desktop

View File

@ -0,0 +1,10 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: install socat
apt:
name: socat
state: present

View File

@ -0,0 +1,11 @@
---
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: install terminator
apt:
name: terminator
state: latest

View File

@ -0,0 +1,11 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: install texlive-full
apt:
name: texlive-full
state: present

View File

@ -0,0 +1,10 @@
---
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
connection: local
become: yes
tasks:
- name: install tldr
apt:
pkg:
- tldr

View File

@ -0,0 +1,9 @@
---
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: install tree
apt:
name: tree
state: present

View File

@ -0,0 +1,15 @@
---
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: yes
tasks:
- name: install x2goserver
ansible.builtin.package:
name: x2goserver
state: present
- name: install x2goserver-xsession
ansible.builtin.package:
name: x2goserver-xsession
state: present

View File

@ -0,0 +1,8 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: Install xsnow from .deb
apt:
deb: https://www.ratrabbit.nl/downloads/xsnow/xsnow_3.3.6-1_amd64.deb

View File

@ -0,0 +1,68 @@
---
- hosts: "{{ variable_host | default('lab15_standard') }}"
gather_facts: no
become: yes
tasks:
- name: install python3-zmq
apt:
pkg: python3-zmq
# LibSodium
- name: Make temp folder
file:
path: /temp
state: mkdir
- name: download sources libsodium c++
get_url: url=https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz dest=/temp
- name: untar libsodium
unarchive:
src: /temp/libsodium-1.0.18.tar.gz
dest: /temp
- name: run libsodium configure scirpt
script: /temp/libsodium-1.0.18/configure
- name: Build the default target /temp/libsodium-1.0.18/
make:
chdir: /temp/libsodium-1.0.18/
- name: Build the default target /temp/libsodium-1.0.18/
make:
chdir: /temp/libsodium-1.0.18/
- name: Run 'install' target /temp/libsodium-1.0.18/
make:
chdir: /temp/libsodium-1.0.18/
target: install
# ZeroMQ - C++
- name: download sources zeromq c++
get_url: url=https://archive.org/download/zeromq_4.1.4/zeromq-4.1.4.tar.gz dest=/temp
- name: untar zeromq
unarchive:
src: /temp/zeromq-4.1.4.tar.gz
dest: /temp
- name: run zeromq configure scirpt
script: /temp/zeromq-4.1.4/configure
- name: Build the default target /temp/zeromq-4.1.4/
make:
chdir: /temp/zeromq-4.1.4/
- name: Build the default target /temp/zeromq-4.1.4/
make:
chdir: /temp/zeromq-4.1.4/
- name: Run 'install' target /temp/zeromq-4.1.4/
make:
chdir: /temp/zeromq-4.1.4/
target: install
- name: Clean temp folder
file:
path: /temp
state: absent

View File

@ -0,0 +1,23 @@
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
become: yes
tasks:
- name: Update and upgrade software
apt:
upgrade: yes
update_cache: yes
pkg:
- vim
- name: Configure ntp server
import_playbook: config/config_ntp.yaml
- name: Configure grub
import_playbook: config/config_grub.yaml
- name: Configure LDAP
import_playbook: config/config_ldap.yaml

View File

@ -0,0 +1,11 @@
---
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
become: yes
tasks:
- name: Set authorized key taken from file
ansible.posix.authorized_key:
user: lab
state: present
# Sends keys from this file
key: "{{ lookup('file', '../authorized_pub_sshkeys') }}"

View File

@ -0,0 +1,12 @@
---
- hosts: "{{ variable_host | default(lab15_standard) }}"
gather_facts: no
become: no
tasks:
- name: Check who is in lab
become: no
shell: who
register: out
- debug: msg="{{ out.stdout_lines }}"

52
scripts/computer.py Normal file
View File

@ -0,0 +1,52 @@
# @brief
import os
import string
import subprocess
# Error thrower
def ThrowError(error_text):
raise Exception("[Error]: " + error_text)
def ExecAnsibleCommand(command):
output = os.popen(command).read()
if output.find("SUCCESS") != -1:
return 0
else:
return output
# Comupter informations
class Computer:
id = 0
name = ""
mac = "0000.0000.000"
status = False
logged_users = []
def __init__(self, name):
if name[:6] != "lab15-":
ThrowError("Bad computer name: '" + name + "'")
if (name[6:].isnumeric()) == False:
ThrowError("Bad computer number: '" + name[6:] +"'")
self.name = name
self.id = int(name[6:])
def GetStatus(self):
command = "ansible -i inventory/hosts.ini -m ping " + self.name + " -k"
if ExecAnsibleCommand(command):
return 0
return 1
# Tester
lab = Computer("lab15-10")
print(lab.GetStatus())