fine tuned storage creation and attachment
This commit is contained in:
parent
5a0e645bed
commit
c0f1f9051e
13
create.yaml
13
create.yaml
@ -2,17 +2,8 @@
|
|||||||
hosts: localhost
|
hosts: localhost
|
||||||
connection: local
|
connection: local
|
||||||
# FIXME: create volume role
|
# FIXME: create volume role
|
||||||
tasks:
|
roles:
|
||||||
- name: Create the home volume
|
- storage
|
||||||
hetzner.hcloud.volume:
|
|
||||||
# FIXME: put to vars
|
|
||||||
# FIXME: add mount to server
|
|
||||||
# FIXME: gpart create -s GPT da1 && gpart add -t freebsd-zfs -l storage -a 1M da1 && zpool create -f home da1
|
|
||||||
name: home
|
|
||||||
location: fsn1
|
|
||||||
format: ext4
|
|
||||||
size: 100
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Create BSDNIX Servers
|
- name: Create BSDNIX Servers
|
||||||
hosts: vps
|
hosts: vps
|
||||||
|
|||||||
@ -22,3 +22,10 @@ ssh_keys:
|
|||||||
jails:
|
jails:
|
||||||
pubnix:
|
pubnix:
|
||||||
octet: 2
|
octet: 2
|
||||||
|
|
||||||
|
storage:
|
||||||
|
home:
|
||||||
|
size: 10
|
||||||
|
name: zhcloud # zfs pool name
|
||||||
|
mount: /home
|
||||||
|
device: da1
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Create server
|
- name: Create server
|
||||||
hcloud_server:
|
hetzner.hcloud.server:
|
||||||
name: "{{ hostname }}"
|
name: "{{ hostname }}"
|
||||||
server_type: "{{ type }}"
|
server_type: "{{ type }}"
|
||||||
image: "{{ image }}"
|
image: "{{ image }}"
|
||||||
@ -8,12 +8,12 @@
|
|||||||
enable_ipv4: false
|
enable_ipv4: false
|
||||||
state: present
|
state: present
|
||||||
ssh_keys: "{{ ssh_keys }}"
|
ssh_keys: "{{ ssh_keys }}"
|
||||||
|
# FIXME: https://github.com/ansible-collections/hetzner.hcloud/issues/585
|
||||||
|
#volumes: "{{ storage.home.name }}"
|
||||||
register: server
|
register: server
|
||||||
|
|
||||||
# - command: which python
|
- name: Attach the home volume
|
||||||
# register: result
|
hetzner.hcloud.volume:
|
||||||
|
name: "{{ storage.home.name }}"
|
||||||
# - name: Install Packages
|
server: "{{ hostname }}"
|
||||||
# community.general.pkgng:
|
state: present
|
||||||
# state: present
|
|
||||||
# name: "{{ packages }}"
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Remove volume
|
- name: Remove volume
|
||||||
hetzner.hcloud.volume:
|
hetzner.hcloud.volume:
|
||||||
name: home
|
name: "{{ storage.home.name }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Remove server
|
- name: Remove server
|
||||||
|
|||||||
@ -4,6 +4,33 @@
|
|||||||
state: present
|
state: present
|
||||||
name: "{{ packages }}"
|
name: "{{ packages }}"
|
||||||
|
|
||||||
- command: which cpdup
|
# FIXME: remove the symlink in the release snapshot
|
||||||
register: result
|
- name: Remove old home sym link
|
||||||
|
shell: |
|
||||||
|
rm /home
|
||||||
|
touch /tmp/.ansible.home
|
||||||
|
args:
|
||||||
|
creates: "/tmp/.ansible.home"
|
||||||
|
|
||||||
|
- name: Setup home volume partition
|
||||||
|
shell: |
|
||||||
|
gpart create -s GPT da1
|
||||||
|
touch /tmp/.ansible.gpt
|
||||||
|
args:
|
||||||
|
creates: "/tmp/.ansible.gpt"
|
||||||
|
|
||||||
|
- name: Setup home fs type
|
||||||
|
shell: "gpart add -t freebsd-zfs -l {{ storage.home.name }} -a 1M {{ storage.home.device }}"
|
||||||
|
args:
|
||||||
|
creates: "/dev/da1p1"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Create zpool using home volume
|
||||||
|
shell: "zpool create -f {{ storage.home.name }} {{ storage.home.device }}"
|
||||||
|
args:
|
||||||
|
creates: "/{{ storage.home.name }}"
|
||||||
|
|
||||||
|
- name: Create zfs home dataset
|
||||||
|
shell: "zfs create -o mountpoint={{ storage.home.mount }} {{ storage.home.name }}/home"
|
||||||
|
args:
|
||||||
|
creates: "/home"
|
||||||
|
|||||||
7
roles/storage/tasks/main.yaml
Normal file
7
roles/storage/tasks/main.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: Create the home volume
|
||||||
|
hetzner.hcloud.volume:
|
||||||
|
name: "{{ storage.home.name }}"
|
||||||
|
location: "{{ location }}"
|
||||||
|
size: "{{ storage.home.size }}"
|
||||||
|
state: present
|
||||||
Loading…
x
Reference in New Issue
Block a user