Skip to content

Commit fc65edb

Browse files
authored
chore/container-net-conf (#188) (#189)
2 parents 18bd064 + a2c119a commit fc65edb

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

base/roles/container/defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ proxmox_cred:
1818

1919
check_delay: 4
2020
check_retries: 15
21+
22+
network_gateway: "192.168.178.1"
23+
network_netmask: "24"
24+
network_bridge: "vmbr0"

base/roles/container/tasks/create.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
pubkey: "{{ lookup('file', [key_dir, id ~ '.pub'] | path_join) }}"
5050
swap: "{{ swap }}"
5151
disk: "{{ disk }}"
52+
netif:
53+
net0: "name=eth0,gw={{ network_gateway }},ip={{ ip }}/{{ network_netmask }},bridge={{ network_bridge }}"
5254
features: "{{ (features if features and (PROXMOX_PASSWORD is defined and PROXMOX_PASSWORD != '') else omit) }}"
5355
mounts: "{{ (mounts if mounts and (PROXMOX_PASSWORD is defined and PROXMOX_PASSWORD != '') else omit) }}"
5456
unprivileged: "{{ (share | default(false) and mount | default('') | trim != '') | ternary(false, true) }}"
55-
netif:
56-
net0: "name=eth0,gw=192.168.178.1,ip={{ ip }}/24,bridge=vmbr0"
5757
onboot: "{{ boot }}"
5858
state: present
5959
register: container_creation

base/roles/mount/templates/share.service.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ StartLimitBurst=10
88

99
[Service]
1010
Type=oneshot
11-
ExecStart=/usr/bin/mount -t cifs //192.168.178.254/{{ item }} {{ mount_path }} -o credentials=/root/.share,uid=1000,gid=1000,vers=3.0
11+
ExecStart=/usr/bin/mount -t cifs //{{ host }}/{{ item }} {{ mount_path }} -o credentials=/root/.share,uid=1000,gid=1000,vers=3.0
1212
ExecStartPost=/usr/bin/bash -c 'mountpoint -q {{ mount_path }} && /usr/bin/systemctl stop --now {{ unit_name }}.timer || true'
1313
ExecStopPost=/usr/bin/bash -c '[ "$SERVICE_RESULT" = "start-limit-hit" ] && /usr/bin/systemctl stop --now {{ unit_name }}.timer || true'

0 commit comments

Comments
 (0)