machine_setup/ansible/roles/poudriere/tasks/freebsd.yaml

141 lines
3.8 KiB
YAML
Raw Normal View History

2022-12-10 21:33:45 +00:00
#
# Get CPU type:
# sh -c "clang -v -fsyntax-only -march=native -x c /dev/null 2>&1 | grep -e '-target-cpu' | sed -e 's|.*-target-cpu \([[:alnum:]]*\) .*|\1|'"
#
# Check the CPU type:
# make -C /usr/src CPUTYPE=broadwell -V MACHINE_CPU
#
# Generate options file for ports
# poudriere options -j 12amd64 -p default -z stream -f /usr/local/etc/poudriere.d/12amd64-default-stream-pkglist
#
# Generate options file for specific ports
# poudriere options -j 12amd64 -p default -z stream -c lang/gcc48
#
# Build the packages
# poudriere bulk -j 12amd64 -p default -z stream -f /usr/local/etc/poudriere.d/12amd64-default-stream-pkglist
#
# List installed packages
# pkg query -e '%a = 0' '%o' | sort
#
# Consider setting the following in the poudriere vm-bhyve config:
# priority="20"
2022-12-10 21:33:45 +00:00
- name: Install packages
package:
name:
- poudriere
- bash
- rsync
- flock
state: present
2022-12-10 23:58:09 +00:00
- name: Create directories
file:
name: "{{ item }}"
state: directory
mode: 0755
owner: root
group: wheel
loop:
2023-05-29 04:13:57 +00:00
- /usr/ports/distfiles
2022-12-10 23:58:09 +00:00
- /opt/poudriere/build_configs
2022-12-11 00:06:34 +00:00
- /usr/local/poudriere/data/logs/bulk
2022-12-10 21:33:45 +00:00
2022-12-10 23:13:42 +00:00
- name: Install Configuration
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0600
owner: root
group: wheel
loop:
- src: poudriere.conf
dest: /usr/local/etc/poudriere.conf
- src: poudriere.key
dest: /usr/local/etc/poudriere.d/poudriere.key
2022-12-10 21:33:45 +00:00
# - src: poudriere_deploy_ed25519
# dest: /usr/local/etc/poudriere.d/poudriere_deploy_ed25519
2023-05-29 04:13:57 +00:00
- name: Install Configuration directory
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: wheel
loop:
- src: poudriere.d
dest: /usr/local/etc/
2022-12-10 23:25:33 +00:00
- name: Install scripts
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0755
owner: root
group: wheel
loop:
- src: poudboot.bash
dest: /usr/local/bin/poudboot
2022-12-10 23:58:09 +00:00
- name: Install Configuration
template:
src: "build_config.j2"
dest: "/opt/poudriere/build_configs/{{ item.jail }}-{{ item.ports }}-{{ item.set }}"
owner: root
group: wheel
mode: 0600
loop: "{{ poudriere_builds }}"
- name: Install rc script
copy:
src: "files/{{ item.src }}"
dest: "/usr/local/etc/rc.d/{{ item.dest|default(item.src) }}"
owner: root
group: wheel
mode: 0755
loop:
- src: poudboot
2022-12-11 01:19:45 +00:00
- name: Get ports tree list
command: poudriere ports -ln
register: poudriere_ports_tree_list
changed_when: false
check_mode: no
- name: Configure the ports tree
command: poudriere ports -c -m null -M /usr/local/portshaker/trees/main -p default
when: '"default" not in poudriere_ports_tree_list.stdout_lines'
- name: Get jail list
command: poudriere jail -l -n -q
register: poudriere_jail_list
changed_when: false
check_mode: no
- name: Create the jails
when: item.version != "CURRENT"
command: |-
poudriere jail {{poudriere_perf_flags}} -c -j {{ item.jail }} -v {{ item.version }}
2022-12-11 01:19:45 +00:00
args:
creates: "/usr/local/poudriere/jails/{{ item.jail }}"
loop: "{{ poudriere_builds }}"
- name: Create the jails
when: item.version == "CURRENT"
# -D clones the entire history instead of just the most recent commit
command: |-
poudriere jail {{poudriere_perf_flags}} -c -j {{ item.jail }} -v {{ item.branch|default("main") }} -a amd64 -m git -D -U https://git.FreeBSD.org/src.git -K {{ item.kernel|default("GENERIC") }}
2022-12-11 01:19:45 +00:00
args:
creates: "/usr/local/poudriere/jails/{{ item.jail }}"
loop: "{{ poudriere_builds }}"
# - name: Get current jail version
# command: poudriere jail -i -j current
# register: current_jail_version
# changed_when: false
# check_mode: no
# - name: Set current jail version
# command: "poudriere jail -u {{poudriere_perf_flags}} -j current -t {{ freebsd_version }}"
# when: freebsd_version[:9] not in current_jail_version.stdout