Newer
Older
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
---
- name: VERIFY | Test role for debugging variables
hosts: all
pre_tasks:
- name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../defaults
ansible.builtin.include_vars:
dir: ../../defaults
depth: 1
extensions:
- 'yml'
- name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../inventories/group_vars
ansible.builtin.include_vars:
dir: ../../../../inventories/group_vars
extensions:
- 'yml'
- name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../inventories/host_vars
ansible.builtin.include_vars:
dir: ../../../../inventories/host_vars
extensions:
- 'yml'
tasks:
###
### POPULATE
###
- name: MOLECULE | VERIFY | POPULATE | Gather the package facts
ansible.builtin.package_facts:
manager: auto
##
## TESTS - PACKAGES
##
- name: MOLECULE | VERIFY | TEST | Check that the packages from 'oh_my_bash_dependencies_list' are installed.
ansible.builtin.debug:
msg: "Package: '{{ package_name }}' is installed"
loop: "{{ oh_my_bash_dependencies_list }}"
loop_control:
loop_var: package_name
failed_when: package_name not in ansible_facts.packages
###
### TESTS - CHECK INSTALL
###
- name: MOLECULE | VERIFY | TEST | Oh-My-Bash installed.
ansible.builtin.stat:
path: "{{ oh_my_bash_installed_path }}"
register: check_installed
failed_when:
- not check_installed.stat.exists
- name: MOLECULE | VERIFY | TEST | Oh-My-Bash is enabled.
ansible.builtin.lineinfile:
path: "{{ ansible_env.HOME }}/.bashrc"
line: "export OSH='/root/.oh-my-bash'"
state: present
check_mode: true
register: check_enabled
failed_when: check_enabled.changed | bool
- name: MOLECULE | VERIFY | TEST | Theme is setted.
ansible.builtin.lineinfile:
path: "{{ ansible_env.HOME }}/.bashrc"
line: 'OSH_THEME="{{ oh_my_bash_theme_name }}"'
state: present
check_mode: true
register: check_theme_set
failed_when: check_theme_set.changed | bool
when:
- oh_my_bash_theme_name is defined
- not check_enabled.changed | bool