Last active
December 10, 2024 13:50
-
-
Save davidkarban/958f809f08b7f732f66a2646360c6c52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: all:!freebsd | |
remote_user: root | |
gather_facts: false | |
tasks: | |
- name: Zajisti, ze mame python | |
raw: dnf install python3 -y | |
when: | |
- inventory_hostname != "serverc" | |
register: result | |
changed_when: "'Nothing to do.' not in result.stdout" | |
- name: Zajisti, ze mame python | |
raw: dnf install python39 -y | |
when: inventory_hostname == "serverc" | |
register: result | |
changed_when: "'Nothing to do.' not in result.stdout" | |
- name: Zajisti, ze mame python | |
raw: apt install python3 -y | |
when: | |
- inventory_hostname == "serverd" | |
register: result | |
changed_when: "'is already the' not in result.stdout" | |
- name: Vytvorime usera student | |
user: | |
name: "student" | |
state: present | |
# Dodadni authorized key | |
- name: Nahrajeme ssh klice | |
authorized_key: | |
user: student | |
state: present | |
key: "{{ lookup('file', '/home/student/.ssh/id_ed25519.pub') }}" | |
tags: | |
- "auth" | |
- "always" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment