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
---
# tasks file for oh-my-bash
### CHECK INSTALL
- name: INSTALL | Test Oh-My-Bash installation.
ansible.builtin.stat:
path: "{{ oh_my_bash_installed_path }}"
register: check_if_installed
- name: INSTALL | Check if Oh-My-Bash already installed.
ansible.builtin.debug:
msg: "{{ 'Oh-My-Bash already installed' if check_if_installed.stat.exists == True else 'Oh-My-Bash not installed, installing...' }}"
### DOWNLOAD
- name: INSTALL | Download installation script.
ansible.builtin.get_url:
url: "{{ oh_my_bash_download_url }}"
dest: "{{ oh_my_bash_download_dest }}"
mode: "0777"
register: install_script_downloaded
when:
- check_if_installed is defined
- not check_if_installed.stat.exists | bool
### INSTALL
- name: INSTALL | Runs the installation script.
ansible.builtin.command:
cmd: "{{ oh_my_bash_download_dest }} --unattended"
vars:
ansible_command_timeout: 15
register: install_result
when:
- install_script_downloaded.failed is defined
- not install_script_downloaded.failed | bool
changed_when: install_result.rc != 0
- name: INSTALL | Reset ssh connection to apply user changes.
ansible.builtin.meta: reset_connection