Files
vmn-ansible/playbooks/deploy_and_set_up_lxc_on_proxmox.yaml
T

65 lines
1.7 KiB
YAML

---
- name: Deploy LXC
hosts: all
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') }}"
vars_prompt:
- name: lxc_hostname
prompt: "Hostname for the container"
private: false
- name: lxc_root_password
prompt: "Root password"
private: true
confirm: true
encrypt: sha512_crypt
- name: lxc_ip_address
prompt: "IP address for the container (in x.x.x.x/x formant)"
private: false
roles:
- ../roles/deploy_lxc_on_proxmox
tasks:
- name: Make the prompted hostname available to the whole playbook
ansible.builtin.set_fact:
fact_lxc_hostname: "{{ lxc_hostname }}"
- name: Make the prompted IP available to the whole playbook
ansible.builtin.set_fact:
fact_lxc_ip_address: "{{ lxc_ip_address }}"
- name: Add the target host to the inventory
ansible.builtin.add_host:
name: "{{ fact_lxc_ip_address }}"
groups: new_host
ansible_user: ansible
- 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
- ../roles/human_admin_user
- ../roles/set_locale_and_time