Сергей Антоненко hace 2 años
padre
commit
dc72b378fc

+ 7 - 0
LICENSE

@@ -1,2 +1,9 @@
 # software-playbooks
 
+В репозитории список плейбуков, в дальнейшем будет сформирован в роли
+
+### sudoedit.yml
+
+Позволяет управлять правами пользователя на запуск приложений в привилегированом режиме
+
+[Ссылка на документацию](https://docs.ansible.com/ansible/latest/collections/community/general/sudoers_module.html)

BIN
files/wallpaper.jpg


+ 17 - 0
inventory/hosts

@@ -0,0 +1,17 @@
+[test_group]
+userps ansible_host=192.168.122.73
+
+[local]
+notebook ansible_host=127.0.0.1
+
+
+[kc41]
+pc1 ansible_host=192.168.1.124
+pc2 ansible_host=192.168.1.62
+pc3 ansible_host=192.168.1.21
+pc4 ansible_host=192.168.1.143
+pc5 ansible_host=192.168.1.199
+pc6 ansible_host=192.168.1.122
+pc7 ansible_host=192.168.1.196
+pc8 ansible_host=192.168.1.159
+pc9 ansible_host=192.168.1.170

+ 38 - 0
playbooks/add_stream_shortcut.yml

@@ -0,0 +1,38 @@
+---
+    - hosts: local
+      vars:
+        release: focal
+        user_permission: vidikon
+        stream_multicast_link: 'udp://@224.0.0.230:8001'
+        icon_patch: /home/{{ user_permission }}/icons
+        shortcut_ico_path: "{{ icon_patch }}/stream-icon.png"
+      become: true
+      gather_facts: no
+      tasks:
+        
+        - name: Install VLC
+          ansible.builtin.apt:
+            pkg:
+              - vlc
+
+        - name: Create icon dir
+          ansible.builtin.file:
+            path: "{{ icon_patch }}"
+            owner: "{{ user_permission }}"
+            group: "{{ user_permission }}"
+            state: directory
+
+        - name: Copy icon
+          ansible.builtin.copy:
+            src: /home/vidikon/ANSIBLE/software-playbooks/ico/stream-icon.png
+            dest: "{{ icon_patch }}"
+            owner: "{{ user_permission }}"
+            group: "{{ user_permission }}"
+
+        - name: Copy shortcut template
+          ansible.builtin.template: 
+            src: /home/vidikon/ANSIBLE/software-playbooks/program_shortcut/Connect.j2
+            dest: '/home/vidikon/Рабочий стол/Connect.desktop'
+            owner: "{{ user_permission }}"
+            group: "{{ user_permission }}"
+            mode: u=rwx,g=rwx,o=r

+ 29 - 0
playbooks/change-wallpapers.yml

@@ -0,0 +1,29 @@
+---
+    - hosts: kc41
+      vars:
+        release: focal
+        winetricks_patch: /usr/bin
+        prefix_dir: /usr/prefixes
+        prefix_path: /usr/prefixes/msapps
+        user_permission: student
+        officepath: /home/vidikon/ANSIBLE/Office2013.tar.gz
+      become: true
+      gather_facts: no
+      tasks:
+
+        - name: Copy wallpaper
+          ansible.builtin.copy:
+            src: /home/vidikon/ANSIBLE/software-playbooks/files/wallpaper.jpg
+            dest: /home/
+            owner: "{{ user_permission }}"
+            group: "{{ user_permission }}"
+        #1000 для pc9, 1001 для остальных
+        - name: Set wallpaper
+          vars:
+            DISPLAY: ":0"
+          ansible.builtin.shell: "sudo -H -u student DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id {{ user_permission }} | awk -F '=' '{print $2}' | awk -F '(' '{print $1}')/bus DISPLAY=:0 gsettings set org.cinnamon.desktop.background picture-uri 'file:///home/wallpaper.jpg'"
+        - name: Ensure a job that runs at 2 and 5 exists. Creates an entry like "0 5,2 * * ls -alh > /dev/null"
+          ansible.builtin.cron:
+            name: "check wallpaper"
+            minute: "*/5"
+            job: "sudo -H -u student DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id {{ user_permission }} | awk -F '=' '{print $2}' | awk -F '(' '{print $1}')/bus DISPLAY=:0 gsettings set org.cinnamon.desktop.background picture-uri 'file:///home/wallpaper.jpg'"  

+ 53 - 0
playbooks/copy-office-2010.yml

@@ -0,0 +1,53 @@
+---
+    - hosts: kc41
+      vars:
+        release: focal
+        winetricks_patch: /usr/bin
+        prefix_dir: /usr/prefixes
+        prefix_path: /usr/prefixes/msapps2010
+        user_permission: oktadmin
+        officepath: /home/vidikon/ANSIBLE/2010.Office.exe
+      #become: true
+      gather_facts: no
+      tasks:
+
+        - name: Copy Office files
+          become: true
+          block:
+#            - name: Copy Offcie 2010 archive file with owner and permission
+#              ansible.builtin.copy:
+#                src: "{{ officepath }}"
+#                dest: /tmp/Office2010.exe
+#                owner: "{{ user_permission }}"
+#                group: "{{ user_permission }}"
+#                mode: u=rw,g=rw,o=r
+            - name: Copy winetrics file with owner and permission
+              ansible.builtin.copy:
+                src: "/home/vidikon/ANSIBLE/software-playbooks/scripts/winetricks"
+                owner: "{{ user_permission }}"
+                group: "{{ user_permission }}"
+                dest: /usr/bin/winetricks
+                mode: u=rwx,g=rwx,o=wr
+
+        - name: Create prefix
+          block: 
+            - name: Create a directory if it does not exist
+              become: true
+              ansible.builtin.file:
+                path: "{{ prefix_dir }}"
+                owner: "{{ user_permission }}"
+                group: "{{ user_permission }}"
+                state: directory
+            - name: Create Office prefix
+              ansible.builtin.shell: env WINEARCH=win32 WINEPREFIX={{ prefix_path }} wineboot -u
+            - name: Download font
+              ansible.builtin.shell: env WINEARCH=win32 WINEPREFIX={{ prefix_path }} {{ winetricks_patch }}/winetricks corefonts allfonts 
+            - name: Download lib
+              ansible.builtin.shell: env WINEARCH=win32 WINEPREFIX={{ prefix_path }} {{ winetricks_patch }}/winetricks msxml3 msxml4 msxml6 vcrun2015 dotnet40 gdiplus riched30 mfc42 mfc140 vcrun6
+              register: libinstall
+            - debug: msg="{{ libinstall }}"        
+        
+    
+
+    
+    

+ 44 - 0
playbooks/install-anydesk.yml

@@ -0,0 +1,44 @@
+---
+    - hosts: kc41
+      vars:
+        release: focal
+        winetricks_patch: /usr/bin
+        prefix_dir: /usr/prefixes
+        prefix_path: /usr/prefixes/msapps
+        user_permission: student
+        officepath: /home/vidikon/ANSIBLE/Office2013.tar.gz
+      #become: true
+      gather_facts: no
+      tasks:
+
+       
+    
+        - name: Copy anydesk deb
+          become: true
+          block:
+            - name: Create a directory if it does not exist
+              ansible.builtin.file:
+                path: /tmp/anydesk
+                owner: "{{ user_permission }}"
+                group: "{{ user_permission }}"
+                state: directory
+            - name: Copy Anydesk
+              ansible.builtin.copy:
+                src: "/home/vidikon/ANSIBLE/deb/anydesk_6.3.0-1_amd64.deb"
+                dest: "/tmp/anydesk/"
+                owner: "{{ user_permission }}"
+                group: "{{ user_permission }}"
+                mode: u=rwx,g=rwx,o=r
+        - name: Install the build dependencies for package "foo"
+          become: true
+          ansible.builtin.apt:
+            deb: /tmp/anydesk/anydesk_6.3.0-1_amd64.deb
+        - name: Install dependencies
+          become: true
+          ansible.builtin.shell: apt install -f    
+
+
+
+
+    
+    

+ 53 - 0
playbooks/install-arduino-ide.yml

@@ -0,0 +1,53 @@
+---
+    - hosts: kc41
+      vars:
+        release: focal
+        winetricks_patch: /usr/bin
+        prefix_dir: /usr/prefixes
+        prefix_path: /usr/prefixes/msapps
+        user_permission: student
+        officepath: /home/vidikon/ANSIBLE/Office2013.tar.gz
+      #become: true
+      gather_facts: no
+      tasks:
+
+       
+    
+        - name: Install Arduino IDE
+          become: true
+          block:
+            - name: Create a directory if it does not exist
+              ansible.builtin.file:
+                path: /usr/arduinoide/
+                owner: "{{ user_permission }}"
+                group: "{{ user_permission }}"
+                state: directory
+        #    - name: Unarchive a IDE that needs to be downloaded 
+        #      ansible.builtin.unarchive:
+        #        src: https://downloads.arduino.cc/arduino-ide/arduino-ide_2.2.1_Linux_64bit.zip
+        #        dest: /usr/arduinoide/
+        #        remote_src: yes
+        #    - name: Create symbolic link 
+        #      ansible.builtin.file:
+        #        src: "/usr/arduinoide/arduino-ide_2.2.1_Linux_64bit/arduino-ide"
+        #        dest: "/usr/bin/arduino-ide"
+        #        state: link
+
+            - name: Grant user permission for access ttyACM
+              ansible.builtin.shell: usermod -a -G dialout {{ user_permission }}    
+          #  - name: Run installer Arduino IDE
+          #    ansible.builtin.shell: "sh export DISPLAY=:0; sh /usr/bin/arduino-ide &"
+            - name: Create a directory if it does not exist
+              ansible.builtin.file:
+                path: "/home/student/Рабочий стол/cc.arduino.arduinoide.desktop"
+                state: absent
+            - name: Copy IDE icon file with owner and permission
+              ansible.builtin.copy:
+                src: "/home/vidikon/ANSIBLE/software-playbooks/files/arduino-ide.desktop"
+                dest: "/home/student/Рабочий стол/"
+                owner: "{{ user_permission }}"
+                group: "{{ user_permission }}"
+                mode: u=rwx,g=rwx,o=r
+
+    
+    

+ 38 - 0
playbooks/install-software-repo.yml

@@ -0,0 +1,38 @@
+---
+    - hosts: pc9
+      vars:
+        release: focal
+        winetricks_patch: /usr/bin
+        prefix_dir: /usr/prefixes
+        prefix_path: /usr/prefixes/msapps
+        user_permission: student
+        officepath: /home/vidikon/ANSIBLE/Office2013.tar.gz
+      become: true
+      gather_facts: no
+      tasks:
+
+#        - name: add ppa libreoffice
+#          ansible.builtin.apt_repository:
+#            repo: ppa:libreoffice/ppa
+#            codename: "{{ release }}"
+#            state: absent
+        - name: add ppa gimp
+          ansible.builtin.apt_repository:
+            repo: ppa:ubuntuhandbook1/gimp
+            codename: "{{ release }}"
+#            state: absent
+   #     - name: dpkg --configure -a
+   #       shell: 
+   #         cmd: dpkg --configure -a
+        - name: install software
+          ansible.builtin.apt: 
+            pkg: 
+              - libreoffice
+              - gimp
+        - name: install software
+          ansible.builtin.apt: 
+            pkg: 
+              - libreoffice-grammarcheck-ru
+              - libreoffice-help-ru 
+              - libreoffice-l10n-ru
+              - libreoffice-lightproof-ru-ru

+ 91 - 0
playbooks/install-wine.yml

@@ -0,0 +1,91 @@
+---
+- hosts: pc8
+  vars:
+    release: focal
+    winetricks_patch: /usr/bin
+    prefix_dir: /usr/prefixes
+    prefix_path: /usr/prefixes/msapps
+    user_permission: oktadmin
+    officepath: /home/vidikon/ANSIBLE/Office2013.tar.gz
+  #become: true
+  gather_facts: no
+  tasks:
+#    - name: dpkg --configure -a
+#      become: true
+#      ansible.builtin.shell: dpkg --remove --force-remove-reinstreq packettracer
+#    - name: Upgrade all packets
+#      become: true
+#      ansible.builtin.apt:
+#        name: "*"
+#        state: latest
+
+
+    - name: wine (add architecture)
+      become: true
+      shell: 
+        cmd: dpkg --add-architecture i386
+
+    - name: install software-properties-common deb
+      become: true
+      ansible.builtin.apt: 
+        pkg: 
+        - software-properties-common
+        - dirmngr
+        - ca-certificates
+        - apt-transport-https
+        - curl
+        
+
+    - name: One way to avoid apt_key once it is removed from your distro
+      become: true
+      block:
+        - name: add key
+          ansible.builtin.shell: curl -s https://dl.winehq.org/wine-builds/winehq.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/winehq.gpg > /dev/null
+
+        #- name: somerepo |no apt key
+        #  ansible.builtin.get_url:
+        #    url: https://dl.winehq.org/wine-builds/winehq.key
+        #    dest: /usr/share/keyrings/winehq.gpg
+
+        - name: add repo
+          ansible.builtin.apt_repository:
+            repo: "deb [signed-by=/usr/share/keyrings/winehq.gpg] http://dl.winehq.org/wine-builds/ubuntu/ {{ release }} main"
+            state: present
+
+        - name: install Wine deb
+          ansible.builtin.apt: 
+            pkg: 
+            - winehq-stable
+            - winetricks
+            update_cache: yes
+
+    - name: Create prefix dir
+      become: true
+      block:
+        - name: Copy winetrics file with owner and permission
+          ansible.builtin.copy:
+            src: "/home/vidikon/ANSIBLE/software-playbooks/scripts/winetricks"
+            owner: "{{ user_permission }}"
+            group: "{{ user_permission }}"
+            dest: /usr/bin/winetricks
+            mode: u=rwx,g=rwx,o=wr
+        - name: Create a directory if it does not exist
+          ansible.builtin.file:
+            path: "{{ prefix_dir }}"
+            owner: "{{ user_permission }}"
+            group: "{{ user_permission }}"
+            state: directory
+    - name: Create prefix
+      block: 
+   #     - name: Create Office prefix
+   #       ansible.builtin.shell: env WINEARCH=win32 WINEPREFIX={{ prefix_path }} wineboot -u
+   #     - name: Download font
+   #       ansible.builtin.shell: env WINEARCH=win32 WINEPREFIX={{ prefix_path }} {{ winetricks_patch }}/winetricks corefonts allfonts 
+        - name: Download lib
+          ansible.builtin.shell: env WINEARCH=win32 WINEPREFIX={{ prefix_path }} {{ winetricks_patch }}/winetricks  --torify msxml3 msxml4 msxml6 vcrun2015 dotnet40 gdiplus riched30 mfc42 mfc140 vcrun6
+          register: libinstall
+        - debug: msg="{{ libinstall }}"
+
+    
+
+

+ 66 - 0
playbooks/install_onlyoffice.yml

@@ -0,0 +1,66 @@
+---
+- hosts: local
+  tasks:
+
+    - name: create gpg key Onlyoffice
+      shell: 
+        cmd: gpg --no-default-keyring --keyring gnupg-ring:/tmp/onlyoffice.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
+
+    - name: install gpg key Onlyoffice
+      file: 
+        path: /tmp/onlyoffice.gpg
+        state: touch
+        owner: root
+        group: root
+        mode: '644'
+    - name: copy key Onlyoffice
+      copy:
+        remote_src: yes
+        src: /tmp/onlyoffice.gpg
+        dest: /etc/apt/trusted.gpg.d/
+
+    - name: add Onlyoffcie to sources.list
+      ansible.builtin.apt_repository:
+        repo: deb https://download.onlyoffice.com/repo/debian squeeze main
+        state: present
+        filename: onlyoffice.list
+
+    - name: install software-properties-common deb
+      ansible.builtin.apt: 
+        pkg: 
+        - software-properties-common
+        - gtk2-engines-pixbuf
+        - gtk2-engines-murrine
+        
+   
+    - name: install Onlyoffice deb
+      ansible.builtin.apt: 
+        pkg: 
+        - onlyoffice-desktopeditors
+        update_cache: yes
+
+
+    - name: remove Libreoffice
+      ansible.builtin.apt:
+        name: libreoffice*
+        state: absent
+#    - name: change theme to Pop
+ #     shell: 
+#        cmd: "{{ item }}"
+#      loop: 
+#        - gsettings set org.cinnamon.theme name 'pop-gtk-theme'
+#        - gsettings set org.gnome.desktop.interface icon-theme "pop-icon-theme"
+
+#    - name: clear useless package
+#      ansible.builtin.apt: 
+#        autoclean: yes
+    - name: copy Onlyoffcie icon
+      ansible.builtin.copy: 
+        src: /tmp/git/files/onlyoffice-desktopeditors.desktop
+        dest: /home/user/Рабочий\ стол/
+        owner: user 
+        group: user
+        mode: u=rw,g=rw,o=r
+
+
+        

+ 22 - 0
playbooks/sudoedit.yml

@@ -0,0 +1,22 @@
+---
+    - hosts: local
+      vars:
+        release: focal
+        user_permission: vidikon
+        stream_multicast_link: 'udp://@224.0.0.230:8001'
+        icon_patch: /home/{{ user_permission }}/icons
+        shortcut_ico_path: "{{ icon_patch }}/stream-icon.png"
+      become: true
+      gather_facts: no
+      tasks:
+      
+        - name: Allow tcpdump
+          community.general.sudoers:
+            name: allow-tcpdump
+            state: present
+            user: vidikon
+            commands: /usr/bin/tcpdump
+            nopassword: true 
+            validation: absent
+
+

+ 9 - 0
program_shortcut/Connect.desktop

@@ -0,0 +1,9 @@
+[Desktop Entry]
+Version=1.0
+Name=Подключиться к трансляции
+Comment=описание
+Exec=vlc -f {{ stream_multicast_link }}
+Icon={{ shortcut_ico_path }}stream-icon.png
+Terminal=false
+Type=Application
+Categories=Video

+ 9 - 0
program_shortcut/Connect.j2

@@ -0,0 +1,9 @@
+[Desktop Entry]
+Version=1.0
+Name=Подключиться к трансляции
+Comment=описание
+Exec=vlc -f {{ stream_multicast_link }}
+Icon={{ shortcut_ico_path }}
+Terminal=false
+Type=Application
+Categories=Video

+ 0 - 0
files/arduino-ide.desktop → program_shortcut/arduino-ide.desktop


+ 0 - 0
files/onlyoffice-desktopeditors.desktop → program_shortcut/onlyoffice-desktopeditors.desktop


+ 0 - 0
scripts/winetricks