From a596274ca63b9a24c9ca748e1fc9723a735836c0 Mon Sep 17 00:00:00 2001 From: Wendell Jones Date: Tue, 13 May 2025 08:39:58 -0400 Subject: [PATCH] repo migration --- .gitignore | 2 ++ .gitlab-ci.yml | 16 ++++++++++ README.md | 2 ++ linux_updates.yaml | 64 +++++++++++++++++++++++++++++++++++++++ playbook.yaml | 54 +++++++++++++++++++++++++++++++++ proxmox_updates.yaml | 23 ++++++++++++++ qemu_package_install.yaml | 9 ++++++ sonar-project.properties | 2 ++ windows_updates.yaml | 12 ++++++++ 9 files changed, 184 insertions(+) create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml create mode 100644 README.md create mode 100644 linux_updates.yaml create mode 100644 playbook.yaml create mode 100644 proxmox_updates.yaml create mode 100644 qemu_package_install.yaml create mode 100644 sonar-project.properties create mode 100644 windows_updates.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dd2a8c2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +samples/.DS_Store diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..8df888d --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,16 @@ +sonarqube-check: + image: + name: sonarsource/sonar-scanner-cli:latest + entrypoint: [""] + variables: + SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache + GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task + cache: + key: "${CI_JOB_NAME}" + paths: + - .sonar/cache + script: + - sonar-scanner + allow_failure: true + rules: + - if: $CI_COMMIT_BRANCH == 'master' diff --git a/README.md b/README.md new file mode 100644 index 0000000..16f05c9 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Updates + diff --git a/linux_updates.yaml b/linux_updates.yaml new file mode 100644 index 0000000..92d214a --- /dev/null +++ b/linux_updates.yaml @@ -0,0 +1,64 @@ +--- +- hosts: yumhosts + gather_facts: no + tasks: + - name: Update all installed packages using YUM module + ansible.builtin.yum: + use_backend: yum3 + name: '*' + state: latest + update_cache: yes + update_only: yes + register: yum_update_status + + - name: Remove packages not needed anymore + ansible.builtin.yum: + use_backend: yum3 + autoremove: yes + + - name: Reboot when packages were updated + reboot: + when: yum_update_status.changed + +- hosts: plexhosts + gather_facts: no + tasks: + - name: This command will change the working directory to somedir/ + ansible.builtin.shell: /usr/local/bin/update-plex.sh + #chdir: /usr/local/bin/ + + +- hosts: debianhosts + gather_facts: no + tasks: + - name: Update all installed packages using APT module + apt: + name: '*' + state: latest + update_cache: yes + only_upgrade: yes + register: apt_update_status + + - name: Remove packages not needed anymore + apt: + autoremove: yes + + - name: Reboot when packages were updated + reboot: + post_reboot_delay: 60 + when: apt_update_status.changed + +- hosts: apkhosts + tasks: + - name: Update the Package Repositories + apk: + update_cache: yes + - name: Upgrade Packages + apk: + available: yes + upgrade: yes +#- hosts: ipkg +# tasks: +# - name: Update the Packages installed on Diskstation +# command: /opt/bin/ipkg update && /opt/bin/ipkg upgrade +# diff --git a/playbook.yaml b/playbook.yaml new file mode 100644 index 0000000..1dbd9bd --- /dev/null +++ b/playbook.yaml @@ -0,0 +1,54 @@ +--- +- hosts: qemuhosts + tasks: + - name: Update all installed packages using YUM module + yum: + name: '*' + state: latest + update_cache: yes + update_only: yes + register: yum_update_status + + - name: Remove packates not needed anymore + yum: + autoremove: yes + + - name: Reboot when packages were updated + reboot: + when: yum_update_status.changed + +- hosts: ctxhosts + tasks: + - name: Update all installed packages using APT module + apt: + name: '*' + state: latest + update_cache: yes + only_upgrade: yes + register: apt_update_status + + - name: Remove packages not needed anymore + apt: + autoremove: yes + + - name: Reboot when packages were updated + reboot: + post_reboot_delay: 60 + when: apt_update_status.changed + +- hosts: ipkg + tasks: + - name: Update the Packages installed on Diskstation + command: /opt/bin/ipkg update && /opt/bin/ipkg upgrade + +- hosts: windowshosts + tasks: + - name: Install all updates and reboot as many times as needed + ansible.windows.win_updates: + category_names: '*' + reboot: yes + # Optionally, you can increase the reboot_timeout to survive long updates during reboot + - name: Ensure we wait long enough for the updates to be applied during reboot + ansible.windows.win_updates: + reboot: yes + reboot_timeout: 3600 diff --git a/proxmox_updates.yaml b/proxmox_updates.yaml new file mode 100644 index 0000000..4625221 --- /dev/null +++ b/proxmox_updates.yaml @@ -0,0 +1,23 @@ +--- +- hosts: proxmoxhosts + tasks: + - name: Update all installed packages using APT module + apt: + name: '*' + state: latest + update_cache: yes + only_upgrade: yes + register: apt_update_status + + - name: Remove packages not needed anymore + apt: + autoremove: yes + + - name: Check if reboot required + stat: + path: /var/run/reboot-required + register: reboot_required_file + + - name: Reboot if required + reboot: + when: reboot_required_file.stat.exists == true diff --git a/qemu_package_install.yaml b/qemu_package_install.yaml new file mode 100644 index 0000000..d31266f --- /dev/null +++ b/qemu_package_install.yaml @@ -0,0 +1,9 @@ +--- +- hosts: apthosts + tasks: + - name: Install a list of packages with a list variable + ansible.builtin.package: + name: "{{ packages }}" + vars: + packages: + - qemu-guest-agent diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..8e98922 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,2 @@ +sonar.projectKey=wjones_updates_AYnaaRO3RhIriH2jtzo0 +sonar.qualitygate.wait=true diff --git a/windows_updates.yaml b/windows_updates.yaml new file mode 100644 index 0000000..052aaff --- /dev/null +++ b/windows_updates.yaml @@ -0,0 +1,12 @@ +--- +- hosts: windowshosts + tasks: + - name: Install all updates and reboot as many times as needed + ansible.windows.win_updates: + category_names: '*' + reboot: yes + # Optionally, you can increase the reboot_timeout to survive long updates during reboot + - name: Ensure we wait long enough for the updates to be applied during reboot + ansible.windows.win_updates: + reboot: yes + reboot_timeout: 600