From 4efd73105874fc3368de214f614709d9fb091878 Mon Sep 17 00:00:00 2001 From: Michal Muransky Date: Wed, 11 Nov 2020 18:30:49 +0100 Subject: [PATCH] Add idempotence test --- molecule/default/molecule.yml | 1 + tasks/apt.yml | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 6189242..39df0e5 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -132,5 +132,6 @@ scenario: - create - prepare - converge + - idempotence - cleanup - destroy \ No newline at end of file diff --git a/tasks/apt.yml b/tasks/apt.yml index 948a8f6..6d92860 100644 --- a/tasks/apt.yml +++ b/tasks/apt.yml @@ -1,4 +1,9 @@ --- +- name: Check if apt config file exists + stat: + path: /etc/apt/apt.conf.d/proxy.conf + register: stat_result + - name: Create apt config file file: path: /etc/apt/apt.conf.d/proxy.conf @@ -6,6 +11,7 @@ mode: 0600 when: - ansible_pkg_mgr == "apt" + - not stat_result.stat.exists - name: Ensure HTTP Proxy server is in apt.conf lineinfile: