Giter Site home page Giter Site logo

ansible-zsh-fzf's Introduction

Environment

+ Ubuntu 16.04
+ Ansible 2.5.2
+ Ansible Galaxy 2.5.2
+ Vagrant 2.1.1
+ Virtualbox 5.2.1.12

Setup Step by Step

I. Install python, pip and ansible
  1. Install python
sudo apt-get install -y python2.7 python-pip
  1. Install Ansible
pip install ansible
II. Update global variables
  1. Add file vars/main.yml
---
remove_oh_my_zsh_if_existed: false
default_shell: zsh
debug_mode: true
main_user: vagrant
main_dir: "/home/{{main_user}}"
  1. Add config to playbook.yml
vars_files:
  - vars/main.yml
III. Add pre-tasks to preparing base package to install another packages
  1. Preparing structure by ansible galaxy for pre-tasks
mkdir roles
ansible-galaxy init roles/pre_tasks
  1. Add code below to roles/pre-tasks/tasks/main.yml
---
- include: update_system.yml
- include: packages.yml
  1. Add code below to roles/pre-tasks/tasks/update_system.yml
---
- name: apt-get update
  raw: apt-get update -qq
- name: install python 2.7 and aptitude
  raw: apt-get install -qq python2.7 aptitude
- name: set python 2.7 as default
  raw: update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
  1. Add code below to roles/pre-tasks/tasks/packages.yml
---
- name: Install packages
  package:
    name: '{{item}}'
    state: present
  with_items: ['git-core', 'htop', 'curl']
  1. Add roles pre-tasks to playbook.yml
roles:
  - pre-tasks
III. Install and config ZSH
  1. Preparing structure by ansible galaxy for zsh
ansible-galaxy init roles/zsh
  1. Add code below to roles/zsh/tasks/main.yml
---
- name: Install ZSH
  package:
    name: zsh
    state: present
  1. Add roles zsh to playbook.yml
roles:
  - pre-tasks
  - zsh
IV. Install Oh-my-ZSH
  1. Preparing structure by ansible galaxy for Oh My ZSH
ansible-galaxy init roles/oh_my_zsh
  1. Add code below to roles/oh_my_zsh/tasks/main.yml
---
- name: Load install script from server
  get_url:
    url: https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
    dest: "{{main_dir}}/oh-my-zsh.sh"
    mode: 0777

- name: Run script as {{main_user}}
  become: true
  become_user: "{{main_user}}"
  command: "sh -C {{main_dir}}/oh-my-zsh.sh"

- name: Change user ({{main_user}}) shell to {{default_shell}}
  become: true
  user:
    name: main_user
    shell: /bin/{{default_shell}}
  1. Add roles oh_my_zsh to playbook.yml
roles:
  - pre-tasks
  - zsh
  - oh_my_zsh

ansible-zsh-fzf's People

Contributors

dhhiep avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.