Add OpenBSD
This commit is contained in:
parent
68ddb5835f
commit
60134dba95
7 changed files with 163 additions and 0 deletions
3
main.yml
3
main.yml
|
@ -58,6 +58,9 @@
|
|||
- include_role:
|
||||
name: netbsd
|
||||
when: ansible_distribution == 'NetBSD'
|
||||
- include_role:
|
||||
name: openbsd
|
||||
when: ansible_distribution == 'OpenBSD'
|
||||
- include_role:
|
||||
name: ubuntu
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
|
|
23
roles/openbsd/tasks/main.yml
Normal file
23
roles/openbsd/tasks/main.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
# Copyright 2021-2023 Anthony Perkins
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- import_tasks: packages-cli.yml
|
||||
- import_tasks: packages-gui.yml
|
||||
when: gui == true
|
||||
- import_tasks: rc.yml
|
||||
- import_tasks: ssh.yml
|
||||
- import_tasks: qemu-guest.yml
|
||||
when: gui == true and ansible_virtualization_role == "guest" and ansible_virtualization_type == "kvm"
|
||||
|
25
roles/openbsd/tasks/packages-cli.yml
Normal file
25
roles/openbsd/tasks/packages-cli.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
# Copyright 2021-2023 Anthony Perkins
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Install core CLI packages
|
||||
become: true
|
||||
community.general.openbsd_pkg:
|
||||
name: '{{ packages }}'
|
||||
state: present
|
||||
vars:
|
||||
packages:
|
||||
- ansible
|
||||
- git
|
||||
- mc
|
28
roles/openbsd/tasks/packages-gui.yml
Normal file
28
roles/openbsd/tasks/packages-gui.yml
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
# Copyright 2021-2023 Anthony Perkins
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Install core GUI packages
|
||||
become: true
|
||||
community.general.openbsd_pkg:
|
||||
name: '{{ packages }}'
|
||||
state: present
|
||||
vars:
|
||||
packages:
|
||||
- firefox
|
||||
- icewm
|
||||
- keepassxc
|
||||
- noto-fonts
|
||||
- rxvt-unicode
|
||||
- vim--no_x11
|
22
roles/openbsd/tasks/qemu-guest.yml
Normal file
22
roles/openbsd/tasks/qemu-guest.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
# Copyright 2021-2023 Anthony Perkins
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Set QEMU UEFI screen resolution
|
||||
become: true
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/boot.conf
|
||||
regexp: '^machine gop .*'
|
||||
line: 'machine gop 6'
|
||||
create: yes
|
28
roles/openbsd/tasks/rc.yml
Normal file
28
roles/openbsd/tasks/rc.yml
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
# Copyright 2021-2023 Anthony Perkins
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Enable XDM
|
||||
become: true
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/rc.conf.local
|
||||
regexp: '^xenodm_flags=.*'
|
||||
line: 'xenodm_flags='
|
||||
create: yes
|
||||
- name: Enable dbus
|
||||
become: true
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/rc.conf.local
|
||||
regexp: '^messagebus_flags=.*'
|
||||
line: 'messagebus_flags='
|
34
roles/openbsd/tasks/ssh.yml
Normal file
34
roles/openbsd/tasks/ssh.yml
Normal file
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
# Copyright 2021-2023 Anthony Perkins
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Disable SSH passwords
|
||||
become: true
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '^#?\w*PasswordAuthentication (yes|no)'
|
||||
line: 'PasswordAuthentication no'
|
||||
register: changed_ssh_config
|
||||
- name: Enable SSH
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: sshd
|
||||
enabled: yes
|
||||
state: started
|
||||
- name: Restart SSH
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: sshd
|
||||
state: restarted
|
||||
when: changed_ssh_config.changed == true
|
Loading…
Reference in a new issue