Home > vagrant, vim > Using Ansible to install vim-airline

Using Ansible to install vim-airline

Problem: Automate the installation of vim-airline on a vagrant box.

Solution: Ansible.

- name: Configure VM with vim-airline and other plugins.
  hosts: testserver
  become: yes
  become_method: sudo
  become_user: vagrant

tasks:
        - name: "Run apt-get update"
          become_user: root
          apt: update_cache=yes

        - name: "Install git"
          become_user: root
          apt: name=git state=present

        - name: "Creates vim autoload directory"
          file: path=/home/vagrant/.vim/autoload state=directory

        - name: "Creates vim bundle directory"
          file: path=/home/vagrant/.vim/bundle state=directory

        - name: "Download pathogen"
          get_url: url=https://tpo.pe/pathogen.vim dest=/home/vagrant/.vim/autoload/pathogen.vim mode=0677

        - name: "Install vim-virtualenv"
          git: repo=https://github.com/jmcantrell/vim-virtualenv.git
               dest=/home/vagrant/.vim/bundle/vim-virtualenv

        - name: "Install vim-airline"
          git: repo=https://github.com/vim-airline/vim-airline
               dest=/home/vagrant/.vim/bundle/vim-airline

        - name: "Run helptags vim-airline"
          command: vim -u NONE --cmd "helptags /home/vagrant/.vim/bundle/vim-airline/doc" --cmd q

        - name: "Install vim-airline-themes"
          git: repo=https://github.com/vim-airline/vim-airline-themes
               dest=/home/vagrant/.vim/bundle/vim-airline-themes

        - name: "Install vim-fugitive"
          git: repo=https://github.com/tpope/vim-fugitive.git
               dest=/home/vagrant/.vim/bundle/vim-fugitive

        - name: "Run helptags vim-fugitive"
          command: vim -u NONE --cmd "helptags ~/.vim/bundle/vim-fugitive/doc" --cmd q

        - name: " Copy vimrc config"
          copy:
                src=/home/rodnee/files/vimrc
                dest=/home/vagrant/.vimrc
                group=vagrant

Advertisements
Categories: vagrant, vim
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: