Compare commits
5 Commits
314ee67a3b
...
7b51ce5e66
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7b51ce5e66 | ||
![]() |
1858e2c36f | ||
![]() |
43827881fb | ||
![]() |
9629f634e1 | ||
![]() |
c0cce1cb8e |
5
Vagrantfile
vendored
5
Vagrantfile
vendored
@@ -3,6 +3,9 @@ Vagrant.configure("2") do |config|
|
||||
kube01.vm.box = "bento/ubuntu-22.04"
|
||||
kube01.vm.hostname = "kube01"
|
||||
|
||||
# Forward host port 2030 to guest port 22 for SSH access
|
||||
kube01.vm.network "forwarded_port", guest: 22, host: 2030, id: "ssh"
|
||||
|
||||
kube01.vm.provider "vmware_fusion" do |v|
|
||||
v.gui = false
|
||||
v.memory = 2048
|
||||
@@ -10,7 +13,7 @@ Vagrant.configure("2") do |config|
|
||||
end
|
||||
|
||||
kube01.vm.provision "ansible" do |ansible|
|
||||
ansible.playbook = "vytvor_uzivatele.yml"
|
||||
ansible.playbook = "ansible/vytvor_uzivatele.yml"
|
||||
ansible.verbose = true
|
||||
end
|
||||
end
|
||||
|
3
ansible/ansible.cfg
Normal file
3
ansible/ansible.cfg
Normal file
@@ -0,0 +1,3 @@
|
||||
[defaults]
|
||||
inventory = hosts
|
||||
remote_user = vagrant
|
2
ansible/hosts
Normal file
2
ansible/hosts
Normal file
@@ -0,0 +1,2 @@
|
||||
[kube]
|
||||
kube01 ansible_host=127.0.0.1 ansible_port=2030 ansible_user=vagrant ansible_ssh_private_key_file=/Users/xchose/chosesoft/Vagrant/.vagrant/machines/kube01/vmware_fusion/private_key
|
18
ansible/install_tools.yml
Normal file
18
ansible/install_tools.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- name: Install favorite tools (vim, telnet, curl)
|
||||
hosts: all
|
||||
become: yes
|
||||
tasks:
|
||||
- name: Ensure vim, telnet, and curl are installed
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- vim
|
||||
- telnet
|
||||
- curl
|
||||
state: present
|
||||
update_cache: yes
|
||||
register: install_tools_result
|
||||
|
||||
- name: Show install result (full)
|
||||
ansible.builtin.debug:
|
||||
var: install_tools_result
|
22
ansible/update_os.yml
Normal file
22
ansible/update_os.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
- name: Update all packages on Ubuntu (interactive)
|
||||
hosts: all
|
||||
become: yes
|
||||
tasks:
|
||||
- name: Update apt cache
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
register: apt_update_result
|
||||
|
||||
- name: Show apt update output
|
||||
ansible.builtin.debug:
|
||||
var: apt_update_result.stdout_lines
|
||||
|
||||
- name: Upgrade all packages to the latest version
|
||||
ansible.builtin.apt:
|
||||
upgrade: dist
|
||||
register: apt_upgrade_result
|
||||
|
||||
- name: Show apt upgrade output
|
||||
ansible.builtin.debug:
|
||||
var: apt_upgrade_result.stdout_lines
|
3
ansible/vytvor_uzivatele.yml
Normal file
3
ansible/vytvor_uzivatele.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- import_playbook: update_os.yml
|
||||
- import_playbook: install_tools.yml
|
2
hosts
2
hosts
@@ -1,2 +0,0 @@
|
||||
[kube]
|
||||
kube01 ansible_host=127.0.0.1 ansible_port=2222 ansible_user=vagrant ansible_ssh_private_key_file=.vagrant/machines/kube01/vmware_fusion/private_key
|
@@ -1,9 +0,0 @@
|
||||
---
|
||||
- hosts: all
|
||||
become: yes
|
||||
tasks:
|
||||
- name: Přidat uživatele "novyuzivatel"
|
||||
user:
|
||||
name: novyuzivatel
|
||||
shell: /bin/bash
|
||||
create_home: yes
|
Reference in New Issue
Block a user