Skip to content

Instantly share code, notes, and snippets.

@davidkarban
Last active December 10, 2024 13:50
Show Gist options
  • Save davidkarban/958f809f08b7f732f66a2646360c6c52 to your computer and use it in GitHub Desktop.
Save davidkarban/958f809f08b7f732f66a2646360c6c52 to your computer and use it in GitHub Desktop.
- 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