first commit
This commit is contained in:
39
playbooks/configure.yml
Normal file
39
playbooks/configure.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
- name: Configure provisioned machine
|
||||
hosts: new_host
|
||||
become: true
|
||||
gather_facts: true
|
||||
|
||||
tasks:
|
||||
- name: Wait for system to be ready
|
||||
ansible.builtin.wait_for_connection:
|
||||
timeout: 300
|
||||
|
||||
- name: Gather facts after connection
|
||||
ansible.builtin.setup:
|
||||
|
||||
- name: Update apt cache
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
cache_valid_time: 3600
|
||||
|
||||
- name: Upgrade all packages
|
||||
ansible.builtin.apt:
|
||||
upgrade: dist
|
||||
autoremove: true
|
||||
|
||||
- name: Include Docker role
|
||||
ansible.builtin.include_role:
|
||||
name: docker
|
||||
when: install_docker | default(false) | bool
|
||||
|
||||
- name: Include NFS role
|
||||
ansible.builtin.include_role:
|
||||
name: nfs
|
||||
when: install_nfs | default(false) | bool
|
||||
|
||||
- name: Reboot if required
|
||||
ansible.builtin.reboot:
|
||||
reboot_timeout: 300
|
||||
when: ansible_facts['distribution'] == 'Ubuntu'
|
||||
ignore_errors: true
|
||||
21
playbooks/provision.yml
Normal file
21
playbooks/provision.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
- name: Provision Proxmox VM or LXC
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
vars:
|
||||
proxmox_api_host: "192.168.0.166"
|
||||
|
||||
tasks:
|
||||
- name: Include VM provisioning role
|
||||
ansible.builtin.include_role:
|
||||
name: proxmox_vm
|
||||
when: provision_type | lower == 'vm'
|
||||
|
||||
- name: Include LXC provisioning role
|
||||
ansible.builtin.include_role:
|
||||
name: proxmox_lxc
|
||||
when: provision_type | lower == 'lxc'
|
||||
|
||||
- name: Display created resource info
|
||||
ansible.builtin.debug:
|
||||
msg: "Created {{ provision_type }} '{{ vm_hostname }}' with VMID {{ created_vmid }} on node {{ target_node }}"
|
||||
Reference in New Issue
Block a user