68 lines
2.1 KiB
YAML
68 lines
2.1 KiB
YAML
---
|
|
- name: Deploy LXC
|
|
hosts: localhost
|
|
remote_user: ansible
|
|
gather_facts: false
|
|
|
|
vars_files:
|
|
../inventory/group_vars/all/secrets.yaml
|
|
vars:
|
|
ansible_user_passwd_hash: "{{ ansible_password | password_hash('sha512', 's3edscrj45e6r') }}"
|
|
user_passwd_hash: "{{ user_password | password_hash('sha512', 's3ed6123jhgcr') }}"
|
|
|
|
pre_tasks:
|
|
- name: Include input and validation for hostname
|
|
ansible.builtin.include_tasks: ../tasks/hostname_validation.yaml
|
|
|
|
- name: Include input and validation for LXC root password
|
|
ansible.builtin.include_tasks: ../tasks/lxc_root_password_validation.yaml
|
|
|
|
- name: Include input and validation for IP
|
|
ansible.builtin.include_tasks: ../tasks/ip_validation.yaml
|
|
|
|
- name: Include input and validation for LXC privilege
|
|
ansible.builtin.include_tasks: ../tasks/lxc_privileged_validation.yaml
|
|
|
|
- name: Include input and validation for human admin user creation
|
|
ansible.builtin.include_tasks: ../tasks/human_admin_user_validation.yaml
|
|
|
|
|
|
roles:
|
|
- ../roles/deploy_lxc_on_proxmox
|
|
|
|
tasks:
|
|
- name: Add the target host to the inventory
|
|
ansible.builtin.add_host:
|
|
name: "{{ guest_ip_address }}"
|
|
groups: new_host
|
|
ansible_user: ansible
|
|
ansible_become_password: "{{ ansible_become_passwd }}"
|
|
|
|
|
|
- name: Configure LXC
|
|
hosts: new_host
|
|
remote_user: ansible
|
|
|
|
vars_files:
|
|
../inventory/group_vars/all/secrets.yaml
|
|
vars:
|
|
ansible_user_passwd_hash: "{{ ansible_password | password_hash('sha512', 's3edscrj45e6r') }}"
|
|
user_passwd_hash: "{{ user_password | password_hash('sha512', 's3ed6123jhgcr') }}"
|
|
|
|
roles:
|
|
- ../roles/configure_ansible_user
|
|
- ../roles/harden_ssh
|
|
- ../roles/base_system
|
|
|
|
tasks:
|
|
- name: Include human admin user role
|
|
ansible.builtin.include_role:
|
|
name: ../roles/human_admin_user
|
|
when: "hostvars['localhost']['create_human_admin_user'] | bool"
|
|
|
|
- name: Include update configs role
|
|
ansible.builtin.include_role:
|
|
name: ../roles/update_configs
|
|
when: "hostvars['localhost']['create_human_admin_user'] | bool"
|
|
|