Refactored the setupacdc.yml file to use a more efficient method of retrieving Proxmox's SSL certificate, reducing code duplication and improving maintainability. Additionally, simplified the process of adding certificates to the system's trusted CA store.
49 lines
2.1 KiB
YAML
49 lines
2.1 KiB
YAML
- hosts: localhost
|
|
gather_facts: yes
|
|
|
|
vars:
|
|
addc_hostname: "DC1"
|
|
mac_address: "8E:90:31:DE:31:36"
|
|
node_ip: "{{ hostvars['node0']['ansible_host'] }}"
|
|
|
|
tasks:
|
|
|
|
- name: Install 'proxmoxer' and 'requests' Python libraries for the ansible controller
|
|
ansible.builtin.pip:
|
|
name:
|
|
- proxmoxer
|
|
- requests
|
|
state: present
|
|
become: no
|
|
|
|
- name: Print node IP
|
|
debug:
|
|
msg: "The IP address of node0 is {{ node_ip }}"
|
|
|
|
- name: Create lxc container
|
|
community.proxmox.proxmox:
|
|
vmid: 200
|
|
node: "{{ node_ip }}"
|
|
api_user: root@pam
|
|
api_password: "{{ proxmox_password }}"
|
|
api_host: "{{ node_ip }}"
|
|
password: 123456
|
|
hostname: "{{ addc_hostname }}"
|
|
ostemplate: 'local:vztmpl/debian-13-standard_13.1-1_amd64.tar.zst'
|
|
validate_certs: false
|
|
# ostype: debian
|
|
# description: samba ad dc
|
|
# cores: 2
|
|
# memory: 2048
|
|
# disk: 'local-lvm:10'
|
|
# timezone: "Europe/Rome"
|
|
# onboot: true
|
|
# unprivileged: true
|
|
# features:
|
|
# - nesting=1
|
|
# - keyctl=1
|
|
# - mount=cifs
|
|
# pubkey: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCZgalXzHToHYdyl59O0dyZNffN0BGbILUCJGmJs/VNm7dpeJ6uj9/LDapcCK0dH1P4eaHd9aET4hkK04xSyX6CfVER2Wcz/G0z2wHCv9mQ3EUWPQI1ESxNhqtfGsPUmoDGzBdsOFK2qSS+FMJnZ/KUgXGU8lxdWUMHccQsSPWWp51Js/hfbhX80Q7TlacOBV1spoaMZDITuhWFhWRbL8X0Y+iG6QrnR36M9E4zMBk/LO33GAhqHlAoeQqjL62DpLQ7/+7aIM/IR6JzGTG5aaaPHpYFTXWJO4zSL3QcW+xbqrPozoszSnnw0Hc1WVwKY6bJSM7OoeFys27Ul7fMIuiZtQ2EfFgD1BGrPxU++k5Pdexg+IU+3QTWBH+GFlWrwjI+0siKw9VovljpLIIJk8EaK65gD/yrD4I5Wm2qVbzfYIT5tXIsGpoZDlw3dtcWfeSj3BYhN3PbDY7o2oqVygJTuN43EEuj0QehyRZKN52x1SBtJ/9KBrFhSLsU0F8mkpJyluiULbrFkOmnfig8e10OE1rZX9vIIDV7TnJ6i536pyGyvmY5VwDQ617qJpK5mbZWzWlv+J7KK4rTbmV9I97xSzpB0c+nVgtEAJ5AhsVBjlMHHawFDzucaoYK5rSnwBGlWHoj+/zy6aHkxiFDLfOsNg0yhPN6ATpCvOm849l8TQ== admin@localhost'
|
|
# netif:
|
|
# net0: "name=eth0,hwaddr={{ mac_address }},gw={{ location_gateway }},ip={{ addc_ansible_host }}/24,bridge=vmbr0"
|