create partition, vgs and lvs
This commit is contained in:
parent
4c9a74b725
commit
2b1a9b7214
@ -1,4 +1,4 @@
|
|||||||
FROM hashicorp/packer:1.5.1
|
FROM hashicorp/packer:1.5.4
|
||||||
|
|
||||||
ARG PROXY=""
|
ARG PROXY=""
|
||||||
ENV http_proxy="${PROXY}"
|
ENV http_proxy="${PROXY}"
|
||||||
@ -10,7 +10,8 @@ ARG GROUP=packer
|
|||||||
WORKDIR /packer
|
WORKDIR /packer
|
||||||
|
|
||||||
RUN apk add --update qemu qemu-system-x86_64 qemu-img \
|
RUN apk add --update qemu qemu-system-x86_64 qemu-img \
|
||||||
vim htop util-linux gzip sysfsutils openssh-client openssh-keygen sudo ansible
|
vim htop util-linux gzip sysfsutils openssh-client \
|
||||||
|
openssh-keygen sudo ansible sshpass
|
||||||
|
|
||||||
RUN addgroup -g 1000 "${GROUP}" && \
|
RUN addgroup -g 1000 "${GROUP}" && \
|
||||||
adduser -u 1000 -D -G "${GROUP}" "${USER}" && \
|
adduser -u 1000 -D -G "${GROUP}" "${USER}" && \
|
||||||
|
29
packer/assets/ansible/roles/setup/defaults/main.yml
Normal file
29
packer/assets/ansible/roles/setup/defaults/main.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
# default variable relative to paritionning
|
||||||
|
|
||||||
|
devices_path: /dev/sda
|
||||||
|
devices_system:
|
||||||
|
- name: root
|
||||||
|
dev: /dev/sda1
|
||||||
|
lvs:
|
||||||
|
- name: "bios"
|
||||||
|
size: "2M"
|
||||||
|
type: "bootloader"
|
||||||
|
descr: "BIOS boot partition"
|
||||||
|
- name: "boot"
|
||||||
|
size: "128M"
|
||||||
|
type: "ext2"
|
||||||
|
descr: "Boot/EFI system partition"
|
||||||
|
- name: "swap"
|
||||||
|
size: "1G"
|
||||||
|
type: "swap"
|
||||||
|
descr: "Swap partition"
|
||||||
|
- name: "root"
|
||||||
|
size: "22G"
|
||||||
|
type: "ext4"
|
||||||
|
descr: "Root partition"
|
||||||
|
- name: "home"
|
||||||
|
size: "7G"
|
||||||
|
type: "ext4"
|
||||||
|
descr: "home partition"
|
||||||
|
|
Binary file not shown.
@ -3,10 +3,34 @@
|
|||||||
|
|
||||||
- name: "Create a new primary partition for LVM"
|
- name: "Create a new primary partition for LVM"
|
||||||
parted:
|
parted:
|
||||||
device: /dev/sda
|
device: "{{ devices_path }}"
|
||||||
name: "root"
|
name: "{{ item.name }}"
|
||||||
label: gpt
|
label: gpt
|
||||||
number: 1
|
number: "{{ ansible_loop.index }}"
|
||||||
flags: [ lvm ]
|
flags: [ lvm ]
|
||||||
state: present
|
state: present
|
||||||
|
part_end: "100%"
|
||||||
|
loop: "{{ devices_system }}"
|
||||||
|
loop_control:
|
||||||
|
extended: yes
|
||||||
|
|
||||||
|
- name: "Create vg and add disk to it"
|
||||||
|
lvg:
|
||||||
|
vg: vg_system
|
||||||
|
pvs: "{{ devices_system | map(attribute='dev') | join(',') }}"
|
||||||
|
|
||||||
|
- name: "Create list of lvs"
|
||||||
|
lvol:
|
||||||
|
vg: "vg_system"
|
||||||
|
lv: "{{ item.name }}"
|
||||||
|
size: "{{ item.size }}"
|
||||||
|
loop: "{{ lvs }}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,7 +86,8 @@
|
|||||||
"playbook_file": "/packer/ansible/playbook.yml",
|
"playbook_file": "/packer/ansible/playbook.yml",
|
||||||
"extra_arguments": [ "--extra-vars", "ssh_pub={{user `ssh_pub_key`}} generated_user={{user `generated_user`}} generated_group={{user `generated_group`}}" ],
|
"extra_arguments": [ "--extra-vars", "ssh_pub={{user `ssh_pub_key`}} generated_user={{user `generated_user`}} generated_group={{user `generated_group`}}" ],
|
||||||
"groups": "default",
|
"groups": "default",
|
||||||
"user": "root"
|
"user": "root",
|
||||||
|
"ansible_env_vars": [ "ANSIBLE_HOST_KEY_CHECKING=False" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"variables": {
|
"variables": {
|
||||||
|
Loading…
Reference in New Issue
Block a user