summaryrefslogtreecommitdiff
path: root/test/integration/targets/zypper_repository/tasks/zypper_repository.yml
blob: 888fafa08c707de9cf16fe2adce42d3ca182776a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
- name: Delete test repo
  zypper_repository:
    name: test
    state: absent
  register: zypper_result

- name: Add test repo
  zypper_repository:
    name: test
    state: present
    repo: http://dl.google.com/linux/chrome/rpm/stable/x86_64
  register: zypper_result

- name: verify repo addition
  assert:
    that:
      - "zypper_result.changed"

- name: Add same repo again
  zypper_repository:
    name: test
    state: present
    repo: http://dl.google.com/linux/chrome/rpm/stable/x86_64
  register: zypper_result

- name: verify no change on second install
  assert:
    that:
      - "not zypper_result.changed"

- name: Change repo URL
  zypper_repository:
    name: test
    state: present
    repo: http://download.videolan.org/pub/vlc/SuSE/Leap_{{ ansible_distribution_version }}/
  register: zypper_result

- name: Verify change on URL only change
  assert:
    that:
      - "zypper_result.changed"

- name: use refresh option
  zypper_repository:
    name: testrefresh
    refresh: no
    state: present
    repo: http://download.videolan.org/pub/vlc/SuSE/Leap_{{ ansible_distribution_version }}/

- name: check refreshoption
  command: zypper -x lr testrefresh
  register: zypper_result

- assert:
    that:
      - '"autorefresh=\"0\"" in zypper_result.stdout'

- name: set repo priority
  zypper_repository:
    name: testprio
    priority: 55
    state: present
    repo: http://download.videolan.org/pub/vlc/SuSE/Leap_{{ ansible_distribution_version }}/

- name: check refreshoption
  command: zypper -x lr testprio
  register: zypper_result

- assert:
    that:
      - '"priority=\"55\"" in zypper_result.stdout'

- name: add two repos with same url
  zypper_repository:
    name: "{{item}}"
    state: present
    repo: http://dl.google.com/linux/chrome/rpm/stable/x86_64
  with_items:
    - chrome1
    - chrome2

- name: check repo is updated by url
  command: zypper lr chrome1
  register: zypper_result1
  ignore_errors: yes

- name: check repo is updated by url
  command: zypper lr chrome2
  register: zypper_result2

- assert:
    that:
      - "zypper_result1.rc != 0"
      - "'not found' in zypper_result1.stderr"
      - "zypper_result2.rc == 0"
      - "'http://dl.google.com/linux/chrome/rpm/stable/x86_64' in zypper_result2.stdout"

- name: add two repos with same name
  zypper_repository:
    name: samename
    state: present
    repo: "{{ item }}"
  with_items:
    - http://download.opensuse.org/repositories/science/openSUSE_Leap_{{ ansible_distribution_version }}/
    - http://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_{{ ansible_distribution_version }}/

- name: check repo is updated by name
  command: zypper lr samename
  register: zypper_result

- assert:
    that:
      - "'/science/' not in zypper_result.stdout"
      - "'/devel:/languages:/ruby/' in zypper_result.stdout"

- name: remove last added repos (by URL to test that)
  zypper_repository:
    repo: http://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_{{ ansible_distribution_version }}/
    state: absent

- name: "Test adding a repo with custom GPG key"
  zypper_repository:
    name: "Apache_Modules"
    repo: "http://download.opensuse.org/repositories/Apache:/Modules/openSUSE_Leap_{{ ansible_distribution_version }}/"
    priority: 100
    auto_import_keys: true
    state: "present"