From a4d538922e75a601c26386aae799e96fcaf3475f Mon Sep 17 00:00:00 2001 From: root Date: Wed, 30 Sep 2026 16:38:30 +0000 Subject: [PATCH] konfigurace vimu --- inventory-init.yml | 6 --- inventory.yml | 7 ++- playbooks/dovecot.yml | 12 ----- playbooks/first.yml | 7 --- playbooks/hw.yml | 10 ---- playbooks/initsystem.yml | 18 +++---- playbooks/initsystem2.yml | 96 ++++++++++++++++++++++++++++++++++++ playbooks/update-pkgs.yml | 2 +- playbooks/vytocit-gitlab.yml | 58 ---------------------- 9 files changed, 108 insertions(+), 108 deletions(-) delete mode 100644 inventory-init.yml delete mode 100644 playbooks/dovecot.yml delete mode 100644 playbooks/first.yml delete mode 100644 playbooks/hw.yml create mode 100644 playbooks/initsystem2.yml delete mode 100644 playbooks/vytocit-gitlab.yml diff --git a/inventory-init.yml b/inventory-init.yml deleted file mode 100644 index 0afe704..0000000 --- a/inventory-init.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -mailservers: - hosts: - devtest: - ansible_host: 192.168.162.50 - ansible_user: root diff --git a/inventory.yml b/inventory.yml index 332ecbb..5d1fcfc 100644 --- a/inventory.yml +++ b/inventory.yml @@ -1,6 +1,5 @@ --- -mailservers: +githosts: hosts: - devtest: - ansible_host: 192.168.162.50 - ansible_user: ansibler + forgejo: + ansible_host: 192.168.162.60 diff --git a/playbooks/dovecot.yml b/playbooks/dovecot.yml deleted file mode 100644 index a0bf5c2..0000000 --- a/playbooks/dovecot.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Instalace Dovecotu - hosts: mailservers - - tasks: - - name: NonPriv test - ping: - - name: Install Dovecot - ansible.builtin.apt: - name: vim - state: present - diff --git a/playbooks/first.yml b/playbooks/first.yml deleted file mode 100644 index a7191df..0000000 --- a/playbooks/first.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Prvni Playbook - hosts: devtest - - tasks: - - name: "Test Connectivity" - ping: diff --git a/playbooks/hw.yml b/playbooks/hw.yml deleted file mode 100644 index 5de432c..0000000 --- a/playbooks/hw.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -- name: 2nd Playbook - hosts: localhost - - tasks: - - name: Print Hello World - debug: msg="Hello World" - - - name: pingtest - ping: diff --git a/playbooks/initsystem.yml b/playbooks/initsystem.yml index ea81f03..f05ebb5 100644 --- a/playbooks/initsystem.yml +++ b/playbooks/initsystem.yml @@ -1,24 +1,24 @@ -# Jen kopie vim.yml, kterou chci upravit -# Ma za ukol vytvorit uzivatele ansibler, nahrat mu klic, a zrusit klic z roota z onboardingu +# Init Ansible playbook -- name: Konfigurace Vimu - hosts: devtest +- name: Inicializacni Playbook + hosts: all gather_facts: yes become: no + remote_user: root tasks: - - name: Uzivatelske Ucty + - name: Vyrobit uzivatele Ansibler user: name: ansibler create_home: true comment: "JCH" shell: "/bin/bash" - - name: instalace sudo + - name: Instalace sudo apt: name: sudo state: present update_cache: true - - name: ansible sudoer + - name: uzivatel Ansibler bude sudo copy: owner: root group: root @@ -36,7 +36,7 @@ path: "{{ item.path }}" loop: - {path: "/home/ansibler/.ssh"} - - name: SSH klic ansibler + - name: SSH klic uzivatele Ansibler copy: owner: ansibler group: ansibler @@ -50,5 +50,3 @@ path: /root/.ssh/authorized_keys state: absent - - diff --git a/playbooks/initsystem2.yml b/playbooks/initsystem2.yml new file mode 100644 index 0000000..788717a --- /dev/null +++ b/playbooks/initsystem2.yml @@ -0,0 +1,96 @@ +--- +- name: Inicializace systemu 2 + hosts: all + + tasks: + - name: update a upgrade + become: yes + apt: + update_cache: true + upgrade: full + + - name: Instalace Balicku + become: yes + package: + name: "{{ item }}" + state: present + loop: + - [ vim, git, mc, curl, wget, btop ] + + + - name: Uzivatel martus + become: yes + user: + name: martus + create_home: true + comment: "Martus Dortus" + shell: "/bin/bash" + - name: Adresarova Struktura /home/martus + vars: + homedir_path: "/home/martus/" + become: yes + file: + state: directory + force: true + mode: 0750 + owner: martus + group: martus + path: "{{ item }}" + loop: + - "{{ homedir_path }}.ssh" + - "{{ homedir_path }}.vim" + - "{{ homedir_path }}.vim/swap" + - "{{ homedir_path }}.vim/backup" + - "{{ homedir_path }}.vim/bundle" + - "{{ homedir_path }}.vim/autoload" + + - name: Stazeni dotfiles + become: yes + vars: + homedir_path: "/home/martus/" + get_url: + dest: "{{ item.dst }}" + url: "{{ item.src }}" + backup: yes + force: true + mode: 0640 + owner: martus + group: martus + loop: + - {src: "https://www.martus.cz/soubory/ansible/bashrc.txt", dst: "{{ homedir_path }}.bashrc"} + - {src: "https://www.martus.cz/soubory/ansible/vimrc.txt", dst: "{{ homedir_path }}.vimrc"} + - {src: "https://tpo.pe/pathogen.vim", dst: "{{ homedir_path }}.vim/autoload/pathogen.vim"} + + - name: SSH klice martus + become: yes + copy: + owner: martus + group: martus + mode: 0750 + src: "{{ item.src }}" + dest: "{{item .dst }}" + loop: + - {src: "../soubory/klice/martus/authorized_keys", dst: "/home/martus/.ssh/authorized_keys"} + + - name: martus sudo + become: yes + copy: + owner: root + group: root + mode: 700 + src: /root/gitrepo/ansible/soubory/sudo/martus + dest: /etc/sudoers.d/martus + + - name: Vim Pluginy + become: yes + vars: + homedir_path: "/home/martus/" + git: + dest: "{{ homedir_path }}.vim/bundle/{{ item.name }}" + repo: "{{ item.url }}" + clone: yes + update: yes + recursive: no + loop: + - { name: gruvbox, url: https://github.com/morhetz/gruvbox.git } + diff --git a/playbooks/update-pkgs.yml b/playbooks/update-pkgs.yml index 9dc0dc7..8f50576 100644 --- a/playbooks/update-pkgs.yml +++ b/playbooks/update-pkgs.yml @@ -1,6 +1,6 @@ --- - name: upgrade balicku - hosts: devtest + hosts: all tasks: - name: update a upgrade diff --git a/playbooks/vytocit-gitlab.yml b/playbooks/vytocit-gitlab.yml deleted file mode 100644 index 9267aa9..0000000 --- a/playbooks/vytocit-gitlab.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -- name: playbook pro vytoceni gitu (je rozsirenim update-pkgs) - hosts: devtest - - tasks: - - name: update a upgrade - become: yes - apt: - update_cache: true - upgrade: full - - - name: Uzivatel martus - become: yes - user: - name: martus - create_home: true - comment: "Martus Dortus" - shell: "/bin/bash" - - name: Adresarova Struktura /home/martus - become: yes - file: - state: directory - force: true - mode: 0750 - owner: martus - group: martus - path: "{{ item.path }}" - loop: - - {path: "/home/martus/.ssh"} - - name: SSH klice martus - become: yes - copy: - owner: martus - group: martus - mode: 0750 - src: "{{ item.src }}" - dest: "{{item .dst }}" - loop: - - {src: "../soubory/klice/martus/authorized_keys", dst: "/home/martus/.ssh/authorized_keys"} - - name: martus sudo - become: yes - copy: - owner: root - group: root - mode: 700 - src: /root/gitrepo/ansible/soubory/sudo/martus - dest: /etc/sudoers.d/martus - - name: Instalace Balicku - become: yes - package: - name: "{{ item }}" - state: present - loop: - - [ vim, mc, curl, wget, btop ] - - - -