Compare commits
13 Commits
5e253db9c7
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| cc68a1f863 | |||
| 4897cdadbd | |||
| e0571783ba | |||
| c633ead7cc | |||
| db217f4ce2 | |||
| cdfcc844e0 | |||
| 71a98b34ca | |||
| d2ee60c0fb | |||
| baab14c3fc | |||
| 43ce6a94c0 | |||
| 1ecc1775ef | |||
| 1ed42f148c | |||
| 0b286b5496 |
@@ -1,3 +1,20 @@
|
||||
# ansible_home
|
||||
|
||||
My own home services automation repository
|
||||
## How to use it?
|
||||
|
||||
It's better to use a virtual environment to avoid incompatibility issues
|
||||
|
||||
```bash
|
||||
git clone https://git.vmn.su/max/vmn-ansible
|
||||
cd vmn-ansible
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
ansible-galaxy collection install -r requirements.yaml
|
||||
ansible-galaxy role install -r requirements.yaml
|
||||
ansible-playbook playbooks/deploy_and_set_up_lxc_on_proxmox.yaml --vault-pass-file $VAULT_PASS_PATH -i inventory/localhost.yaml --private-key $SSH_KEY
|
||||
```
|
||||
|
||||
**deploy** playbooks must be used with `inventory/localhost.yaml`, they need access to proxmox host only
|
||||
|
||||
There are also a systemd service and timer under `systemd` directory
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
|
||||
ansible_become_passwd: "{{ ansible_password }}"
|
||||
human_admin_user: max
|
||||
proxmox_1_host: 192.168.0.2
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
all:
|
||||
children:
|
||||
physical:
|
||||
proxmox-1:
|
||||
ansible_host: 192.168.0.2
|
||||
proxmox_1:
|
||||
ansible_host: "{{ proxmox_1_host }}"
|
||||
ansible_become_password: "{{ ansible_become_passwd }}"
|
||||
services_to_run: []
|
||||
virtual:
|
||||
@@ -38,4 +39,3 @@ all:
|
||||
ansible_become_password: "{{ ansible_become_passwd }}"
|
||||
services_to_run:
|
||||
- coder_ai
|
||||
|
||||
|
||||
@@ -20,3 +20,5 @@
|
||||
cmd: pct resize {{ common_healthcheck_vmid.proxmox_vms[0].vmid }} rootfs +5G
|
||||
delegate_to: 192.168.0.2
|
||||
changed_when: true
|
||||
vars:
|
||||
ansible_become_password: "{{ ansible_become_passwd }}"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
validate_certs: false
|
||||
node: proxmox-server
|
||||
api_user: root@pam
|
||||
api_host: 192.168.0.2
|
||||
api_host: "{{ proxmox_1_host }}"
|
||||
api_token_id: ansible
|
||||
api_token_secret: "{{ proxmox_token_secret }}"
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
validate_certs: false
|
||||
node: proxmox-server
|
||||
api_user: root@pam
|
||||
api_host: 192.168.0.2
|
||||
api_host: "{{ proxmox_1_host }}"
|
||||
api_token_id: ansible
|
||||
api_token_secret: "{{ proxmox_token_secret }}"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
validate_certs: false
|
||||
node: proxmox-server
|
||||
api_user: root@pam
|
||||
api_host: 192.168.0.2
|
||||
api_host: "{{ proxmox_1_host }}"
|
||||
api_token_id: ansible
|
||||
api_token_secret: "{{ proxmox_token_secret }}"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
validate_certs: false
|
||||
node: proxmox-server
|
||||
api_user: root@pam
|
||||
api_host: 192.168.0.2
|
||||
api_host: "{{ proxmox_1_host }}"
|
||||
api_token_id: ansible
|
||||
api_token_secret: "{{ proxmox_token_secret }}"
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
validate_certs: false
|
||||
node: proxmox-server
|
||||
api_user: root@pam
|
||||
api_host: 192.168.0.2
|
||||
api_host: "{{ proxmox_1_host }}"
|
||||
api_token_id: ansible
|
||||
api_token_secret: "{{ proxmox_token_secret }}"
|
||||
|
||||
@@ -64,10 +64,9 @@
|
||||
validate_certs: false
|
||||
node: proxmox-server
|
||||
api_user: root@pam
|
||||
api_host: 192.168.0.2
|
||||
api_host: "{{ proxmox_1_host }}"
|
||||
api_token_id: ansible
|
||||
api_token_secret: "{{ proxmox_token_secret }}"
|
||||
|
||||
name: "{{ vm_hostname }}"
|
||||
state: started
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
validate_certs: false
|
||||
node: proxmox-server
|
||||
api_user: root@pam
|
||||
api_host: 192.168.0.2
|
||||
api_host: "{{ proxmox_1_host }}"
|
||||
api_token_id: ansible
|
||||
api_token_secret: "{{ proxmox_token_secret }}"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
validate_certs: false
|
||||
node: proxmox-server
|
||||
api_user: root@pam
|
||||
api_host: 192.168.0.2
|
||||
api_host: "{{ proxmox_1_host }}"
|
||||
api_token_id: ansible
|
||||
api_token_secret: "{{ proxmox_token_secret }}"
|
||||
|
||||
@@ -19,4 +19,3 @@
|
||||
timeout: 120
|
||||
delegate_to: localhost
|
||||
changed_when: false
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# PUT NEW BLOCKS STRICTLY BEFORE ANY MATCH BLOCK
|
||||
|
||||
|
||||
# Private keys are NOT distributed via Ansible
|
||||
# They must to be copied manually ONLY to those hosts that need access to others
|
||||
|
||||
# Most of the home major LAN hosts should be accessible with this key
|
||||
Match Host 192.168.0.?
|
||||
User max
|
||||
IdentityFile ~/.ssh/max_regular_key
|
||||
|
||||
# This virtual network has the same hosts range
|
||||
Match Host 10.9.2.?
|
||||
User max
|
||||
IdentityFile ~/.ssh/max_regular_key
|
||||
@@ -48,6 +48,15 @@
|
||||
group: "{{ human_admin_user }}"
|
||||
mode: u=rw,g=r,o-rwx
|
||||
|
||||
- name: Configure ssh client, by pushing the config
|
||||
remote_user: ansible
|
||||
ansible.builtin.copy:
|
||||
src: "{{ role_path }}/files/ssh_config"
|
||||
dest: "/home/{{ human_admin_user }}/.ssh/config"
|
||||
owner: "{{ human_admin_user }}"
|
||||
group: "{{ human_admin_user }}"
|
||||
mode: u=rw,g=r,o-rwx
|
||||
|
||||
|
||||
# WARNING: we've finished with the initial setup, drop ansible key
|
||||
# Push regular user key
|
||||
|
||||
Reference in New Issue
Block a user