From 77780ff216c214504afb62e92ff19f49f477f692 Mon Sep 17 00:00:00 2001 From: Jens Heinrich Date: Wed, 20 Mar 2019 17:00:42 +0100 Subject: [PATCH] working v6 --- tasks/FreeBSD-bluetooth.yml | 32 +++++++++++++++++ tasks/FreeBSD-chromium.yml | 19 ++++++++++ tasks/FreeBSD-ipv6.yml | 40 +++++++++++++++++++++ tasks/FreeBSD-localunbound.yml | 65 ++++++++++++++++++++++++++++++++++ tasks/FreeBSD-power.yml | 56 +++++++++++++++++++++++++++++ tasks/FreeBSD-reader.yml | 19 ++++++++++ tasks/FreeBSD-shortcuts.yml | 18 ++++++++++ tasks/FreeBSD-sound.yml | 31 ++++++++++++++++ tasks/keyboard.yml | 8 +++++ tasks/main.yml | 25 +++++++++++++ tasks/vars.yml | 16 +++++++++ 11 files changed, 329 insertions(+) create mode 100644 tasks/FreeBSD-bluetooth.yml create mode 100644 tasks/FreeBSD-chromium.yml create mode 100644 tasks/FreeBSD-ipv6.yml create mode 100644 tasks/FreeBSD-localunbound.yml create mode 100644 tasks/FreeBSD-power.yml create mode 100644 tasks/FreeBSD-reader.yml create mode 100644 tasks/FreeBSD-shortcuts.yml create mode 100644 tasks/FreeBSD-sound.yml create mode 100644 tasks/keyboard.yml create mode 100644 tasks/main.yml create mode 100644 tasks/vars.yml diff --git a/tasks/FreeBSD-bluetooth.yml b/tasks/FreeBSD-bluetooth.yml new file mode 100644 index 0000000..1c0b7fe --- /dev/null +++ b/tasks/FreeBSD-bluetooth.yml @@ -0,0 +1,32 @@ +--- +- name: install pkg for bluetooth audio + package: + name: virtual_oss + state: present + become: true + tags: + - install + +- name: load the bt security module + lineinfile: + path: "/etc/rc.conf" + regexp: "^{{ item.name }}" + line: "{{ item.name }}={{ item.val }}" + become: true + loop: "{{ sysctl_setting }}" + vars: + sysctl_setting: + - name: "hcsecd_enable" + val: "YES" + +- name: load the bt module + lineinfile: + path: "/boot/loader.conf" + regexp: "^{{ item.name }}" + line: "{{ item.name }}={{ item.val }}" + become: true + loop: "{{ sysctl_setting }}" + vars: + sysctl_setting: + - name: "ng_ubt_load" + val: "YES" diff --git a/tasks/FreeBSD-chromium.yml b/tasks/FreeBSD-chromium.yml new file mode 100644 index 0000000..1c3149f --- /dev/null +++ b/tasks/FreeBSD-chromium.yml @@ -0,0 +1,19 @@ +--- +- name: install chromium + package: + name: chromium + state: present + become: true + tags: + - install + +- name: add sared memory + sysctl: + name: "{{ item.name }}" + value: "{{ item.val }}" + become: true + loop: "{{ sysctl_setting }}" + vars: + sysctl_setting: + - name: "kern.ipc.shm_allow_removed" + val: "1" diff --git a/tasks/FreeBSD-ipv6.yml b/tasks/FreeBSD-ipv6.yml new file mode 100644 index 0000000..f17ce40 --- /dev/null +++ b/tasks/FreeBSD-ipv6.yml @@ -0,0 +1,40 @@ +--- +#https://forums.freebsd.org/threads/is-there-a-working-dhcpv6-client-for-freebsd.60168/ + +- name: "install the v6 able dhclienzt" + package: + name: dual-dhclient + state: present + become: true + tags: + - installation + + +# http://www.daemonology.net/blog/2017-01-26-IPv6-on-FreeBSD-EC2.html +- name: "enable dual dhcclient for v6" + lineinfile: + path: "/etc/rc.conf" + regexp: "^{{ item.name }}" + line: "{{ item.name }}=\"{{ item.val }}\"" + become: true + loop: "{{ sysctl_setting }}" + tags: + - configuration + vars: + sysctl_setting: + - name: "ifconfig_DEFAULT" + val: " inet6 DHCP" + - name: "ifconfig_DEFAULT" + val: "DHCP accept_rtadv" + - name: "ifconfig_DEFAULT" + val: "DHCP accept_rtadv" + - name: " ipv6_activate_all_interfaces" + val: "YES" + - name: "dhclient_program" + val: "/usr/local/sbin/dual-dhclient" + notify: restart dhclient + +# do i ned to disable the old dhclient? + + + diff --git a/tasks/FreeBSD-localunbound.yml b/tasks/FreeBSD-localunbound.yml new file mode 100644 index 0000000..ce05483 --- /dev/null +++ b/tasks/FreeBSD-localunbound.yml @@ -0,0 +1,65 @@ +--- +- name: "save dhclients dns and dhcp in a file" + lineinfile: + path: "/etc/resolvconf.conf" + regexp: "^{{ item.name }}" + line: "{{ item.name }}={{ item.val }}" + become: true + loop: "{{ sysctl_setting }}" + tags: + - configuration + vars: + sysctl_setting: + - name: "resolv_conf" + val: "/etc/resolv.conf.dhcp" + +- name: "enable local_unbound" + lineinfile: + path: "/etc/rc.conf" + regexp: "^{{ item.name }}" + line: "{{ item.name }}={{ item.val }}" + become: true + loop: "{{ sysctl_setting }}" + tags: + - configuration + vars: + sysctl_setting: + - name: "local_unbound_enable" + val: "YES" + +- name: manage resolv.conf + template: + dest: /etc/resolv.conf + src: templates/resolv.conf.j2 + become: true + tags: + - configuration + +- name: "generate access control" + template: + dest: "/etc/unbound/conf.d/access_control.conf" + src: "templates/access_control.j2" + become: true + tags: + - configuration + notify: "restart local_unbound" + +- name: "generate overlay for local dns" + template: + dest: "/etc/unbound/conf.d/local_resolver.conf" + src: "templates/local_resolver.j2" + become: true + tags: + - configuration + notify: "restart local_unbound" + +- name: "start local_unbound" + service: + name: "local_unbound" + state: started + become: true + tags: + - service + - configuration + + diff --git a/tasks/FreeBSD-power.yml b/tasks/FreeBSD-power.yml new file mode 100644 index 0000000..a0cf2c6 --- /dev/null +++ b/tasks/FreeBSD-power.yml @@ -0,0 +1,56 @@ +--- +- name: disable EIST and throttle + lineinfile: + path: "/boot/loader.conf" + regexp: "^{{ item.name }}" + line: "{{ item.name }}={{ item.val }}" + become: true + loop: "{{ sysctl_setting }}" + vars: + sysctl_setting: + - name: "hint.p4tcc.0.disabled" + val: 1 + - name: "hint.acpi_throttle.0.disabled" + val: 1 + + tags: + - configuration + +- name: install powerd++ + package: + name: powerdxx + state: present + become: true + tags: + - installation + +- name: disable powerd and enable powerd++ + lineinfile: + path: "/etc/rc.conf" + regexp: "^{{ item.name }}" + line: "{{ item.name }}=\"{{ item.val }}\"" + become: true + loop: "{{ sysctl_setting }}" + vars: + sysctl_setting: + - name: "powerdxx_enable" + val: "YES" + - name: "powerd_enable" + val: "NO" + - name: "powerd_flags" + val: "-a hiadaptive -b adaptive -i 85 -r 60 -p 100" + tags: + - configuration + +- name: setup suspend on lid close + sysctl: + name: "{{ item.name }}" + value: "{{ item.value }}" + become: true + loop: "{{ sysctl_setting }}" + vars: + sysctl_setting: + - name: "hw.acpi.lid_switch_state" + value: "S3" + tags: + - configuration diff --git a/tasks/FreeBSD-reader.yml b/tasks/FreeBSD-reader.yml new file mode 100644 index 0000000..1b513cd --- /dev/null +++ b/tasks/FreeBSD-reader.yml @@ -0,0 +1,19 @@ +--- +- name: load modules for the sdcardreader + lineinfile: + path: "/boot/loader.conf" + regexp: "^{{ item.name }}" + line: "{{ item.name }}={{ item.val }}" + become: true + loop: "{{ sysctl_setting }}" + vars: + sysctl_setting: + - name: "sdhcii_load" + val: 1 + - name: "mmcsd_load" + val: 1 + - name: "mmc_load" + val: 1 + tags: + - configuration + diff --git a/tasks/FreeBSD-shortcuts.yml b/tasks/FreeBSD-shortcuts.yml new file mode 100644 index 0000000..7d6c926 --- /dev/null +++ b/tasks/FreeBSD-shortcuts.yml @@ -0,0 +1,18 @@ +--- +- name: disable EIST and throttle + lineinfile: + path: "/boot/loader.conf" + regexp: "^{{ item.name }}" + line: "{{ item.name }}={{ item.val }}" + become: true + loop: "{{ sysctl_setting }}" + vars: + sysctl_setting: + - name: "acpi_ibm_load" + val: YES + - name: "hint.acpi_throttle.0.disabled" + val: 1 + + tags: + - configuration + diff --git a/tasks/FreeBSD-sound.yml b/tasks/FreeBSD-sound.yml new file mode 100644 index 0000000..3ced985 --- /dev/null +++ b/tasks/FreeBSD-sound.yml @@ -0,0 +1,31 @@ +--- +- name: install pkg for bluetooth audio + package: + name: + - virtual_oss + - pavucontrol + state: present + become: true + tags: + - install + +- name: "set the number of audio channels" + lineinfile: + path: "/etc/sysctl.conf" + regexp: "^{{ item.name }}" + line: "{{ item.name }}={{ item.val }}" + become: true + loop: "{{ sysctl_setting }}" + vars: + sysctl_setting: + - name: "hw.snd.default_unit" + val: "{{ defaultsnddevice }}" + - name: "dev.pcm.0.play.vchans" + val: "{{ audiochannel }}" + - name: "dev.pcm.0.rec.vchans" + val: "{{ audiochannel }}" + - name: "hw.snd.maxautovchans" + val: "{{ audiochannel }}" + - name: "hw.snd.vpc_0db" + val: 15 + #https://forums.freebsd.org/threads/low-sound-volume.49620/ diff --git a/tasks/keyboard.yml b/tasks/keyboard.yml new file mode 100644 index 0000000..828b05a --- /dev/null +++ b/tasks/keyboard.yml @@ -0,0 +1,8 @@ +--- +- name: configure keyboard + template: + src: keyboard-conf.j2 + dest: "{{ xorgconfigpath }}/keyboard.conf" + become: true + tags: + - configuration diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..92d1ae6 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,25 @@ +--- +- include: "{{ role_path }}/tasks/vars.yml" + tags: + - vars + +- include_tasks: "{{ tweak }}" + tags: + - installation + - configuration + - vars + loop_control: + loop_var: tweak + loop: + - FreeBSD-ipv6.yml + - FreeBSD-localunbound.yml + - FreeBSD-bluetooth.yml + - FreeBSD-sound.yml + - FreeBSD-power.yml + - FreeBSD-chromium.yml + - FreeBSD-reader.yml + - FreeBSD-shortcuts.yml + - keyboard.yml + - "{{ role_path }}/../common/tasks/chip-development.yml" + - "{{ role_path }}/../common/tasks/nmap.yml" + diff --git a/tasks/vars.yml b/tasks/vars.yml new file mode 100644 index 0000000..9b5a386 --- /dev/null +++ b/tasks/vars.yml @@ -0,0 +1,16 @@ +--- +- debug: + msg: "{{ansible_distribution}}-{{ansible_distribution_major_version}}-{{ansible_distribution}}" + verbosity: 0 + +- name: Load OS specific vars, if available + include_vars: "{{ lookup('first_found', params)}}" + vars: + params: + files: + - '{{ansible_distribution}}-{{ansible_distribution_major_version}}.yml' + - '{{ansible_distribution}}.yml' + - '{{ansible_os_family}}.yml' + - default.yml + paths: + - 'vars'