Compare commits

..

10 Commits

Author SHA1 Message Date
jeet ebf275af8f Commit vbox 2023-12-19 22:07:45 -05:00
jeet f8c025863b Pushing new ansible script for VirtualBox deployment 2023-12-15 22:23:39 -05:00
jeet 6e1d432314 Add win_chocolatey package upgrades 2023-12-15 13:17:24 -08:00
jeet 90623e6977 Update Inventory 2023-12-15 13:06:59 -08:00
madereddy 28e3fc9b20 Change default shell to CMD 2023-12-14 16:00:32 -05:00
madereddy 574fa1517a Add Windows Host 2023-12-14 15:27:40 -05:00
madereddy a80fba6b8b Fixing Ansible localhost connection 2023-12-14 14:14:45 -05:00
madereddy 606b041b7a add Ansible Host 2023-12-14 14:06:53 -05:00
madereddy 2d079918d4 Update Inventory 2023-12-14 13:27:39 -05:00
madereddy c61b3c6ef3 update inventory 2023-12-14 12:41:06 -05:00
6 changed files with 50 additions and 65 deletions
+3 -9
View File
@@ -140,14 +140,8 @@ To clean up the build you can run `clean.yml` against the docker hosts.
`ansible-playbook playbooks/clean.yml --ask-become`
## Section 6: Keeping Docker Containers Up-to-Date
## Section 6: Updating hosts
Lastly, we have the `docker_update_containers.yml` playbook. This playbook is crucial for updating your Docker containers with the latest images. It also re-imports the docker_status.yml playbook to check the status of containers after the update.
Lastly, we have the `update_upgrade.yml` playbook. This playbook is crucial for updating underlying host machines.
At this point you should have all of your hosts running docker containers in the `Docker` group of your `inventory.yml` file.
To update your containers this playbook brings your containers down, deletes their images, and brings them back up to pull the updated images.
**YOU MUST HAVE PERSISTANT STORAGE SETUP! IF YOU DON'T THEN THIS PLAYBOOK WILL <u>DELETE ALL OF YOUR DATA FROM YOUR CONTAINERS**</u> - consider yourself warned.
`ansible-playbook playbooks/docker_update_containers.yml`
`ansible-playbook playbooks/update_upgrade.yml --ask-become `
+24 -1
View File
@@ -13,7 +13,7 @@ all:
Docker:
hosts:
test-host:
ansible_host: oracle.madereddy.com
ansible_host: 192.168.1.218
ansible_user: jeet
ansible_ssh_private_key_file: ~/.ssh/id_ed25519
# host2:
@@ -24,3 +24,26 @@ all:
# - /path/to/docker-compose.yml
# - /path/to/docker-compose.yml
# - /path/to/docker-compose.yml
Prod:
hosts:
Ansible:
ansible_connection: local
OCI-Uptime-Kuma:
ansible_host: oracle.madereddy.com
ansible_user: ubuntu
ansible_ssh_private_key_file: ~/.ssh/id_ed25519
# host2:
# ansible_host: <ip>
# ansible_user: <user>
# ansible_ssh_private_key_file: ~/.ssh/<private key>
# compose_file_paths:
# - /path/to/docker-compose.yml
# - /path/to/docker-compose.yml
# - /path/to/docker-compose.yml
VirtualBox:
hosts:
Gaming:
ansible_host: 192.168.1.13
ansible_connection: ssh
ansible_user: jeet
ansible_shell_type: cmd
+2 -2
View File
@@ -6,11 +6,11 @@
- name: Stop containers using Docker Compose
ansible.builtin.command:
cmd: docker compose down
chdir: /home/jeet/docker
chdir: ~/docker
ignore_errors: yes
- name: Remove build folder
ansible.builtin.file:
state: absent
path: /home/jeet/docker/
path: ~/docker/
force: true
-52
View File
@@ -1,52 +0,0 @@
---
- name: Update Docker Containers With New Images
hosts: Docker
gather_facts: yes
tasks:
- name: Stop and remove Docker containers
ansible.builtin.command: docker compose down
args:
chdir: "{{ compose_file_path | dirname }}"
loop: "{{ compose_file_paths }}"
ignore_errors: yes
loop_control:
loop_var: compose_file_path
- name: Run docker compose up
ansible.builtin.command: docker compose up -d
args:
chdir: "{{ compose_file_path | dirname }}"
loop: "{{ compose_file_paths }}"
loop_control:
loop_var: compose_file_path
- name: Pause for 60 seconds to allow containers to stabilize
ansible.builtin.pause:
seconds: 60
- name: Check container status
ansible.builtin.shell: docker compose ps -q | xargs -n1 docker container inspect --format '{{ "{{" }} .State.Running {{ "}}" }}'
args:
chdir: "{{ compose_file_path | dirname }}"
loop: "{{ compose_file_paths }}"
register: container_status
ignore_errors: yes
loop_control:
loop_var: compose_file_path
- name: Conditional restart of containers
ansible.builtin.command: docker compose up -d
args:
chdir: "{{ result_item.item.path | dirname }}"
loop: "{{ container_status.results }}"
when: "'false' in result_item.stdout"
register: restart_status
loop_control:
loop_var: result_item
- name: Pause for 60 seconds to allow containers to stabilize
ansible.builtin.pause:
seconds: 60
- import_playbook: docker_status.yml
+15 -1
View File
@@ -1,6 +1,5 @@
---
- hosts: all
become: yes
gather_facts: true
tasks:
@@ -9,12 +8,14 @@
update_cache: yes
upgrade: safe
when: ansible_os_family == "Debian"
become: true
- name: "Updating and Upgrading Yum Packages"
yum:
name: '*'
state: latest
when: ansible_os_family == "RedHat"
become: true
# For DNF-based systems (e.g., Fedora), you can add a similar task:
- name: "Updating and Upgrading Dnf Packages"
@@ -22,6 +23,19 @@
name: '*'
state: latest
when: ansible_distribution == "Fedora"
become: true
# For Windows Hosts
- name: Install all updates and reboot as many times as needed
ansible.windows.win_updates:
category_names: '*'
reboot: true
when: ansible_os_family == "Windows"
- name: Upgrade installed packages
win_chocolatey:
name: all
state: latest
when: ansible_os_family == "Windows"
# Specific adjustments for Raspbian can be made here, if necessary
# Raspbian will typically be covered by the Debian task, but if you have specific needs, you can specify them here.
+6
View File
@@ -0,0 +1,6 @@
- name: Build OCI Stack
hosts: VirtualBox
tasks:
- name: Start Virtual Box Deployment
win_shell: multipass launch 23.04 --bridged
ignore_errors: yes