51c1c5b611
Rename lxc_password to lxc_root_password for consistency with the new lxc_user_password (replaces the previously bare 'password' variable in post-clone.yml, which silently collided with any same-named caller var). Add lxc_user_name (default: admin) so the non-root account managed in post-clone.yml is no longer hardcoded. Apply default(omit) to the root password in create.yml so it is genuinely optional as documented. BREAKING CHANGE: callers passing lxc_password or a bare 'password' var must rename to lxc_root_password and lxc_user_password respectively.
28 lines
746 B
YAML
Executable File
28 lines
746 B
YAML
Executable File
---
|
|
- name: Change root password
|
|
ansible.builtin.user:
|
|
name: root
|
|
password: "{{ lxc_root_password | password_hash('sha512') }}"
|
|
update_password: always
|
|
when: lxc_root_password is defined
|
|
|
|
- name: Change user password
|
|
ansible.builtin.user:
|
|
name: "{{ lxc_user_name }}"
|
|
password: "{{ lxc_user_password | password_hash('sha512') }}"
|
|
update_password: always
|
|
when: lxc_user_password is defined
|
|
|
|
- name: Regenerate SSH host keys
|
|
ansible.builtin.include_role:
|
|
name: system_setup
|
|
tasks_from: ssh
|
|
vars:
|
|
regenerate_ssh_keys: true
|
|
|
|
- name: Remove previous entry from known hosts
|
|
ansible.builtin.known_hosts:
|
|
name: "{{ hostvars[lxc_hostname]['ansible_host'] }}"
|
|
state: absent
|
|
delegate_to: localhost
|