migrate
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
---
|
||||
- name: Install curated Ubuntu packages
|
||||
hosts: all
|
||||
become: true
|
||||
gather_facts: true
|
||||
|
||||
vars:
|
||||
ubuntu_package_matrix:
|
||||
- name: python3-venv
|
||||
enabled: << install_python3_venv >>
|
||||
- name: python3-pip
|
||||
enabled: << install_python3_pip >>
|
||||
- name: python3-apt
|
||||
enabled: << install_python3_apt >>
|
||||
- name: curl
|
||||
enabled: << install_curl >>
|
||||
- name: wget
|
||||
enabled: << install_wget >>
|
||||
- name: git
|
||||
enabled: << install_git >>
|
||||
- name: jq
|
||||
enabled: << install_jq >>
|
||||
- name: rsync
|
||||
enabled: << install_rsync >>
|
||||
- name: unzip
|
||||
enabled: << install_unzip >>
|
||||
- name: ca-certificates
|
||||
enabled: << install_ca_certificates >>
|
||||
- name: gnupg
|
||||
enabled: << install_gnupg >>
|
||||
- name: lsb-release
|
||||
enabled: << install_lsb_release >>
|
||||
- name: prometheus-node-exporter
|
||||
enabled: << install_prometheus_node_exporter >>
|
||||
- name: nfs-common
|
||||
enabled: << install_nfs_common >>
|
||||
- name: qemu-guest-agent
|
||||
enabled: << install_qemu_guest_agent >>
|
||||
|
||||
tasks:
|
||||
- name: Validate Ubuntu APT target
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- ansible_facts['distribution'] == 'Ubuntu'
|
||||
- ansible_facts['pkg_mgr'] == 'apt'
|
||||
fail_msg: "This playbook only supports Ubuntu hosts that use APT."
|
||||
|
||||
- name: Build selected package list
|
||||
ansible.builtin.set_fact:
|
||||
ubuntu_selected_packages: "{{ ubuntu_package_matrix | selectattr('enabled') | map(attribute='name') | list }}"
|
||||
|
||||
- name: Refresh APT package index
|
||||
ansible.builtin.command:
|
||||
cmd: apt-get update
|
||||
environment:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
register: ubuntu_packages_apt_update
|
||||
changed_when: false
|
||||
|
||||
- name: Install selected Ubuntu packages
|
||||
ansible.builtin.apt:
|
||||
name: "{{ ubuntu_selected_packages }}"
|
||||
state: present
|
||||
update_cache: false
|
||||
when: ubuntu_selected_packages | length > 0
|
||||
|
||||
- name: Enable and start Prometheus node exporter
|
||||
ansible.builtin.service:
|
||||
name: prometheus-node-exporter
|
||||
state: started
|
||||
enabled: true
|
||||
when: << install_prometheus_node_exporter >>
|
||||
|
||||
- name: Enable and start QEMU guest agent
|
||||
ansible.builtin.service:
|
||||
name: qemu-guest-agent
|
||||
state: started
|
||||
enabled: true
|
||||
when: << install_qemu_guest_agent >>
|
||||
|
||||
- name: Show selected package summary
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
- "Host: {{ inventory_hostname }}"
|
||||
- "Selected packages: {{ ubuntu_selected_packages | join(', ') if (ubuntu_selected_packages | length > 0) else 'none' }}"
|
||||
@@ -0,0 +1,157 @@
|
||||
{
|
||||
"slug": "ubuntu-packages",
|
||||
"kind": "ansible",
|
||||
"metadata": {
|
||||
"name": "Install Ubuntu Packages",
|
||||
"description": "Installs a curated set of useful Ubuntu packages with per-package switches for scripting, package management, monitoring, NFS, and VM guest integration.",
|
||||
"tags": [
|
||||
"ubuntu",
|
||||
"apt",
|
||||
"packages",
|
||||
"ansible"
|
||||
],
|
||||
"icon": {
|
||||
"provider": "simple-icons",
|
||||
"id": "ansible"
|
||||
},
|
||||
"draft": false,
|
||||
"version": {
|
||||
"name": "1.0.0",
|
||||
"source_dep_name": "manual/ubuntu-packages"
|
||||
}
|
||||
},
|
||||
"variables": [
|
||||
{
|
||||
"title": "Base Packages",
|
||||
"name": "base_packages",
|
||||
"items": [
|
||||
{
|
||||
"name": "install_python3_venv",
|
||||
"type": "bool",
|
||||
"title": "python3-venv",
|
||||
"required": false,
|
||||
"default": true,
|
||||
"description": "Install Python virtual environment support."
|
||||
},
|
||||
{
|
||||
"name": "install_python3_pip",
|
||||
"type": "bool",
|
||||
"title": "python3-pip",
|
||||
"required": false,
|
||||
"default": true,
|
||||
"description": "Install pip for Python 3."
|
||||
},
|
||||
{
|
||||
"name": "install_python3_apt",
|
||||
"type": "bool",
|
||||
"title": "python3-apt",
|
||||
"required": false,
|
||||
"default": true,
|
||||
"description": "Install Python bindings for APT."
|
||||
},
|
||||
{
|
||||
"name": "install_curl",
|
||||
"type": "bool",
|
||||
"title": "curl",
|
||||
"required": false,
|
||||
"default": true,
|
||||
"description": "Install curl for HTTP requests and downloads."
|
||||
},
|
||||
{
|
||||
"name": "install_wget",
|
||||
"type": "bool",
|
||||
"title": "wget",
|
||||
"required": false,
|
||||
"default": true,
|
||||
"description": "Install wget for scripted downloads."
|
||||
},
|
||||
{
|
||||
"name": "install_git",
|
||||
"type": "bool",
|
||||
"title": "git",
|
||||
"required": false,
|
||||
"default": true,
|
||||
"description": "Install Git for source control and repository operations."
|
||||
},
|
||||
{
|
||||
"name": "install_jq",
|
||||
"type": "bool",
|
||||
"title": "jq",
|
||||
"required": false,
|
||||
"default": true,
|
||||
"description": "Install jq for JSON parsing in shell scripts."
|
||||
},
|
||||
{
|
||||
"name": "install_rsync",
|
||||
"type": "bool",
|
||||
"title": "rsync",
|
||||
"required": false,
|
||||
"default": true,
|
||||
"description": "Install rsync for file synchronization and copy jobs."
|
||||
},
|
||||
{
|
||||
"name": "install_unzip",
|
||||
"type": "bool",
|
||||
"title": "unzip",
|
||||
"required": false,
|
||||
"default": true,
|
||||
"description": "Install unzip for archive extraction."
|
||||
},
|
||||
{
|
||||
"name": "install_ca_certificates",
|
||||
"type": "bool",
|
||||
"title": "ca-certificates",
|
||||
"required": false,
|
||||
"default": true,
|
||||
"description": "Install CA certificates for HTTPS trust."
|
||||
},
|
||||
{
|
||||
"name": "install_gnupg",
|
||||
"type": "bool",
|
||||
"title": "gnupg",
|
||||
"required": false,
|
||||
"default": true,
|
||||
"description": "Install GnuPG for repository keys and signing workflows."
|
||||
},
|
||||
{
|
||||
"name": "install_lsb_release",
|
||||
"type": "bool",
|
||||
"title": "lsb-release",
|
||||
"required": false,
|
||||
"default": true,
|
||||
"description": "Install lsb-release for distro detection in scripts."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Optional Packages",
|
||||
"name": "optional_packages",
|
||||
"items": [
|
||||
{
|
||||
"name": "install_prometheus_node_exporter",
|
||||
"type": "bool",
|
||||
"title": "prometheus-node-exporter",
|
||||
"required": false,
|
||||
"default": false,
|
||||
"description": "Install Prometheus node exporter and enable its service."
|
||||
},
|
||||
{
|
||||
"name": "install_nfs_common",
|
||||
"type": "bool",
|
||||
"title": "nfs-common",
|
||||
"required": false,
|
||||
"default": false,
|
||||
"description": "Install NFS client utilities."
|
||||
},
|
||||
{
|
||||
"name": "install_qemu_guest_agent",
|
||||
"type": "bool",
|
||||
"title": "qemu-guest-agent",
|
||||
"required": false,
|
||||
"default": false,
|
||||
"description": "Install the QEMU guest agent and enable its service."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user