Add tags for components and Makefile targets

This commit is contained in:
2020-03-03 17:31:48 +01:00
parent 458a41084e
commit 33244c9726
3 changed files with 254 additions and 263 deletions

View File

@@ -3,10 +3,23 @@ requirements = requirements.txt
activate = . $(venv)/bin/activate activate = . $(venv)/bin/activate
pip = pip pip = pip
ansible = venv/bin/ansible-playbook ansible = venv/bin/ansible-playbook
ansible_run = $(activate) && ansible-playbook --inventory localhost, --diff --verbose ./playbook.yml
.PHONY: all .PHONY: all
install: $(ansible) install: $(ansible)
$(activate) && ansible-playbook --inventory localhost, --diff --verbose ./playbook.yml $(ansible_run)
.PHONY: update
update: $(ansible)
$(ansible_run) --tags update_system
.PHONY: packages
packages: $(ansible)
$(ansible_run) --tags packages
.PHONY: dotfiles
dotfiles: $(ansible)
$(ansible_run) --tags dotfiles
.PHONY: clean .PHONY: clean
clean: clean:

View File

@@ -58,6 +58,7 @@
become: true become: true
when: distro == 'fedora' when: distro == 'fedora'
- block:
- name: load package list - name: load package list
include_vars: include_vars:
file: packages.yml file: packages.yml
@@ -86,6 +87,7 @@
become: true become: true
vars: vars:
query: "{{ 'list.*.%s[]'|format(distro) }}" query: "{{ 'list.*.%s[]'|format(distro) }}"
tags: [packages]
- set_fact: - set_fact:
disable_services: disable_services:
@@ -184,3 +186,5 @@
with_items: "{{ users }}" with_items: "{{ users }}"
loop_control: loop_control:
loop_var: user loop_var: user
tags:
- always

View File

@@ -25,6 +25,7 @@
- docker - docker
- libvirt - libvirt
when: distro == 'ubuntu' when: distro == 'ubuntu'
tags: [always]
- set_fact: - set_fact:
user_groups: user_groups:
@@ -34,9 +35,11 @@
- wireshark - wireshark
- docker - docker
when: distro == 'fedora' when: distro == 'fedora'
tags: [always]
- set_fact: - set_fact:
user_group_name: "{{ user.group|default(user.name) }}" user_group_name: "{{ user.group|default(user.name) }}"
tags: [always]
- name: create user group - name: create user group
group: group:
@@ -75,19 +78,16 @@
become: true become: true
become_user: root become_user: root
- block:
- name: load dotfile list - name: load dotfile list
include_vars: include_vars:
file: dotfiles.yml file: dotfiles.yml
tags:
- dotfiles
- name: get state of empty directories - name: get state of empty directories
stat: stat:
path: ~/{{ item.name }} path: ~/{{ item.name }}
register: empty_dir_stat register: empty_dir_stat
with_items: "{{ empty_directories }}" with_items: "{{ empty_directories }}"
tags:
- dotfiles
- name: remove sysmlinks - name: remove sysmlinks
file: file:
@@ -95,8 +95,6 @@
state: absent state: absent
when: item.stat.exists and item.stat.islnk when: item.stat.exists and item.stat.islnk
with_items: "{{ empty_dir_stat.results }}" with_items: "{{ empty_dir_stat.results }}"
tags:
- dotfiles
- name: create empty directories for dotfiles - name: create empty directories for dotfiles
file: file:
@@ -104,8 +102,6 @@
path: ~/{{ item.name }} path: ~/{{ item.name }}
mode: "{{ item.mode | default('0755') }}" mode: "{{ item.mode | default('0755') }}"
with_items: "{{ empty_directories }}" with_items: "{{ empty_directories }}"
tags:
- dotfiles
- name: link this folder to ~/.dotfiles - name: link this folder to ~/.dotfiles
file: file:
@@ -116,8 +112,6 @@
group: "{{ user_group_name }}" group: "{{ user_group_name }}"
path: "/home/{{ user.name }}/.dotfiles" path: "/home/{{ user.name }}/.dotfiles"
src: "{{ playbook_dir }}" src: "{{ playbook_dir }}"
tags:
- dotfiles
become: true become: true
become_user: root become_user: root
@@ -127,8 +121,6 @@
register: copy_stat register: copy_stat
when: not item.template|default(false) when: not item.template|default(false)
with_items: "{{ dotfiles }}" with_items: "{{ dotfiles }}"
tags:
- dotfiles
- name: remove invalid copy target (directories) - name: remove invalid copy target (directories)
file: file:
@@ -139,8 +131,6 @@
- item.stat.exists - item.stat.exists
- item.stat.isdir - item.stat.isdir
with_items: "{{ copy_stat.results }}" with_items: "{{ copy_stat.results }}"
tags:
- dotfiles
- name: link dotfiles - name: link dotfiles
file: file:
@@ -156,8 +146,6 @@
with_items: "{{ dotfiles }}" with_items: "{{ dotfiles }}"
become: true become: true
become_user: root become_user: root
tags:
- dotfiles
- name: get state of template targets - name: get state of template targets
stat: stat:
@@ -165,8 +153,6 @@
register: template_stat register: template_stat
when: item.template|default(false) when: item.template|default(false)
with_items: "{{ dotfiles }}" with_items: "{{ dotfiles }}"
tags:
- dotfiles
- name: remove invalid template target (directory or symlink) - name: remove invalid template target (directory or symlink)
file: file:
@@ -177,8 +163,6 @@
- item.stat.exists - item.stat.exists
- not item.stat.isreg - not item.stat.isreg
with_items: "{{ template_stat.results }}" with_items: "{{ template_stat.results }}"
tags:
- dotfiles
- name: deploy dotfiles templates - name: deploy dotfiles templates
template: template:
@@ -191,8 +175,6 @@
become_user: root become_user: root
when: item.template|default(false) when: item.template|default(false)
with_items: "{{ dotfiles }}" with_items: "{{ dotfiles }}"
tags:
- dotfiles
- name: create directories - name: create directories
file: file:
@@ -208,7 +190,6 @@
stat: stat:
path: "/home/{{ user.name }}/bin" path: "/home/{{ user.name }}/bin"
register: bin_stat register: bin_stat
tags: [bin]
- name: remove ~/bin if not a link - name: remove ~/bin if not a link
file: file:
@@ -217,7 +198,6 @@
when: when:
- bin_stat.stat.exists - bin_stat.stat.exists
- not bin_stat.stat.islnk - not bin_stat.stat.islnk
tags: [bin]
- name: create ~/.opt and ~/.optbin - name: create ~/.opt and ~/.optbin
file: file:
@@ -226,7 +206,6 @@
with_items: with_items:
- ~/.opt/ - ~/.opt/
- ~/.optbin/ - ~/.optbin/
tags: [bin]
- name: symlink opt programs - name: symlink opt programs
file: file:
@@ -246,7 +225,6 @@
optpath: hugo optpath: hugo
- name: drone - name: drone
optpath: drone optpath: drone
tags: [bin]
- name: link bin directory - name: link bin directory
file: file:
@@ -258,6 +236,8 @@
owner: "{{ user.name }}" owner: "{{ user.name }}"
group: "{{ user_group_name }}" group: "{{ user_group_name }}"
mode: "{{ item.mode | default('0644') }}" mode: "{{ item.mode | default('0644') }}"
tags:
- dotfiles
- name: create intermediate directories for vim-plug - name: create intermediate directories for vim-plug
file: file:
@@ -272,12 +252,11 @@
- ~/.vim/ - ~/.vim/
- ~/.vim/autoload - ~/.vim/autoload
- block:
- name: install vim-plug - name: install vim-plug
get_url: get_url:
dest: ~/.vim/autoload/plug.vim dest: ~/.vim/autoload/plug.vim
url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
tags:
- vim
- name: symlink vim-plug for neovim - name: symlink vim-plug for neovim
file: file:
@@ -285,15 +264,11 @@
path: ~/.local/share/nvim/site/autoload/plug.vim path: ~/.local/share/nvim/site/autoload/plug.vim
src: ~/.vim/autoload/plug.vim src: ~/.vim/autoload/plug.vim
force: true force: true
tags:
- vim
- name: install vim plugins - name: install vim plugins
command: /usr/bin/nvim -f -E -s -c "source ~/.vimrc" +PlugInstall +qall command: /usr/bin/nvim -f -E -s -c "source ~/.vimrc" +PlugInstall +qall
register: vim_plugins_stdout register: vim_plugins_stdout
changed_when: vim_plugins_stdout.stdout_lines|length != 0 changed_when: vim_plugins_stdout.stdout_lines|length != 0
tags:
- vim
- name: compile youcompleteme - name: compile youcompleteme
shell: | shell: |
@@ -302,9 +277,8 @@
args: args:
creates: ~/.local/share/nvim/plugged/YouCompleteMe/third_party/ycmd/ycm_core.so creates: ~/.local/share/nvim/plugged/YouCompleteMe/third_party/ycmd/ycm_core.so
when: vim_plugins_stdout.stdout_lines|length != 0 or true when: vim_plugins_stdout.stdout_lines|length != 0 or true
tags:
- vim
- block:
- name: firefox - create chrome directory - name: firefox - create chrome directory
file: file:
path: ~/.mozilla/firefox/{{ item.name }}/chrome/ path: ~/.mozilla/firefox/{{ item.name }}/chrome/