Skip to content

Commit 708d33a

Browse files
authored
Merge pull request #20 from robertdebock/openbsd
Openbsd
2 parents 4448474 + ee33919 commit 708d33a

File tree

5 files changed

+46
-7
lines changed

5 files changed

+46
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bootstrap_preview: yes
4444
bootstrap_wait_for_host: no
4545
4646
# The number of retries you want tasks to do before failing.
47-
bootstrap_retries: 10
47+
bootstrap_retries: 3
4848
4949
# To update all packages installed by this roles, set `bootstrap_package_state` to `latest`.
5050
bootstrap_package_state: present

meta/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ galaxy_info:
3131
versions:
3232
- 10.4
3333
- 11.2
34+
- name: OpenBSD
35+
version:
36+
- all
3437
- name: OpenSUSE
3538
versions:
3639
- all
@@ -52,6 +55,7 @@ galaxy_info:
5255
- freebsd
5356
- gentoo
5457
- installer
58+
- openbsd
5559
- opensuse
5660
- rhel
5761
- server

molecule/vagrant/molecule.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ platforms:
1414
box: debian/stretch64
1515
- name: bootstrap-fedora
1616
box: fedora/29-cloud-base
17+
- name: bootstrap-openbsd
18+
box: generic/openbsd6
1719
provisioner:
1820
name: ansible
1921
lint:
2022
name: ansible-lint
2123
config_options:
2224
defaults:
2325
callback_plugins: /usr/lib/python2.7/site-packages/ara/plugins/callbacks
26+
inventory:
27+
host_vars:
28+
bootstrap-openbsd:
29+
ansible_python_interpreter: /usr/local/bin/python3
2430
scenario:
2531
name: vagrant
26-
verifier:
27-
name: goss
28-
lint:
29-
name: yamllint

tasks/main.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@
5959
become: no
6060
check_mode: no
6161

62+
- name: register pkg_add
63+
raw: pkg_info
64+
register: pkg_add
65+
changed_when: no
66+
failed_when: no
67+
become: no
68+
check_mode: no
69+
6270
- name: register yum
6371
raw: yum --version
6472
register: yum
@@ -146,6 +154,17 @@
146154
until: pkgresult is succeeded
147155
retries: "{{ bootstrap_retries }}"
148156

157+
- name: install software with pkg_add
158+
raw: pkg_add -Iz {{ bootstrap_pkg_add_packages }}
159+
when:
160+
- pkg_add.rc == 0
161+
register: pkg_add_getresult
162+
changed_when:
163+
- "': ok' in pkg_add_getresult.stdout"
164+
remote_user: "{{ bootstrap_user }}"
165+
until: pkg_add_getresult is succeeded
166+
retries: "{{ bootstrap_retries }}"
167+
149168
- name: install software with yum
150169
raw: "yum -y install {{ bootstrap_yum_packages }}"
151170
when:

vars/main.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@ bootstrap_apt_packages: python sudo
88
bootstrap_dnf_packages: python sudo
99
bootstrap_emerge_packages: python sudo gentoolkit
1010
bootstrap_pacman_packages: python sudo
11+
bootstrap_pkg_add_packages: python-3* sudo--
1112
bootstrap_pkg_packages: python sudo
1213
bootstrap_yum_packages: python2 sudo
1314
bootstrap_zypper_packages: python python-xml sudo
1415

1516
bootstrap_alpine_community_repo: "http://dl-cdn.alpinelinux.org/alpine/v{{ ansible_distribution_version.split('.')[0] }}.{{ ansible_distribution_version.split('.')[1] }}/community"
1617

18+
# Some distributions do not have the fact `ansible_distribution_major_version`,
19+
# as a workaround it's determined here, saved to another variable and used
20+
# later.
21+
22+
bootstrap_ansible_distribution_major_version: ansible_distibution_major_version | default('none')
23+
1724
# A dictionary based on Ansible facts `ansible_distribution` and
1825
# `ansible_distribution_major_version` containing a list of packages.
1926
# This list is very similar to the `boostrap_{{ ansible_pkg_mgr }}_package`
@@ -44,6 +51,9 @@ _bootstrap_packages:
4451
- python
4552
- sudo
4653
- gentoolkit
54+
OpenBSD:
55+
- python%3
56+
- sudo--
4757
openSUSE Leap:
4858
- python
4959
- python-xml
@@ -53,7 +63,7 @@ _bootstrap_packages:
5363
- python-xml
5464
- sudo
5565

56-
bootstrap_packages: "{{ _bootstrap_packages[ansible_distribution ~ '-' ~ ansible_distribution_major_version] | default(_bootstrap_packages[ansible_distribution] | default(_bootstrap_packages['default'])) }}"
66+
bootstrap_packages: "{{ _bootstrap_packages[ansible_distribution ~ '-' ~ bootstrap_ansible_distribution_major_version] | default(_bootstrap_packages[ansible_distribution] | default(_bootstrap_packages['default'])) }}"
5767

5868
# A dictionary based on Ansible facts `ansible_distribution` and
5969
# `ansible_distribution_major_version` containing a list of packages. The
@@ -82,6 +92,8 @@ _bootstrap_stable_packages:
8292
- polkit
8393
- python-devel
8494
- python-simplejson
95+
OpenBSD:
96+
- py-simplejson--
8597
openSUSE Leap:
8698
- acl
8799
- ca-certificates
@@ -94,7 +106,7 @@ _bootstrap_stable_packages:
94106
- python-apt
95107
- python-simplejson
96108

97-
bootstrap_stable_packages: "{{ _bootstrap_stable_packages[ansible_distribution ~ '-' ~ ansible_distribution_major_version] | default(_bootstrap_stable_packages[ansible_distribution] | default(_bootstrap_stable_packages['default'])) }}"
109+
bootstrap_stable_packages: "{{ _bootstrap_stable_packages[ansible_distribution ~ '-' ~ bootstrap_ansible_distribution_major_version] | default(_bootstrap_stable_packages[ansible_distribution] | default(_bootstrap_stable_packages['default'])) }}"
98110

99111
# A dictionary based on Ansible facts `ansible_distribution` and
100112
# `ansible_distribution_major_version` containing a list of packages. The
@@ -130,6 +142,8 @@ _bootstrap_preview_packages:
130142
- gzip
131143
- tar
132144
- unzip
145+
OpenBSD:
146+
- unzip--
133147
Ubuntu:
134148
- apt-transport-https
135149
- gzip

0 commit comments

Comments
 (0)