From 98b06de737b497d2f22ced665e79ce89822f1003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rkus=20S=C3=A1ndor?= Date: Mon, 15 Sep 2025 16:50:41 +0200 Subject: [PATCH] first upload --- inventory/hosts.yml | 24 ++++++++++++++++++++++++ playbook/env.yml | 8 ++++++++ playbook/pingall.yml | 6 ++++++ playbook/upgrade.yml | 22 ++++++++++++++++++++++ playbook/whoami.yml | 5 +++++ 5 files changed, 65 insertions(+) create mode 100644 inventory/hosts.yml create mode 100644 playbook/env.yml create mode 100644 playbook/pingall.yml create mode 100644 playbook/upgrade.yml create mode 100644 playbook/whoami.yml diff --git a/inventory/hosts.yml b/inventory/hosts.yml new file mode 100644 index 0000000..38c2170 --- /dev/null +++ b/inventory/hosts.yml @@ -0,0 +1,24 @@ +all: + vars: + ansible_user: msandor # minden szerverre ezzel jelentkezem be + hosts: + nas: + ansible_host: 192.168.5.2 + pve: + ansible_host: 192.168.5.1 + ansible_user: root # itt nincs normál user + omv: + ansible_host: 192.168.5.3 + ansible_user: root # itt nincs normál user + vps1: + ansible_host: 192.168.50.151 + vps2: + ansible_host: 192.168.50.154 + ansible_port: 234 # alternatív porton figyel az ssh + ansible_python_interpreter: /usr/bin/python3.11 # a default python 3.6 túl régi az ansible-höz + vps3: + ansible_host: 192.168.50.152 + ansible_port: 234 # alternatív porton figyel az ssh + ansible_python_interpreter: /usr/bin/python3.11 # a default python 3.6 túl régi az ansible-höz + rpi3: + ansible_host: 192.168.50.153 diff --git a/playbook/env.yml b/playbook/env.yml new file mode 100644 index 0000000..41ffffd --- /dev/null +++ b/playbook/env.yml @@ -0,0 +1,8 @@ +--- +- name: Debug TESZT env + hosts: all + gather_facts: False + tasks: + - name: TESZT env + debug: + msg: "A TESZT változó értéke: {{ lookup('env', 'TESZT') }}" diff --git a/playbook/pingall.yml b/playbook/pingall.yml new file mode 100644 index 0000000..e3370c3 --- /dev/null +++ b/playbook/pingall.yml @@ -0,0 +1,6 @@ +- name: Ping all hosts + hosts: all + gather_facts: False + tasks: + - name: Ping + ansible.builtin.ping: diff --git a/playbook/upgrade.yml b/playbook/upgrade.yml new file mode 100644 index 0000000..ce61a04 --- /dev/null +++ b/playbook/upgrade.yml @@ -0,0 +1,22 @@ +--- +- hosts: all + become: yes + tasks: + - name: csomagok frissítése [RedHat/yum] + yum: + name: '*' + state: latest + security: no + skip_broken: yes + when: + - ansible_os_family == "RedHat" + + - name: csomagok frissítése [Debian/Ubuntu] + apt: + update_cache: yes + upgrade: yes + autoclean: yes + autoremove: yes + force_apt_get: true + when: + - ansible_os_family == "Debian" diff --git a/playbook/whoami.yml b/playbook/whoami.yml new file mode 100644 index 0000000..ee66e92 --- /dev/null +++ b/playbook/whoami.yml @@ -0,0 +1,5 @@ +--- +- hosts: all + tasks: + - name: who am I + ansible.builtin.shell: whoami