Remove private key file reference from ansible.cfg; update hosts file with absolute path for private key; add playbooks for installing tools and updating OS

This commit is contained in:
martin.cholewa
2025-07-08 18:29:11 +02:00
parent 43827881fb
commit 1858e2c36f
4 changed files with 41 additions and 2 deletions

View File

@@ -1,4 +1,3 @@
[defaults] [defaults]
inventory = hosts inventory = hosts
remote_user = vagrant remote_user = vagrant
private_key_file = ~/.vagrant.d/insecure_private_key

View File

@@ -1,2 +1,2 @@
[kube] [kube]
kube01 ansible_host=127.0.0.1 ansible_port=2030 ansible_user=vagrant ansible_ssh_private_key_file=.vagrant/machines/kube01/vmware_fusion/private_key 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
View 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
View 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