diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8000dd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vagrant diff --git a/.travis.yml b/.travis.yml index 3e7788b..456ade6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ --- language: c +sudo: required before_install: - sudo add-apt-repository -y ppa:ansible/ansible @@ -10,8 +11,6 @@ install: # Add ansible.cfg to pick up roles path. - "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg" - - "ansible-galaxy install willshersystems.apt" - script: # Check the roles syntax - "ansible-playbook -i tests/inventory tests/test.yml --syntax-check" diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..149727e --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,29 @@ + +# vi: set ft=ruby : + +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + # config.vm.define "ubuntu" do |ubuntu| + # ubuntu.vm.box = "ubuntu/trusty64" + # ubuntu.vm.provision "shell", inline: <<-SHELL + # sudo add-apt-repository -y ppa:ansible/ansible + # sudo apt-get update -qq + # sudo apt-get -qq install ansible + # SHELL + # end + + config.vm.define "centos6" do |centos| + centos.vm.box = "bento/centos-6.7" + end + + config.vm.provision "shell", inline: <<-SHELL + sudo yum install -y libselinux-python + SHELL + + config.vm.provision "ansible_local" do |ansible| + ansible.playbook = "tests/test.yml" + ansible.install = true + end + +end diff --git a/meta/10_top.j2 b/meta/10_top.j2 index f490477..7499e24 100644 --- a/meta/10_top.j2 +++ b/meta/10_top.j2 @@ -16,6 +16,7 @@ {% endif %} {% endmacro %} {% macro body_option(key,override) %} +{% set value = undefined %} {% if override is defined %} {% set value = override %} {% elif sshd[key] is defined %} diff --git a/templates/sshd_config.j2 b/templates/sshd_config.j2 index 5073cd4..633b86d 100644 --- a/templates/sshd_config.j2 +++ b/templates/sshd_config.j2 @@ -16,6 +16,7 @@ {% endif %} {% endmacro %} {% macro body_option(key,override) %} +{% set value = undefined %} {% if override is defined %} {% set value = override %} {% elif sshd[key] is defined %} diff --git a/tests/roles/ansible-sshd b/tests/roles/ansible-sshd new file mode 120000 index 0000000..a24d5e8 --- /dev/null +++ b/tests/roles/ansible-sshd @@ -0,0 +1 @@ +../../. \ No newline at end of file diff --git a/tests/test.yml b/tests/test.yml index 17d75e7..f143641 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -1,6 +1,5 @@ --- - hosts: localhost - remote_user: root + become: true roles: - ansible-sshd -