#!/usr/bin/env ansible-playbook
---

# Install Vim.
- name: install vim on mac system
  become: yes
  homebrew:
    name: vim
    state: present
  retries: 3
  delay: 10

- name: use vi-mode in bash
  become: yes
  lineinfile:
    dest: /etc/bashrc
    line: 'set -o vi'

- name: setting $EDITOR
  become: yes
  lineinfile:
    dest: /etc/bashrc
    line: 'export EDITOR=vim'

- name: check if 'vimrc' target exists
  stat:
    path: /usr/local/share/vim/vimrc
  register: file_check_vimrc

- name: touch file - vimrc
  become: yes
  file:
    path: /usr/local/share/vim/vimrc
    state: touch
    mode: 'u=rw,g=r,o=r'
  when: file_check_vimrc.stat.exists == false

- name: use dark background in vim
  become: yes
  lineinfile:
    dest: /usr/local/share/vim/vimrc
    line: 'set background=dark'

- name: check if 'inputrc' target exists
  stat:
    path: /etc/inputrc
  register: file_check_inputrc

- name: touch file - inputrc
  become: yes
  file:
    path: /etc/inputrc
    state: touch
    mode: 'u=rw,g=r,o=r'
  when: file_check_inputrc.stat.exists == false

# vim: ft=yaml.ansible :

#!/usr/bin/env ansible-playbook
---

# Install Vim.
- name: install vim on mac system
  become: yes
  homebrew:
    name: vim
    state: present
  retries: 3
  delay: 10

- name: use vi-mode in bash
  become: yes
  lineinfile:
    dest: /etc/bashrc
    line: 'set -o vi'

- name: setting $EDITOR
  become: yes
  lineinfile:
    dest: /etc/bashrc
    line: 'export EDITOR=vim'

- name: check if 'vimrc' target exists
  stat:
    path: /usr/local/share/vim/vimrc
  register: file_check_vimrc

- name: touch file - vimrc
  become: yes
  file:
    path: /usr/local/share/vim/vimrc
    state: touch
    mode: 'u=rw,g=r,o=r'
  when: not file_check_vimrc.stat.exists

- name: use dark background in vim
  become: yes
  lineinfile:
    dest: /usr/local/share/vim/vimrc
    line: 'set background=dark'

- name: check if 'inputrc' target exists
  stat:
    path: /etc/inputrc
  register: file_check_inputrc

- name: touch file - inputrc
  become: yes
  file:
    path: /etc/inputrc
    state: touch
    mode: 'u=rw,g=r,o=r'
  when: not file_check_inputrc.stat.exists

# vim: ft=yaml.ansible :

Refactor with "not var" way.
[601] Refactor with "not var" way.

Improve with ansible-lint.

> https://docs.ansible.com/ansible-lint/rules/default_rules.html
