Skip to content

Commit

Permalink
Fix Ansible warnings
Browse files Browse the repository at this point in the history
And add support for Ubuntu 18.04
  • Loading branch information
tersmitten committed Nov 22, 2018
1 parent e1311cc commit f04d726
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ python: "2.7"

env:
- ANSIBLE_VERSION=latest
- ANSIBLE_VERSION=2.7.2
- ANSIBLE_VERSION=2.7.1
- ANSIBLE_VERSION=2.7.0
- ANSIBLE_VERSION=2.6.8
- ANSIBLE_VERSION=2.6.7
- ANSIBLE_VERSION=2.6.6
- ANSIBLE_VERSION=2.6.5
Expand Down Expand Up @@ -56,7 +58,7 @@ script:
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
- if [ "$ANSIBLE_VERSION" = "latest" ]; then ansible-lint tests/test.yml || true; fi
- if [ "$ANSIBLE_VERSION" = "latest" ]; then ansible-lint tests/test.yml; fi

notifications:
email: false
Expand Down
14 changes: 11 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

role = File.basename(File.expand_path(File.dirname(__FILE__)))


boxes = [
{
:name => "ubuntu-1204",
Expand All @@ -25,24 +26,31 @@ boxes = [
:cpu => "50",
:ram => "256"
},
{
:name => "ubuntu-1804",
:box => "bento/ubuntu-18.04",
:ip => '10.0.0.14',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-7",
:box => "bento/debian-7",
:ip => '10.0.0.14',
:ip => '10.0.0.15',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-8",
:box => "bento/debian-8",
:ip => '10.0.0.15',
:ip => '10.0.0.16',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-9",
:box => "bento/debian-9",
:ip => '10.0.0.16',
:ip => '10.0.0.17',
:cpu => "50",
:ram => "256"
},
Expand Down
2 changes: 2 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# meta file for apt
---
galaxy_info:
role_name: apt
author: Mischa ter Smitten
company: Oefenweb.nl B.V.
description: Manage packages and up(date|grade)s in Debian-like systems
Expand All @@ -12,6 +13,7 @@ galaxy_info:
- precise
- trusty
- xenial
- bionic
- name: Debian
versions:
- wheezy
Expand Down
19 changes: 11 additions & 8 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
- apt-update

- name: dpkg --configure
command: dpkg --configure -a
command: >
dpkg --configure -a
args:
warn: false
changed_when: _dpkg_configure.stdout_lines | length
register: _dpkg_configure
when: apt_dpkg_configure
Expand All @@ -36,9 +39,8 @@

- name: install dependencies
apt:
name: "{{ item }}"
name: "{{ apt_dependencies }}"
state: "{{ apt_install_state }}"
with_items: "{{ apt_dependencies }}"
tags:
- configuration
- apt
Expand All @@ -56,7 +58,10 @@
- apt-upgrade

- name: clean
command: apt-get -y clean
command: >
apt-get -y clean
args:
warn: false
changed_when: false
when: apt_clean
tags:
Expand All @@ -76,20 +81,18 @@

- name: install
apt:
name: "{{ item }}"
name: "{{ apt_install }}"
state: "{{ apt_install_state }}"
with_items: "{{ apt_install }}"
tags:
- configuration
- apt
- apt-install

- name: remove
apt:
name: "{{ item }}"
name: "{{ apt_remove }}"
state: absent
purge: "{{ apt_remove_purge }}"
with_items: "{{ apt_remove }}"
tags:
- configuration
- apt
Expand Down
2 changes: 1 addition & 1 deletion templates/etc/apt/sources.list.Ubuntu.j2
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ deb http://archive.canonical.com/ubuntu {{ ansible_distribution_release }} partn

# # This software is not part of Ubuntu, but is offered by third-party
# # developers who want to ship their latest software.
{% if apt_ubuntu_extras_enable and ansible_distribution_version | version_compare('16.04', '<') %}
{% if apt_ubuntu_extras_enable and ansible_distribution_version is version('16.04', '<') %}
deb http://extras.ubuntu.com/ubuntu {{ ansible_distribution_release }} main
{{ '# ' if not apt_src_enable else '' }}deb-src http://extras.ubuntu.com/ubuntu {{ ansible_distribution_release }} main
{% endif %}
7 changes: 7 additions & 0 deletions tests/vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@
become: true
roles:
- ../../
# vars:
# apt_manage_sources_list: true
#
# apt_ubuntu_partner_enable: true
# apt_ubuntu_extras_enable: true
#
# apt_dpkg_configure: true

0 comments on commit f04d726

Please sign in to comment.