diff --git a/ansible/playbook.yaml b/ansible/playbook.yaml index d19ced0..2d5f617 100644 --- a/ansible/playbook.yaml +++ b/ansible/playbook.yaml @@ -2,41 +2,42 @@ vars: ansible_become: True roles: - - sudo + # - sudo - users - - package_manager - - zrepl - - zsh - - network - - sshd - - base - - firewall - - cpu - - ntp - - hosts - - build - - sound - - graphics - - gpg - - fonts - - alacritty - - sway - - emacs - - firefox - - devfs - - ssh_client - - sshfs - - jail - - fuse - - autofs - - exfat - - bhyve - - media - - kubernetes - - google_cloud_sdk - - ansible - - wireguard - - portshaker + # - package_manager + # - zrepl + # - zsh + # - network + # - sshd + # - base + # - firewall + # - cpu + # - ntp + # - hosts + # - build + # - sound + # - graphics + # - gpg + # - fonts + # - alacritty + # - sway + # - emacs + # - firefox + # - devfs + # - ssh_client + # - sshfs + # - jail + # - fuse + # - autofs + # - exfat + # - bhyve + # - media + # - kubernetes + # - google_cloud_sdk + # - ansible + # - wireguard + # - portshaker + - poudriere - hosts: nat_dhcp:homeserver_nat_dhcp vars: diff --git a/ansible/roles/poudriere/meta/main.yaml b/ansible/roles/poudriere/meta/main.yaml new file mode 100644 index 0000000..c762ec6 --- /dev/null +++ b/ansible/roles/poudriere/meta/main.yaml @@ -0,0 +1,2 @@ +dependencies: + - portshaker diff --git a/ansible/roles/poudriere/tasks/common.yaml b/ansible/roles/poudriere/tasks/common.yaml new file mode 100644 index 0000000..fef1101 --- /dev/null +++ b/ansible/roles/poudriere/tasks/common.yaml @@ -0,0 +1,15 @@ +- import_tasks: tasks/freebsd.yaml + when: 'os_flavor == "freebsd"' + +- import_tasks: tasks/linux.yaml + when: 'os_flavor == "linux"' + +- include_tasks: + file: tasks/peruser.yaml + apply: + become: yes + become_user: "{{ initialize_user }}" + when: users is defined + loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`].key') }}" + loop_control: + loop_var: initialize_user diff --git a/ansible/roles/poudriere/tasks/freebsd.yaml b/ansible/roles/poudriere/tasks/freebsd.yaml new file mode 100644 index 0000000..79477e9 --- /dev/null +++ b/ansible/roles/poudriere/tasks/freebsd.yaml @@ -0,0 +1,64 @@ +# +# 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 + +- name: Install packages + package: + name: + - poudriere + - bash + - rsync + - flock + state: present + +# - name: Create directories +# file: +# name: "{{ item }}" +# state: directory +# mode: 0755 +# owner: root +# group: wheel +# loop: +# - /usr/ports/distfiles +# - /opt/poudriere/build_configs +# - /usr/local/poudriere/data/logs/bulk + +# - 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 +# - src: poudriere_deploy_ed25519 +# dest: /usr/local/etc/poudriere.d/poudriere_deploy_ed25519 + +# - name: Install Configuration directory +# copy: +# src: "files/{{ item.src }}" +# dest: "{{ item.dest }}" +# owner: root +# group: wheel +# loop: +# - src: poudriere.d +# dest: /usr/local/etc/ diff --git a/ansible/roles/poudriere/tasks/linux.yaml b/ansible/roles/poudriere/tasks/linux.yaml new file mode 100644 index 0000000..429ad91 --- /dev/null +++ b/ansible/roles/poudriere/tasks/linux.yaml @@ -0,0 +1,21 @@ +# - name: Build aur packages +# register: buildaur +# become_user: "{{ build_user.name }}" +# command: "aurutils-sync --no-view {{ item }}" +# args: +# creates: "/var/cache/pacman/custom/{{ item }}-*.pkg.tar.*" +# loop: +# - foo + +# - name: Update cache +# when: buildaur.changed +# pacman: +# name: [] +# state: present +# update_cache: true + +# - name: Install packages +# package: +# name: +# - foo +# state: present diff --git a/ansible/roles/poudriere/tasks/main.yaml b/ansible/roles/poudriere/tasks/main.yaml new file mode 100644 index 0000000..87fe19a --- /dev/null +++ b/ansible/roles/poudriere/tasks/main.yaml @@ -0,0 +1,2 @@ +- import_tasks: tasks/common.yaml + when: poudriere_builds is defined and poudriere_builds diff --git a/ansible/roles/poudriere/tasks/peruser.yaml b/ansible/roles/poudriere/tasks/peruser.yaml new file mode 100644 index 0000000..111e886 --- /dev/null +++ b/ansible/roles/poudriere/tasks/peruser.yaml @@ -0,0 +1,29 @@ +- include_role: + name: per_user + +# - name: Create directories +# file: +# name: "{{ account_homedir.stdout }}/{{ item }}" +# state: directory +# mode: 0700 +# owner: "{{ account_name.stdout }}" +# group: "{{ group_name.stdout }}" +# loop: +# - ".config/foo" + +# - name: Copy files +# copy: +# src: "files/{{ item.src }}" +# dest: "{{ account_homedir.stdout }}/{{ item.dest }}" +# mode: 0600 +# owner: "{{ account_name.stdout }}" +# group: "{{ group_name.stdout }}" +# loop: +# - src: foo.conf +# dest: .config/foo/foo.conf + +- import_tasks: tasks/peruser_freebsd.yaml + when: 'os_flavor == "freebsd"' + +- import_tasks: tasks/peruser_linux.yaml + when: 'os_flavor == "linux"' diff --git a/ansible/roles/poudriere/tasks/peruser_freebsd.yaml b/ansible/roles/poudriere/tasks/peruser_freebsd.yaml new file mode 100644 index 0000000..e69de29 diff --git a/ansible/roles/poudriere/tasks/peruser_linux.yaml b/ansible/roles/poudriere/tasks/peruser_linux.yaml new file mode 100644 index 0000000..e69de29