fix: rename roles to use underscores instead of hyphens which was causing the roles not to be found
This commit is contained in:
10
README.md
10
README.md
@@ -4,14 +4,14 @@ Ansible collection for infrastructure management, system configuration, and virt
|
|||||||
|
|
||||||
## Roles
|
## Roles
|
||||||
|
|
||||||
### proxmox-lxc-provision
|
### proxmox_lxc_provision
|
||||||
Manages Proxmox LXC containers with comprehensive lifecycle operations.
|
Manages Proxmox LXC containers with comprehensive lifecycle operations.
|
||||||
|
|
||||||
- Create, clone, start, stop, and delete containers
|
- Create, clone, start, stop, and delete containers
|
||||||
- Template conversion and configuration editing
|
- Template conversion and configuration editing
|
||||||
- Post-provisioning tasks and health checks
|
- Post-provisioning tasks and health checks
|
||||||
|
|
||||||
### system-setup
|
### system_setup
|
||||||
Performs initial system configuration for new servers.
|
Performs initial system configuration for new servers.
|
||||||
|
|
||||||
- Creates admin user with SSH key authentication
|
- Creates admin user with SSH key authentication
|
||||||
@@ -19,14 +19,14 @@ Performs initial system configuration for new servers.
|
|||||||
- Installs essential packages
|
- Installs essential packages
|
||||||
- Optional passwordless sudo configurations
|
- Optional passwordless sudo configurations
|
||||||
|
|
||||||
### system-maintenance
|
### system_maintenance
|
||||||
Updates packages and handles maintenance across multiple distributions.
|
Updates packages and handles maintenance across multiple distributions.
|
||||||
|
|
||||||
- Multi-distribution support (Debian/Ubuntu/Alpine)
|
- Multi-distribution support (Debian/Ubuntu/Alpine)
|
||||||
- Package updates and cleanup
|
- Package updates and cleanup
|
||||||
- Automatic reboot handling when required
|
- Automatic reboot handling when required
|
||||||
|
|
||||||
### nvidia-drivers
|
### nvidia_drivers
|
||||||
Installs NVIDIA drivers and CUDA runtime with proper idempotency and error handling.
|
Installs NVIDIA drivers and CUDA runtime with proper idempotency and error handling.
|
||||||
|
|
||||||
- Supports Debian/Ubuntu with automatic OS detection
|
- Supports Debian/Ubuntu with automatic OS detection
|
||||||
@@ -53,7 +53,7 @@ ansible-galaxy collection install patrickj.infrastructure
|
|||||||
- os_template: "local:vztmpl/debian-12_amd64.tar.zst"
|
- os_template: "local:vztmpl/debian-12_amd64.tar.zst"
|
||||||
- container_ipv4: "10.0.0.99"
|
- container_ipv4: "10.0.0.99"
|
||||||
roles:
|
roles:
|
||||||
- role: proxmox-provision
|
- role: proxmox_lxc_provision
|
||||||
|
|
||||||
- name: Configure the LXC container
|
- name: Configure the LXC container
|
||||||
hosts: new-debian-container
|
hosts: new-debian-container
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ Installs NVIDIA drivers and CUDA runtime on Debian/Ubuntu systems with proper id
|
|||||||
```yaml
|
```yaml
|
||||||
- name: Install NVIDIA drivers with kernel modules
|
- name: Install NVIDIA drivers with kernel modules
|
||||||
include_role:
|
include_role:
|
||||||
name: nvidia-drivers
|
name: nvidia_drivers
|
||||||
vars:
|
vars:
|
||||||
nvidia_install_kernel_modules: true
|
nvidia_install_kernel_modules: true
|
||||||
nvidia_open_source_drivers: false
|
nvidia_open_source_drivers: false
|
||||||
@@ -37,7 +37,7 @@ Installs NVIDIA drivers and CUDA runtime on Debian/Ubuntu systems with proper id
|
|||||||
```yaml
|
```yaml
|
||||||
- name: Install NVIDIA userspace libraries
|
- name: Install NVIDIA userspace libraries
|
||||||
include_role:
|
include_role:
|
||||||
name: nvidia-drivers
|
name: nvidia_drivers
|
||||||
vars:
|
vars:
|
||||||
nvidia_install_kernel_modules: false
|
nvidia_install_kernel_modules: false
|
||||||
```
|
```
|
||||||
@@ -46,7 +46,7 @@ Installs NVIDIA drivers and CUDA runtime on Debian/Ubuntu systems with proper id
|
|||||||
```yaml
|
```yaml
|
||||||
- name: Install NVIDIA with extras
|
- name: Install NVIDIA with extras
|
||||||
include_role:
|
include_role:
|
||||||
name: nvidia-drivers
|
name: nvidia_drivers
|
||||||
vars:
|
vars:
|
||||||
nvidia_install_kernel_modules: true
|
nvidia_install_kernel_modules: true
|
||||||
nvidia_optional_packages:
|
nvidia_optional_packages:
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
# Ansible Role: proxmox-lxc-provision
|
# Ansible Role: proxmox_lxc_provision
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
This Ansible role manages the provision of LXC containers and templates on a Proxmox host. By default the role will create and start an LXC container. It allows creating a new container from a [container image](https://pve.proxmox.com/wiki/Linux_Container#pct_container_images) or cloning an existing container or template container.
|
This Ansible role manages the provision of LXC containers and templates on a Proxmox host. By default the role will create and start an LXC container. It allows creating a new container from a [container image](https://pve.proxmox.com/wiki/Linux_Container#pct_container_images) or cloning an existing container or template container.
|
||||||
|
|
||||||
It also includes tasks which may be used individually:
|
It also includes tasks which may be used individually:
|
||||||
- `clone.yaml`: Creates a new LXC container by cloning another container or template
|
- `clone.yml`: Creates a new LXC container by cloning another container or template
|
||||||
- `convert.yaml`: Converts an LXC container to a template
|
- `convert.yml`: Converts an LXC container to a template
|
||||||
- `create.yaml`: Creates a new LXC container
|
- `create.yml`: Creates a new LXC container
|
||||||
- `delete.yaml`: Deletes an LXC container given its vmid or hostname
|
- `delete.yml`: Deletes an LXC container given its vmid or hostname
|
||||||
- `start.yaml`: Starts an LXC container
|
- `start.yml`: Starts an LXC container
|
||||||
- `stop.yaml`: Stops an LXC container
|
- `stop.yml`: Stops an LXC container
|
||||||
- `update.yaml`: Updates an existing LXC container
|
- `update.yml`: Updates an existing LXC container
|
||||||
- `wait.yaml`: Waits for SSH to be available on the container
|
- `wait.yml`: Waits for SSH to be available on the container
|
||||||
|
- `check-exists.yml`: Checks the existence of the LXC with the given hostname
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- Ansible 2.9 or higher
|
- Ansible 2.9 or higher
|
||||||
@@ -103,7 +103,7 @@ proxmox_node: "pve01"
|
|||||||
lxc_template: "local:vztmpl/debian-12_amd64.tar.zst"
|
lxc_template: "local:vztmpl/debian-12_amd64.tar.zst"
|
||||||
lxc_ipv4: "10.0.0.99"
|
lxc_ipv4: "10.0.0.99"
|
||||||
roles:
|
roles:
|
||||||
- role: proxmox-lxc-provision
|
- role: proxmox_lxc_provision
|
||||||
```
|
```
|
||||||
|
|
||||||
### Creating a new LXC by cloning an existing container with vmid 200
|
### Creating a new LXC by cloning an existing container with vmid 200
|
||||||
@@ -116,7 +116,7 @@ proxmox_node: "pve01"
|
|||||||
lxc_clone_from: 200
|
lxc_clone_from: 200
|
||||||
lxc_ipv4: "10.0.0.99"
|
lxc_ipv4: "10.0.0.99"
|
||||||
roles:
|
roles:
|
||||||
- role: proxmox-lxc-provision
|
- role: proxmox_lxc_provision
|
||||||
```
|
```
|
||||||
|
|
||||||
### Idempotent Behavior
|
### Idempotent Behavior
|
||||||
@@ -135,7 +135,7 @@ The role now includes idempotency checking. If a container with the specified `c
|
|||||||
- os_template: "local:vztmpl/debian-12_amd64.tar.zst"
|
- os_template: "local:vztmpl/debian-12_amd64.tar.zst"
|
||||||
- container_ipv4: "10.0.0.99"
|
- container_ipv4: "10.0.0.99"
|
||||||
roles:
|
roles:
|
||||||
- role: proxmox-lxc-provision
|
- role: proxmox_lxc_provision
|
||||||
|
|
||||||
# Run configuration tasks on the container
|
# Run configuration tasks on the container
|
||||||
# ...
|
# ...
|
||||||
@@ -146,6 +146,6 @@ The role now includes idempotency checking. If a container with the specified `c
|
|||||||
container_hostname: "{{ container_hostname }}"
|
container_hostname: "{{ container_hostname }}"
|
||||||
tasks:
|
tasks:
|
||||||
- include_role:
|
- include_role:
|
||||||
name: proxmox-lxc-provision
|
name: proxmox_lxc_provision
|
||||||
tasks_from: convert
|
tasks_from: convert
|
||||||
```
|
```
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
- name: Regenerate SSH host keys
|
- name: Regenerate SSH host keys
|
||||||
ansible.builtin.include_role:
|
ansible.builtin.include_role:
|
||||||
name: system-setup
|
name: system_setup
|
||||||
tasks_from: ssh
|
tasks_from: ssh
|
||||||
vars:
|
vars:
|
||||||
regenerate_ssh_keys: true
|
regenerate_ssh_keys: true
|
||||||
@@ -20,7 +20,7 @@ Updates packages and handles system maintenance tasks across multiple distributi
|
|||||||
```yaml
|
```yaml
|
||||||
- name: Perform system maintenance
|
- name: Perform system maintenance
|
||||||
include_role:
|
include_role:
|
||||||
name: system-maintenance
|
name: system_maintenance
|
||||||
```
|
```
|
||||||
|
|
||||||
## What It Does
|
## What It Does
|
||||||
@@ -9,7 +9,7 @@ Performs initial system configuration including user creation, SSH hardening, an
|
|||||||
- Installs essential packages
|
- Installs essential packages
|
||||||
- Optional passwordless sudo
|
- Optional passwordless sudo
|
||||||
- Optional SSH host key regeneration
|
- Optional SSH host key regeneration
|
||||||
- System package updates (via system-maintenance role)
|
- System package updates (via system_maintenance role)
|
||||||
|
|
||||||
## Variables
|
## Variables
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ ssh_pubkey_file: "/path/to/your/public/key.pub"
|
|||||||
```yaml
|
```yaml
|
||||||
- name: Initial system setup
|
- name: Initial system setup
|
||||||
include_role:
|
include_role:
|
||||||
name: system-setup
|
name: system_setup
|
||||||
vars:
|
vars:
|
||||||
password: "{{ admin_password }}"
|
password: "{{ admin_password }}"
|
||||||
ssh_pubkey_file: "~/.ssh/id_rsa.pub"
|
ssh_pubkey_file: "~/.ssh/id_rsa.pub"
|
||||||
@@ -48,7 +48,7 @@ ssh_pubkey_file: "/path/to/your/public/key.pub"
|
|||||||
```yaml
|
```yaml
|
||||||
- name: System setup with custom user
|
- name: System setup with custom user
|
||||||
include_role:
|
include_role:
|
||||||
name: system-setup
|
name: system_setup
|
||||||
vars:
|
vars:
|
||||||
username: myuser
|
username: myuser
|
||||||
password: "{{ user_password }}"
|
password: "{{ user_password }}"
|
||||||
@@ -65,7 +65,7 @@ ssh_pubkey_file: "/path/to/your/public/key.pub"
|
|||||||
|
|
||||||
## What It Does
|
## What It Does
|
||||||
|
|
||||||
1. **System Updates** - Calls system-maintenance role for package updates
|
1. **System Updates** - Calls system_maintenance role for package updates
|
||||||
2. **Package Installation** - Installs packages from `extra_packages` list
|
2. **Package Installation** - Installs packages from `extra_packages` list
|
||||||
3. **User Creation** - Creates user with password and sudo access
|
3. **User Creation** - Creates user with password and sudo access
|
||||||
4. **SSH Key Setup** - Configures authorized keys for the user
|
4. **SSH Key Setup** - Configures authorized keys for the user
|
||||||
@@ -76,7 +76,7 @@ ssh_pubkey_file: "/path/to/your/public/key.pub"
|
|||||||
|
|
||||||
- Root privileges
|
- Root privileges
|
||||||
- SSH public key file accessible to Ansible
|
- SSH public key file accessible to Ansible
|
||||||
- system-maintenance role (dependency)
|
- system_maintenance role (dependency)
|
||||||
|
|
||||||
## Security Notes
|
## Security Notes
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Upgrade and update packages
|
# Upgrade and update packages
|
||||||
- include_role:
|
- include_role:
|
||||||
name: system-maintenance
|
name: system_maintenance
|
||||||
|
|
||||||
# Install extra packages
|
# Install extra packages
|
||||||
- include_tasks: extra-packages.yaml
|
- include_tasks: extra-packages.yaml
|
||||||
Reference in New Issue
Block a user