summaryrefslogtreecommitdiffstats
path: root/awx_collection/tests/integration/targets/settings/tasks/main.yml
blob: 5feb9ee800c8066747aecaf9f8b7227baa92d5e8 (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
---
- name: Initialize starting project vvv setting to false
  awx.awx.settings:
    name: "PROJECT_UPDATE_VVV"
    value: false

- name: Change project vvv setting to true
  awx.awx.settings:
    name: "PROJECT_UPDATE_VVV"
    value: true
  register: result

- name: Changing setting to true should have changed the value
  assert:
    that:
      - "result is changed"

- name: Change project vvv setting to true
  awx.awx.settings:
    name: "PROJECT_UPDATE_VVV"
    value: true
  register: result

- name: Changing setting to true again should not change the value
  assert:
    that:
      - "result is not changed"

- name: Change project vvv setting back to false
  awx.awx.settings:
    name: "PROJECT_UPDATE_VVV"
    value: false
  register: result

- name: Changing setting back to false should have changed the value
  assert:
    that:
      - "result is changed"

- name: Set the value of AWX_ISOLATION_SHOW_PATHS to a baseline
  settings:
    name: AWX_ISOLATION_SHOW_PATHS
    value: '["/var/lib/awx/projects/"]'

- name: Set the value of AWX_ISOLATION_SHOW_PATHS to get an error back from the controller
  settings:
    settings:
      AWX_ISOLATION_SHOW_PATHS:
        'not': 'a valid'
        'tower': 'setting'
  register: result
  ignore_errors: true

- assert:
    that:
      - "result is failed"

- name: Set the value of AWX_ISOLATION_SHOW_PATHS
  settings:
    name: AWX_ISOLATION_SHOW_PATHS
    value: '["/var/lib/awx/projects/", "/tmp"]'
  register: result

- assert:
    that:
      - "result is changed"

- name: Attempt to set the value of AWX_ISOLATION_BASE_PATH to what it already is
  settings:
    name: AWX_ISOLATION_BASE_PATH
    value: /tmp
  register: result

- debug:
    msg: "{{ result }}"

- assert:
    that:
      - "result is not changed"

- name: Apply a single setting via settings
  settings:
    name: AWX_ISOLATION_SHOW_PATHS
    value: '["/var/lib/awx/projects/", "/var/tmp"]'
  register: result

- assert:
    that:
      - "result is changed"

- name: Apply multiple setting via settings with no change
  settings:
    settings:
      AWX_ISOLATION_BASE_PATH: /tmp
      AWX_ISOLATION_SHOW_PATHS: ["/var/lib/awx/projects/", "/var/tmp"]
  register: result

- debug:
    msg: "{{ result }}"

- assert:
    that:
      - "result is not changed"

- name: Apply multiple setting via settings with change
  settings:
    settings:
      AWX_ISOLATION_BASE_PATH: /tmp
      AWX_ISOLATION_SHOW_PATHS: []
  register: result

- assert:
    that:
      - "result is changed"

- name: Handle an omit value
  settings:
    name: AWX_ISOLATION_BASE_PATH
    value: '{{ junk_var | default(omit) }}'
  register: result
  ignore_errors: true

- assert:
    that:
      - "'Unable to update settings' in result.msg"