From 1858e2c36f8446b95220e8f2734233d6c5a9f83f Mon Sep 17 00:00:00 2001 From: "martin.cholewa" Date: Tue, 8 Jul 2025 18:29:11 +0200 Subject: [PATCH] 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 --- ansible/ansible.cfg | 1 - ansible/hosts | 2 +- ansible/install_tools.yml | 18 ++++++++++++++++++ ansible/update_os.yml | 22 ++++++++++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 ansible/install_tools.yml create mode 100644 ansible/update_os.yml diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg index b9de389..6c63bd6 100644 --- a/ansible/ansible.cfg +++ b/ansible/ansible.cfg @@ -1,4 +1,3 @@ [defaults] inventory = hosts remote_user = vagrant -private_key_file = ~/.vagrant.d/insecure_private_key diff --git a/ansible/hosts b/ansible/hosts index eca53d9..d5d3fae 100644 --- a/ansible/hosts +++ b/ansible/hosts @@ -1,2 +1,2 @@ [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 diff --git a/ansible/install_tools.yml b/ansible/install_tools.yml new file mode 100644 index 0000000..b4bc851 --- /dev/null +++ b/ansible/install_tools.yml @@ -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 diff --git a/ansible/update_os.yml b/ansible/update_os.yml new file mode 100644 index 0000000..9c8f2d6 --- /dev/null +++ b/ansible/update_os.yml @@ -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