mirror of
https://github.com/khuedoan/homelab.git
synced 2025-01-05 13:08:52 +07:00
Use var for LXD password
This commit is contained in:
parent
b68d65f2ed
commit
3d6c0f44d0
@ -1,6 +1,6 @@
|
|||||||
.POSIX:
|
.POSIX:
|
||||||
|
|
||||||
default: init run
|
default: init provision
|
||||||
|
|
||||||
init:
|
init:
|
||||||
python3 -m venv .venv \
|
python3 -m venv .venv \
|
||||||
@ -8,6 +8,10 @@ init:
|
|||||||
&& pip3 install --upgrade pip \
|
&& pip3 install --upgrade pip \
|
||||||
&& pip3 install -r requirements.txt
|
&& pip3 install -r requirements.txt
|
||||||
|
|
||||||
run:
|
reset:
|
||||||
. .venv/bin/activate \
|
. .venv/bin/activate \
|
||||||
&& ansible-playbook --ask-become-pass --inventory hosts.ini playbook.yml
|
&& ansible-playbook --ask-become-pass --inventory hosts.ini playbook.yml
|
||||||
|
|
||||||
|
provision:
|
||||||
|
. .venv/bin/activate \
|
||||||
|
&& ansible-playbook --inventory hosts.ini playbook.yml --tags provision
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
hosts: all
|
hosts: all
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars_prompt:
|
vars_prompt:
|
||||||
- name: username
|
- name: os_username
|
||||||
prompt: Enter username for metal nodes
|
prompt: Enter username for metal nodes
|
||||||
private: no
|
private: no
|
||||||
- name: password
|
- name: os_password
|
||||||
prompt: Enter password for metal nodes
|
prompt: Enter password for metal nodes
|
||||||
roles:
|
roles:
|
||||||
- pxe-boot
|
- pxe-boot
|
||||||
@ -18,3 +18,5 @@
|
|||||||
roles:
|
roles:
|
||||||
- snap
|
- snap
|
||||||
- lxd
|
- lxd
|
||||||
|
tags:
|
||||||
|
- provision
|
||||||
|
@ -27,22 +27,22 @@
|
|||||||
creates: /var/snap/lxd/common/lxd/server.crt
|
creates: /var/snap/lxd/common/lxd/server.crt
|
||||||
when: inventory_hostname != groups['metal'][0]
|
when: inventory_hostname != groups['metal'][0]
|
||||||
|
|
||||||
- name: Add remote
|
# - name: Add remote
|
||||||
command:
|
# command:
|
||||||
argv:
|
# argv:
|
||||||
- lxc
|
# - lxc
|
||||||
- remote
|
# - remote
|
||||||
- add
|
# - add
|
||||||
- vagrant
|
# - vagrant
|
||||||
- "{{ hostvars[groups['metal'][0]]['ansible_host'] }}"
|
# - "{{ hostvars[groups['metal'][0]]['ansible_host'] }}"
|
||||||
- --accept-certificate
|
# - --accept-certificate
|
||||||
- --password
|
# - --password
|
||||||
- 1
|
# - 1
|
||||||
|
|
||||||
- name: Change default remote
|
# - name: Change default remote
|
||||||
command:
|
# command:
|
||||||
argv:
|
# argv:
|
||||||
- lxc
|
# - lxc
|
||||||
- remote
|
# - remote
|
||||||
- switch
|
# - switch
|
||||||
- vagrant
|
# - vagrant
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
config:
|
config:
|
||||||
core.https_address: {{ hostvars[inventory_hostname]['ansible_host'] }}:8443
|
core.https_address: {{ hostvars[inventory_hostname]['ansible_host'] }}:8443
|
||||||
core.trust_password: "1"
|
core.trust_password: {{ lxd_password }}
|
||||||
networks:
|
networks:
|
||||||
- config:
|
- config:
|
||||||
bridge.mode: fan
|
bridge.mode: fan
|
||||||
|
@ -5,4 +5,4 @@ cluster:
|
|||||||
cluster_certificate: |
|
cluster_certificate: |
|
||||||
{{ hostvars[groups['metal'][0]]['server_cert']['content'] | b64decode | indent(width=4) }}
|
{{ hostvars[groups['metal'][0]]['server_cert']['content'] | b64decode | indent(width=4) }}
|
||||||
server_address: {{ hostvars[inventory_hostname]['ansible_host'] }}:8443
|
server_address: {{ hostvars[inventory_hostname]['ansible_host'] }}:8443
|
||||||
cluster_password: "1"
|
cluster_password: {{ lxd_password }}
|
||||||
|
@ -30,7 +30,7 @@ services --enabled="chronyd"
|
|||||||
timezone Asia/Ho_Chi_Minh --isUtc
|
timezone Asia/Ho_Chi_Minh --isUtc
|
||||||
|
|
||||||
# Create user
|
# Create user
|
||||||
user --groups=wheel --name={{ username }} --password={{ password }}
|
user --groups=wheel --name={{ os_username }} --password={{ os_password }}
|
||||||
# Add SSH key
|
# Add SSH key
|
||||||
sshkey --username=root "{{ ssh_public_key }}"
|
sshkey --username=root "{{ ssh_public_key }}"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user