Skip to content
Snippets Groups Projects
install_oh_my_bash.yml 1.17 KiB
Newer Older
fejao's avatar
fejao committed
---
# 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