diff --git a/.kitchen-vagrant.yml b/.kitchen-vagrant.yml new file mode 100644 index 0000000..210e361 --- /dev/null +++ b/.kitchen-vagrant.yml @@ -0,0 +1,107 @@ +--- +# we use docker as plateform +driver: + name: vagrant + +# Ansible will be our provisioner +provisioner: + name: ansible_playbook + hosts: localhost + require_chef_for_busser: false + require_ruby_for_busser: false + require_ansible_omnibus: false + idempotency_test: true + +# We use Inspec as testing framework +verifier: + name: inspec + inspec_tests: + - path: tests/inspec + +# Build platforms +platforms: + # Standard Linux + - name: centos-7 + - name: centos-6 + - name: fedora-28 + - name: fedora-27 + - name: fedora-26 + - name: ubuntu-18.04 + - name: ubuntu-17.10 + - name: ubuntu-16.04 + - name: ubuntu-14.04 + - name: debian-9 + - name: debian-8 + - name: debian-7 + - name: oraclelinux-7 + driver: + box: bento/oracle-7 + - name: oraclelinux-6 + driver: + box: bento/oracle-6 + + # Archlinux + - name: archlinux-rolling + driver: + box: archlinux/archlinux + provision: true + vagrantfiles: + - tests/vagrant/vagrant_archlinux_target.rb + + # Gentoo + - name: gentoo + driver: + box: generic/gentoo + provision: true + vagrantfiles: + - tests/vagrant/vagrant_gentoo_target.rb + + # FreeBSD + - name: freebsd-11.2 + driver: + box: bento/freebsd-11.2 + provision: true + vagrantfiles: + - tests/vagrant/vagrant_freebsd_target.rb + - name: freebsd-10.4 + driver: + box: bento/freebsd-10.4 + provision: true + vagrantfiles: + - tests/vagrant/vagrant_freebsd_target.rb + - name: freebsd-10.3 + driver: + box: bento/freebsd-10.3 + provision: true + vagrantfiles: + - tests/vagrant/vagrant_freebsd_target.rb + + # OpenBSD + - name: openbsd-6 + driver: + box: generic/openbsd6 + provision: true + vagrantfiles: + - tests/vagrant/vagrant_openbsd_target.rb + + # Mac osx + - name: macosx-10.11 + driver: + box: jhcook/osx-elcapitan-10.11 + provision: true + provisioner: + name: ansible_playbook + ansible_binary_path: /usr/local/bin/ + - name: macosx-10.10 + driver: + box: jhcook/osx-yosemite-10.10 + provision: true + provisioner: + name: ansible_playbook + ansible_binary_path: /usr/local/bin/ + +suites: + - name: default + provisioner: + name: ansible_playbook + playbook: tests/test.yml diff --git a/.kitchen.yml b/.kitchen.yml index 5f523f8..bf4f61c 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -147,7 +147,6 @@ platforms: driver: image: diodonfrost/archlinux-rolling-ansible run_command: /usr/lib/systemd/systemd - platform: arch provision_command: - sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config - systemctl enable sshd diff --git a/README.md b/README.md index c04f34e..367fe00 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,11 @@ Supported platforms: - name: Gentoo versions: - stage3 +- name: FreeBSD + versions: + - 11.2 + - 10.4 + - 10.3 ``` ## Role Variables diff --git a/meta/main.yml b/meta/main.yml index fe849e4..cd4e354 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -58,6 +58,11 @@ galaxy_info: - name: Gentoo versions: - stage3 + - name: FreeBSD + versions: + - 11.2 + - 10.4 + - 10.3 galaxy_tags: - system diff --git a/tasks/packages/setup-FreeBSD.yml b/tasks/packages/setup-FreeBSD.yml new file mode 100644 index 0000000..dde3512 --- /dev/null +++ b/tasks/packages/setup-FreeBSD.yml @@ -0,0 +1,13 @@ +--- +# Tasks file for install ntp daemon on FreeBSD system + +- name: Install ntp daemon on FreeBSD + package: + name: "{{ ntp_package }}" + state: present + +- name: Service ntp on FreeBSD + service: + name: "{{ ntp_service }}" + enabled: yes + state: started diff --git a/tests/vagrant/vagrant_archlinux_target.rb b/tests/vagrant/vagrant_archlinux_target.rb new file mode 100644 index 0000000..8ded34a --- /dev/null +++ b/tests/vagrant/vagrant_archlinux_target.rb @@ -0,0 +1,5 @@ +Vagrant.configure(2) do |config| + config.vm.provision "shell", inline: <<-SHELL + pacman --noconfirm -Syu ansible + SHELL +end diff --git a/tests/vagrant/vagrant_freebsd_target.rb b/tests/vagrant/vagrant_freebsd_target.rb new file mode 100644 index 0000000..197cee2 --- /dev/null +++ b/tests/vagrant/vagrant_freebsd_target.rb @@ -0,0 +1,7 @@ +Vagrant.configure(2) do |config| + config.vm.provision "shell", inline: <<-SHELL + pkg install -y ncurses python + pkg install -y py27-ansible + ln -s /usr/local/bin/python2.7 /usr/bin/python + SHELL +end diff --git a/tests/vagrant/vagrant_gentoo_target.rb b/tests/vagrant/vagrant_gentoo_target.rb new file mode 100644 index 0000000..aabe510 --- /dev/null +++ b/tests/vagrant/vagrant_gentoo_target.rb @@ -0,0 +1,11 @@ +Vagrant.configure(2) do |config| + config.vm.provision "shell", inline: <<-SHELL + emerge --sync + echo 'USE=-bindist' >> /etc/portage/make.conf + echo 'dev-lang/python sqlite' >> /etc/portage/package.use/python + emerge net-misc/openssh app-admin/sudo app-admin/ansible app-portage/gentoolkit + # Enable features on specific package for java install + echo 'x11-libs/cairo X' > /etc/portage/package.use/cairo + echo 'app-text/ghostscript-gpl cups' > /etc/portage/package.use/ghostscript-gpl + SHELL +end diff --git a/tests/vagrant/vagrant_openbsd_target.rb b/tests/vagrant/vagrant_openbsd_target.rb new file mode 100644 index 0000000..a811261 --- /dev/null +++ b/tests/vagrant/vagrant_openbsd_target.rb @@ -0,0 +1,9 @@ +Vagrant.configure(2) do |config| + config.vm.provision "shell", inline: <<-SHELL + OPENBSD_VERSION=`uname -a | awk -F " " '{print $3}'` + wget -P /tmp https://ftp.openbsd.org/pub/OpenBSD/${OPENBSD_VERSION}/amd64/xbase64.tgz + cd / && tar xzvphf /tmp/xbase64.tgz + pkg_add -z ansible + ln -s /usr/local/bin/python2.7 /usr/bin/python + SHELL +end diff --git a/tests/vagrant/vagrant_solaris_target.rb b/tests/vagrant/vagrant_solaris_target.rb new file mode 100644 index 0000000..6f5b1ba --- /dev/null +++ b/tests/vagrant/vagrant_solaris_target.rb @@ -0,0 +1,10 @@ +Vagrant.configure(2) do |config| + config.vm.provision "shell", inline: <<-SHELL + pkg install -r gcc + wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz + tar zxvf Python-3.7.1.tgz && cd Python-3.7.1 + ./configure + make + make install + SHELL +end diff --git a/tests/vagrant/vagrant_windows_target.rb b/tests/vagrant/vagrant_windows_target.rb new file mode 100644 index 0000000..e5dec10 --- /dev/null +++ b/tests/vagrant/vagrant_windows_target.rb @@ -0,0 +1,4 @@ +Vagrant.configure("2") do |c| + c.vm.provision :shell, path: "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1" + c.vm.provision :shell, path: "https://chocolatey.org/install.ps1" +end diff --git a/vars/FreeBSD.yml b/vars/FreeBSD.yml new file mode 100644 index 0000000..cba4248 --- /dev/null +++ b/vars/FreeBSD.yml @@ -0,0 +1,2 @@ +ntp_package: ntp +ntp_service: ntpd diff --git a/vars/Suse.yml b/vars/Suse.yml index 0e42ddd..cba4248 100644 --- a/vars/Suse.yml +++ b/vars/Suse.yml @@ -1,2 +1,2 @@ ntp_package: ntp -ntp_service: ntp +ntp_service: ntpd