Refactored the setupacdc.yml playbook to use localhost for hostnames and added a task to install the 'proxmoxer' Python library on the control node. This change ensures that the playbook is more portable and easier to manage.
44 lines
1.2 KiB
YAML
44 lines
1.2 KiB
YAML
- hosts: localhost
|
|
tasks:
|
|
|
|
- name: Install 'proxmoxer' Python library on the control node
|
|
ansible.builtin.pip:
|
|
name: proxmoxer
|
|
state: present
|
|
delegate_to: localhost
|
|
become: yes # Required if installing to the system Python environment
|
|
|
|
- hosts: node0
|
|
gather_facts: yes
|
|
vars:
|
|
addc_hostname: "DC1"
|
|
mac_address: "8E:90:31:DE:31:36"
|
|
|
|
tasks:
|
|
|
|
- name: Create lxc container
|
|
community.proxmox.proxmox:
|
|
vmid: 200
|
|
node: node0
|
|
api_user: root@pam
|
|
api_password: "{{ proxmox_password }}"
|
|
api_host: node0
|
|
password: 123456
|
|
hostname: "{{ addc_hostname }}"
|
|
ostype: debian
|
|
ostemplate: 'local:vztmpl/debian-13-standard_13.1-1_amd64.tar.zst'
|
|
description: samba ad dc
|
|
cores: 2
|
|
memory: 2048
|
|
disk: 'local-lvm:10'
|
|
timezone: "{{ localization_timezone }}"
|
|
onboot: true
|
|
unprivileged: true
|
|
features:
|
|
- nesting=1
|
|
- keyctl=1
|
|
- mount=cifs
|
|
pubkey: 'ssh-ed25519 AAAAC3NzaC1...hBWA ansibleuser@ansiblehost'
|
|
netif:
|
|
net0: "name=eth0,hwaddr={{ mac_address }},gw={{ location_gateway }},ip={{ addc_ansible_host }}/24,bridge=vmbr0"
|