summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/integration/targets/dnf/meta/main.yml1
-rw-r--r--test/integration/targets/dnf/tasks/main.yml15
-rw-r--r--test/integration/targets/dnf/tasks/repo.yml214
-rw-r--r--test/integration/targets/setup_rpm_repo/files/create-repo.py (renamed from test/integration/targets/yum/files/create-repo.py)0
-rw-r--r--test/integration/targets/setup_rpm_repo/tasks/main.yml63
-rw-r--r--test/integration/targets/yum/aliases2
-rw-r--r--test/integration/targets/yum/meta/main.yml1
-rw-r--r--test/integration/targets/yum/tasks/repo.yml1140
8 files changed, 800 insertions, 636 deletions
diff --git a/test/integration/targets/dnf/meta/main.yml b/test/integration/targets/dnf/meta/main.yml
index 07faa21776..73076d3562 100644
--- a/test/integration/targets/dnf/meta/main.yml
+++ b/test/integration/targets/dnf/meta/main.yml
@@ -1,2 +1,3 @@
dependencies:
- prepare_tests
+ - setup_rpm_repo
diff --git a/test/integration/targets/dnf/tasks/main.yml b/test/integration/targets/dnf/tasks/main.yml
index 43dbfba5bf..cd33b2f462 100644
--- a/test/integration/targets/dnf/tasks/main.yml
+++ b/test/integration/targets/dnf/tasks/main.yml
@@ -1,4 +1,4 @@
-# test code for the yum module
+# test code for the dnf module
# (c) 2014, James Tanner <tanner.jc@gmail.com>
# This file is part of Ansible
@@ -20,7 +20,16 @@
# We want to test that for people who don't want to upgrade their systems.
- include: 'dnf.yml'
- when: (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and False) or (ansible_distribution in ['Fedora'] and ansible_distribution_major_version|int >= 23)
+ when:
+ - ansible_distribution == 'Fedora'
+ - ansible_distribution_major_version|int >= 23
+
+- include: 'repo.yml'
+ when:
+ - ansible_distribution == 'Fedora'
+ - ansible_distribution_major_version|int >= 23
- include: 'dnfinstallroot.yml'
- when: (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and False) or (ansible_distribution in ['Fedora'] and ansible_distribution_major_version|int >= 23)
+ when:
+ - ansible_distribution == 'Fedora'
+ - ansible_distribution_major_version|int >= 23
diff --git a/test/integration/targets/dnf/tasks/repo.yml b/test/integration/targets/dnf/tasks/repo.yml
new file mode 100644
index 0000000000..660c0813c3
--- /dev/null
+++ b/test/integration/targets/dnf/tasks/repo.yml
@@ -0,0 +1,214 @@
+- block:
+ - name: Install foo-1.0-1
+ dnf:
+ name: foo-1.0-1
+ state: present
+ register: dnf_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "dnf_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-1')"
+
+ - name: Verify dnf module outputs
+ assert:
+ that:
+ - "'results' in dnf_result"
+ # ============================================================================
+ - name: Install foo-1.0-1 again
+ dnf:
+ name: foo-1.0-1
+ state: present
+ register: dnf_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "not dnf_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-1')"
+
+ - name: Verify dnf module outputs
+ assert:
+ that:
+ - "'msg' in dnf_result"
+ # ============================================================================
+ - name: Install foo-1:1.0-2
+ dnf:
+ name: "foo-1:1.0-2.{{ ansible_architecture }}"
+ state: present
+ register: dnf_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "dnf_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-2')"
+
+ - name: Verify dnf module outputs
+ assert:
+ that:
+ - "'results' in dnf_result"
+ # ============================================================================
+ - name: Update to the latest foo
+ dnf:
+ name: foo
+ state: latest
+ register: dnf_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "dnf_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.1-1')"
+
+ - name: Verify dnf module outputs
+ assert:
+ that:
+ - "'results' in dnf_result"
+ # ============================================================================
+ - name: Install foo-1.0-1 from a file (downgrade)
+ dnf:
+ name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
+ state: present
+ register: dnf_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "dnf_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-1')"
+
+ - name: Verify dnf module outputs
+ assert:
+ that:
+ - "'results' in dnf_result"
+
+ - name: Remove foo
+ dnf:
+ name: foo
+ state: absent
+ # ============================================================================
+ - name: Install foo-1.0-1 from a file
+ dnf:
+ name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
+ state: present
+ register: dnf_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "dnf_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-1')"
+
+ - name: Verify dnf module outputs
+ assert:
+ that:
+ - "'results' in dnf_result"
+ # ============================================================================
+ - name: Install foo-1.0-1 from a file again
+ dnf:
+ name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
+ state: present
+ register: dnf_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "not dnf_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-1')"
+ # ============================================================================
+ - name: Install foo-1.0-2 from a file
+ dnf:
+ name: "{{ repodir }}/foo-1.0-2.{{ ansible_architecture }}.rpm"
+ state: present
+ register: dnf_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "dnf_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-2')"
+
+ - name: Verify dnf module outputs
+ assert:
+ that:
+ - "'results' in dnf_result"
+ # ============================================================================
+ - name: Install foo-1.0-2 from a file again
+ dnf:
+ name: "{{ repodir }}/foo-1.0-2.{{ ansible_architecture }}.rpm"
+ state: present
+ register: dnf_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "not dnf_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-2')"
+ # ============================================================================
+ - name: Remove foo
+ dnf:
+ name: foo
+ state: absent
+
+ - name: Try to install incompatible arch
+ dnf:
+ name: "{{ repodir_ppc64 }}/foo-1.0-1.ppc64.rpm"
+ state: present
+ register: dnf_result
+ ignore_errors: yes
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+ ignore_errors: yes
+
+ - name: Verify installation
+ assert:
+ that:
+ - "rpm_result.rc == 1"
+ - "not dnf_result.changed"
+ - "dnf_result is failed"
+ # ============================================================================
+ always:
+ - name: Clean up
+ yum:
+ name: foo
+ state: absent
diff --git a/test/integration/targets/yum/files/create-repo.py b/test/integration/targets/setup_rpm_repo/files/create-repo.py
index 6d5e1db312..6d5e1db312 100644
--- a/test/integration/targets/yum/files/create-repo.py
+++ b/test/integration/targets/setup_rpm_repo/files/create-repo.py
diff --git a/test/integration/targets/setup_rpm_repo/tasks/main.yml b/test/integration/targets/setup_rpm_repo/tasks/main.yml
new file mode 100644
index 0000000000..4c18a332d1
--- /dev/null
+++ b/test/integration/targets/setup_rpm_repo/tasks/main.yml
@@ -0,0 +1,63 @@
+- block:
+ - name: Install epel repo which is missing on rhel-7 and is needed for rpmfluff
+ package:
+ name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
+ when:
+ - ansible_distribution in ['RedHat']
+
+ - name: Install rpmfluff and deps
+ package:
+ name: "{{ item }}"
+ with_items:
+ - python-rpmfluff
+ - createrepo_c
+ - createrepo # used by el6 version of rpmfluff
+
+ - name: Copy script for creating a repo
+ copy:
+ src: create-repo.py
+ dest: /tmp/create-repo.py
+ mode: 0755
+
+ - name: Create RPMs and put them into a repo
+ shell: "python /tmp/create-repo.py {{ ansible_architecture }}"
+ register: repo
+
+ - set_fact:
+ repodir: "{{ repo.stdout_lines[-1] }}"
+
+ - name: Install the repo
+ yum_repository:
+ name: "fake-{{ ansible_architecture }}"
+ description: "fake-{{ ansible_architecture }}"
+ baseurl: "file://{{ repodir }}"
+ gpgcheck: no
+
+ - name: Create RPMs and put them into a repo (i686)
+ shell: "python /tmp/create-repo.py i686"
+ register: repo_i686
+
+ - set_fact:
+ repodir_i686: "{{ repo_i686.stdout_lines[-1] }}"
+
+ - name: Install the repo (i686)
+ yum_repository:
+ name: "fake-i686"
+ description: "fake-i686"
+ baseurl: "file://{{ repodir_i686 }}"
+ gpgcheck: no
+
+ - name: Create RPMs and put them into a repo (ppc64)
+ shell: "python /tmp/create-repo.py ppc64"
+ register: repo_ppc64
+
+ - set_fact:
+ repodir_ppc64: "{{ repo_ppc64.stdout_lines[-1] }}"
+
+ - name: Install the repo (ppc64)
+ yum_repository:
+ name: "fake-ppc64"
+ description: "fake-ppc64"
+ baseurl: "file://{{ repodir_ppc64 }}"
+ gpgcheck: no
+ when: ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora']
diff --git a/test/integration/targets/yum/aliases b/test/integration/targets/yum/aliases
index 8e7d715f9c..5d97a9be5e 100644
--- a/test/integration/targets/yum/aliases
+++ b/test/integration/targets/yum/aliases
@@ -1,2 +1,4 @@
destructive
posix/ci/group1
+skip/freebsd
+skip/osx
diff --git a/test/integration/targets/yum/meta/main.yml b/test/integration/targets/yum/meta/main.yml
index 07faa21776..73076d3562 100644
--- a/test/integration/targets/yum/meta/main.yml
+++ b/test/integration/targets/yum/meta/main.yml
@@ -1,2 +1,3 @@
dependencies:
- prepare_tests
+ - setup_rpm_repo
diff --git a/test/integration/targets/yum/tasks/repo.yml b/test/integration/targets/yum/tasks/repo.yml
index 1b87106339..76bc96891b 100644
--- a/test/integration/targets/yum/tasks/repo.yml
+++ b/test/integration/targets/yum/tasks/repo.yml
@@ -1,634 +1,508 @@
-- name: Install epel repo which is missing on rhel-7 and is needed for rpmfluff
- yum:
- name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
- when:
- - ansible_distribution in ['RedHat']
-
-- name: Install rpmfluff and deps
- yum:
- name: "{{ item }}"
- with_items:
- - python-rpmfluff
- - createrepo_c
- - createrepo # used by el6 version of rpmfluff
-
-- name: Copy script for creating a repo
- copy:
- src: create-repo.py
- dest: /tmp/create-repo.py
- mode: 0755
-
-- name: Create RPMs and put them into a repo
- shell: "python /tmp/create-repo.py {{ ansible_architecture }}"
- register: repo
-
-- set_fact:
- repodir: "{{ repo.stdout_lines[-1] }}"
-
-- name: Install the repo
- yum_repository:
- name: "fake-{{ ansible_architecture }}"
- description: "fake-{{ ansible_architecture }}"
- baseurl: "file://{{ repodir }}"
- gpgcheck: no
-
-- name: Create RPMs and put them into a repo (i686)
- shell: "python /tmp/create-repo.py i686"
- register: repo_i686
-
-- set_fact:
- repodir_i686: "{{ repo_i686.stdout_lines[-1] }}"
-
-- name: Install the repo (i686)
- yum_repository:
- name: "fake-i686"
- description: "fake-i686"
- baseurl: "file://{{ repodir_i686 }}"
- gpgcheck: no
-
-- name: Create RPMs and put them into a repo (ppc64)
- shell: "python /tmp/create-repo.py ppc64"
- register: repo_ppc64
-
-- set_fact:
- repodir_ppc64: "{{ repo_ppc64.stdout_lines[-1] }}"
-
-- name: Install the repo (ppc64)
- yum_repository:
- name: "fake-ppc64"
- description: "fake-ppc64"
- baseurl: "file://{{ repodir_ppc64 }}"
- gpgcheck: no
-# ============================================================================
-- name: Install foo-1.0-1
- yum:
- name: foo-1.0-1
- state: present
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.0-1')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
-- name: Install foo-1.0-1 again
- yum:
- name: foo-1.0-1
- state: present
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "not yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.0-1')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
-- name: Install foo-1:1.0-2
- yum:
- name: "foo-1:1.0-2.{{ ansible_architecture }}"
- state: present
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.0-2')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-
-- name: Remove foo
- yum:
- name: foo
- state: absent
-# ============================================================================
-- name: Install 1:foo-1.0-2
- yum:
- name: "1:foo-1.0-2.{{ ansible_architecture }}"
- state: present
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.0-2')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
-- name: Install foo-1.0-2 again
- yum:
- name: foo-1.0-2
- state: present
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "not yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.0-2')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
-- name: Update to the latest foo
- yum:
- name: foo
- state: latest
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.1-1')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
-- name: Install foo-1.0-1 from a file (higher version is already installed)
- yum:
- name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
- state: present
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "not yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.1-1')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-
-- name: Remove foo
- yum:
- name: foo
- state: absent
-# ============================================================================
-- name: Install foo-1.0-1 from a file
- yum:
- name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
- state: present
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.0-1')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
-- name: Install foo-1.0-1 from a file again
- yum:
- name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
- state: present
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "not yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.0-1')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
-- name: Install foo-1.0-2 from a file
- yum:
- name: "{{ repodir }}/foo-1.0-2.{{ ansible_architecture }}.rpm"
- state: present
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.0-2')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
-- name: Install foo-1.0-2 from a file again
- yum:
- name: "{{ repodir }}/foo-1.0-2.{{ ansible_architecture }}.rpm"
- state: present
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "not yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.0-2')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
-- name: Try to downgrade foo without allow_downgrade being set
- yum:
- name: foo-1.0-1
- state: present
- allow_downgrade: no
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "not yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.0-2')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
-- name: Downgrade foo
- yum:
- name: foo-1.0-1
- state: present
- allow_downgrade: yes
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.0-1')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
-- name: Update foo with update_only set
- yum:
- name: foo
- state: latest
- update_only: yes
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.1-1')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-
-- name: Remove foo
- yum:
- name: foo
- state: absent
-# ============================================================================
-- name: Try to update foo which is not installed, update_only is set
- yum:
- name: foo
- state: latest
- update_only: yes
- register: yum_result
- ignore_errors: yes
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
- ignore_errors: yes
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 1"
- - "yum_result.rc == 0"
- - "not yum_result.changed"
- - "not yum_result|failed"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
-- name: Try to install incompatible arch
- yum:
- name: "{{ repodir_ppc64 }}/foo-1.0-1.ppc64.rpm"
- state: present
- register: yum_result
- ignore_errors: yes
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
- ignore_errors: yes
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 1"
- - "yum_result.rc == 1"
- - "not yum_result.changed"
- - "yum_result|failed"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
-- name: Make sure latest foo is installed
- yum:
- name: foo
- state: latest
-
-- name: Downgrade foo using rpm file
- yum:
- name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
- state: present
- allow_downgrade: yes
- register: yum_result
-
-- name: Check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
-- name: Verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout.startswith('foo-1.0-1')"
-
-- name: Verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
-# ============================================================================
- block:
- - name: make sure foo is not installed
- yum:
- name: foo
- state: absent
-
- - name: install foo both archs
- yum:
- name: "{{ item }}"
- state: present
- with_items:
- - "{{ repodir }}/foo-1.1-1.x86_64.rpm"
- - "{{ repodir_i686 }}/foo-1.1-1.i686.rpm"
-
- - name: try to install lower version of foo from rpm file, without allow_downgrade, just one arch
- yum:
- name: "{{ repodir_i686 }}/foo-1.0-1.i686.rpm"
- state: present
- register: yum_result
-
- - name: check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
- - name: verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "not yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout_lines[0].startswith('foo-1.1-1')"
- - "rpm_result.stdout_lines[1].startswith('foo-1.1-1')"
-
- - name: verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
- when: ansible_architecture == "x86_64"
-# ============================================================================
-- block:
- - name: make sure foo is not installed
- yum:
- name: foo
- state: absent
-
- - name: install foo both archs
- yum:
- name: "{{ item }}"
- state: present
- with_items:
- - "{{ repodir }}/foo-1.0-1.x86_64.rpm"
- - "{{ repodir_i686 }}/foo-1.0-1.i686.rpm"
-
- - name: Update both arch in one task using rpm files
- yum:
- name: "{{ repodir }}/foo-1.1-1.x86_64.rpm,{{ repodir_i686 }}/foo-1.1-1.i686.rpm"
- state: present
- register: yum_result
-
- - name: check foo with rpm
- shell: rpm -q foo
- register: rpm_result
-
- - name: verify installation
- assert:
- that:
- - "rpm_result.rc == 0"
- - "yum_result.rc == 0"
- - "yum_result.changed"
- - "not yum_result|failed"
- - "rpm_result.stdout_lines[0].startswith('foo-1.1-1')"
- - "rpm_result.stdout_lines[1].startswith('foo-1.1-1')"
-
- - name: verify yum module outputs
- assert:
- that:
- - "'changed' in yum_result"
- - "'msg' in yum_result"
- - "'rc' in yum_result"
- - "'results' in yum_result"
- when: ansible_architecture == "x86_64"
-# ============================================================================
+ - name: Install foo-1.0-1
+ yum:
+ name: foo-1.0-1
+ state: present
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-1')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - name: Install foo-1.0-1 again
+ yum:
+ name: foo-1.0-1
+ state: present
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "not yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-1')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - name: Install foo-1:1.0-2
+ yum:
+ name: "foo-1:1.0-2.{{ ansible_architecture }}"
+ state: present
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-2')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+
+ - name: Remove foo
+ yum:
+ name: foo
+ state: absent
+ # ============================================================================
+ - name: Install 1:foo-1.0-2
+ yum:
+ name: "1:foo-1.0-2.{{ ansible_architecture }}"
+ state: present
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-2')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - name: Install foo-1.0-2 again
+ yum:
+ name: foo-1.0-2
+ state: present
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "not yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-2')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - name: Update to the latest foo
+ yum:
+ name: foo
+ state: latest
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.1-1')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - name: Install foo-1.0-1 from a file (higher version is already installed)
+ yum:
+ name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
+ state: present
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "not yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.1-1')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+
+ - name: Remove foo
+ yum:
+ name: foo
+ state: absent
+ # ============================================================================
+ - name: Install foo-1.0-1 from a file
+ yum:
+ name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
+ state: present
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-1')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - name: Install foo-1.0-1 from a file again
+ yum:
+ name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
+ state: present
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "not yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-1')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - name: Install foo-1.0-2 from a file
+ yum:
+ name: "{{ repodir }}/foo-1.0-2.{{ ansible_architecture }}.rpm"
+ state: present
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-2')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - name: Install foo-1.0-2 from a file again
+ yum:
+ name: "{{ repodir }}/foo-1.0-2.{{ ansible_architecture }}.rpm"
+ state: present
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "not yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-2')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - name: Try to downgrade foo without allow_downgrade being set
+ yum:
+ name: foo-1.0-1
+ state: present
+ allow_downgrade: no
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "not yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-2')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - name: Downgrade foo
+ yum:
+ name: foo-1.0-1
+ state: present
+ allow_downgrade: yes
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-1')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - name: Update foo with update_only set
+ yum:
+ name: foo
+ state: latest
+ update_only: yes
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.1-1')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+
+ - name: Remove foo
+ yum:
+ name: foo
+ state: absent
+ # ============================================================================
+ - name: Try to update foo which is not installed, update_only is set
+ yum:
+ name: foo
+ state: latest
+ update_only: yes
+ register: yum_result
+ ignore_errors: yes
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+ ignore_errors: yes
+
+ - name: Verify installation
+ assert:
+ that:
+ - "rpm_result.rc == 1"
+ - "yum_result.rc == 0"
+ - "not yum_result.changed"
+ - "not yum_result is failed"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - name: Try to install incompatible arch
+ yum:
+ name: "{{ repodir_ppc64 }}/foo-1.0-1.ppc64.rpm"
+ state: present
+ register: yum_result
+ ignore_errors: yes
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+ ignore_errors: yes
+
+ - name: Verify installation
+ assert:
+ that:
+ - "rpm_result.rc == 1"
+ - "yum_result.rc == 1"
+ - "not yum_result.changed"
+ - "yum_result is failed"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - name: Make sure latest foo is installed
+ yum:
+ name: foo
+ state: latest
+
+ - name: Downgrade foo using rpm file
+ yum:
+ name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
+ state: present
+ allow_downgrade: yes
+ register: yum_result
+
+ - name: Check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: Verify installation
+ assert:
+ that:
+ - "yum_result.changed"
+ - "rpm_result.stdout.startswith('foo-1.0-1')"
+
+ - name: Verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ # ============================================================================
+ - block:
+ - name: make sure foo is not installed
+ yum:
+ name: foo
+ state: absent
+
+ - name: install foo both archs
+ yum:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - "{{ repodir }}/foo-1.1-1.x86_64.rpm"
+ - "{{ repodir_i686 }}/foo-1.1-1.i686.rpm"
+
+ - name: try to install lower version of foo from rpm file, without allow_downgrade, just one arch
+ yum:
+ name: "{{ repodir_i686 }}/foo-1.0-1.i686.rpm"
+ state: present
+ register: yum_result
+
+ - name: check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: verify installation
+ assert:
+ that:
+ - "not yum_result.changed"
+ - "rpm_result.stdout_lines[0].startswith('foo-1.1-1')"
+ - "rpm_result.stdout_lines[1].startswith('foo-1.1-1')"
+
+ - name: verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ when: ansible_architecture == "x86_64"
+ # ============================================================================
+ - block:
+ - name: make sure foo is not installed
+ yum:
+ name: foo
+ state: absent
+
+ - name: install foo both archs
+ yum:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - "{{ repodir }}/foo-1.0-1.x86_64.rpm"
+ - "{{ repodir_i686 }}/foo-1.0-1.i686.rpm"
+
+ - name: Update both arch in one task using rpm files
+ yum:
+ name: "{{ repodir }}/foo-1.1-1.x86_64.rpm,{{ repodir_i686 }}/foo-1.1-1.i686.rpm"
+ state: present
+ register: yum_result
+
+ - name: check foo with rpm
+ shell: rpm -q foo
+ register: rpm_result
+
+ - name: verify installation
+ assert:
+ that:
+ - "yum_result.changed"
+ - "rpm_result.stdout_lines[0].startswith('foo-1.1-1')"
+ - "rpm_result.stdout_lines[1].startswith('foo-1.1-1')"
+
+ - name: verify yum module outputs
+ assert:
+ that:
+ - "'msg' in yum_result"
+ - "'rc' in yum_result"
+ - "'results' in yum_result"
+ when: ansible_architecture == "x86_64"
+ # ============================================================================
+ always:
+ - name: Clean up
+ yum:
+ name: foo
+ state: absent