From 56dd1448c098b0807fd893c54fc9bc3772314f82 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 30 Sep 2026 14:56:59 +0000 Subject: [PATCH] role na gitlab --- inventory-init.yml | 2 +- inventory.yml | 2 +- playbooks/update-pkgs.yml | 36 +++++++++++++++++ playbooks/vytocit-gitlab.yml | 58 ++++++++++++++++++++++++++++ soubory/klice/martus/authorized_keys | 2 + soubory/sudo/martus | 2 + 6 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 playbooks/vytocit-gitlab.yml create mode 100644 soubory/klice/martus/authorized_keys create mode 100644 soubory/sudo/martus diff --git a/inventory-init.yml b/inventory-init.yml index 0863250..0afe704 100644 --- a/inventory-init.yml +++ b/inventory-init.yml @@ -2,5 +2,5 @@ mailservers: hosts: devtest: - ansible_host: 192.168.162.35 + ansible_host: 192.168.162.50 ansible_user: root diff --git a/inventory.yml b/inventory.yml index 26d26e2..332ecbb 100644 --- a/inventory.yml +++ b/inventory.yml @@ -2,5 +2,5 @@ mailservers: hosts: devtest: - ansible_host: 192.168.162.35 + ansible_host: 192.168.162.50 ansible_user: ansibler diff --git a/playbooks/update-pkgs.yml b/playbooks/update-pkgs.yml index 195636a..9dc0dc7 100644 --- a/playbooks/update-pkgs.yml +++ b/playbooks/update-pkgs.yml @@ -9,4 +9,40 @@ 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 klic ansibler + 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: ansible sudoer + become: yes + copy: + owner: root + group: root + mode: 700 + src: /root/gitrepo/ansible/soubory/sudo/martus + dest: /etc/sudoers.d/martus diff --git a/playbooks/vytocit-gitlab.yml b/playbooks/vytocit-gitlab.yml new file mode 100644 index 0000000..9267aa9 --- /dev/null +++ b/playbooks/vytocit-gitlab.yml @@ -0,0 +1,58 @@ +--- +- 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 ] + + + + diff --git a/soubory/klice/martus/authorized_keys b/soubory/klice/martus/authorized_keys new file mode 100644 index 0000000..bdc85fa --- /dev/null +++ b/soubory/klice/martus/authorized_keys @@ -0,0 +1,2 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCdsqF8kFKrcROPTv+TEzAYoMRPq00WX5vFL5pbWrGcWwBHB/H/mAy1NKx/W/sKpcLtjFuq6mvDwPpzvYqYSrTq4JSuylC3aPr1fxzbr2CLuTLZy4gYTVZAQhI4Yt1kIq9QJm+66QON65aXrvg0DEaJ13JnjwkQgURt0z6HaYnPGy8O0rW35LWzHuc6hUTQrMLBh8v+zjPONjNuMuc/b6LNbNanwe6yY9mLd/hmbLa/oaa4ltx8zeJeG8Rdt68HfTK05Ru9dzay4hPiBWuwt0pIYUhEtLGP0hsltLEIfd74qjTOhZxTKigRfYC5coxsMxN5BrHZ+lcxs68ortHwFKRaCnkk7Z264G7HMtzqsnxZtwj3VQCzq9BkLuSRuSR9yfkn7258hiZ4WbKYreGGRh9jvUgsjLCZLCUl+kPqikQr+bTAC2fekN2264XQKShaQ9jOThhVHk0RvSxzH/9UdyVtVFb9RBqII0tlBscBwz3VH+yavfMUeuAIk6wc6sSj/AE= martus@i5-7500 +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILG5CcuGYuTy/qAKTpL7uZU5aDdIfe0hISd0NYUBs3Ys martus@elitebook diff --git a/soubory/sudo/martus b/soubory/sudo/martus new file mode 100644 index 0000000..d6c6241 --- /dev/null +++ b/soubory/sudo/martus @@ -0,0 +1,2 @@ +martus ALL=(ALL) NOPASSWD: ALL +