1
0
mirror of https://github.com/eoli3n/dotfiles synced 2024-11-22 23:12:32 +01:00

include by_os

This commit is contained in:
eoli3n 2017-12-29 12:38:06 +01:00
parent 7265b5d5fd
commit b37764747f
16 changed files with 108 additions and 45 deletions

@ -57,14 +57,14 @@ curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=packer-
### Role list
- package-common
- packages-common
- screen
- ssh-agent
- authorized_keys
- terminfo
- vim
- zsh
- package-desktop
- packages-desktop
- compton
- cursor
- gtk
@ -114,7 +114,7 @@ To use dark theme, go to graphical configuration and click ``Use GTK+ Theme``
### Role list
- package-common
- packages-common
- screen
- terminfo
- vim

3
TODO

@ -6,6 +6,8 @@
- powerline: check best install method all distrib
- zsh: check neon specific alias and others
- playbook: update all vagrant specific task to match docker hosts
- playbook: test if tag limit exists
- playbook: for vim and zsh-syntax, change [distribution] tasks to test|include_tasks in by_os
# TOFIX
@ -13,6 +15,7 @@
- powerline: not working with centos|debian|freebsd
- playbook: add {{ tag }} to fail module to print in "limit to distrib" task
- vagrant: tty in qwerty for debian keyboard
- playbook: {{playbook_dir}} -> {{role_path}}
# TOTEST

@ -0,0 +1,26 @@
# Specific OS packages
Add a tasks file named with hostname of target
```
echo <<\EOF > tasks/by_os/<archlinux|debian|centos|freebsd>/main.yml
---
- name: Install <archlinux|debian|centos|freebsd> packages
pacman: name={{item}} state=present
with_items:
- vim
become: True
EOF
```
# Specific hosts packages
Add a tasks file named with hostname of target
```
mkdir tasks/by_host/$(hostname)
echo <<\EOF > tasks/by_host/$(hostname)/main.yml
---
- name: Install $(hostname) packages
pacman: name={{item}} state=present
with_items:
- vim
become: True
EOF
```

@ -6,10 +6,18 @@
- wget
become: True
- name: Include CentOS packages [if CentOS]
include_tasks: centos.yml
when: ansible_distribution == "CentOS"
- name: Test host packages file
stat: path="{{ role_path }}/tasks/by_host/{{ ansible_hostname }}/main.yml"
register: host_file
- name: Include Archlinux packages [if Archlinux]
include_tasks: archlinux.yml
when: ansible_os_family == "Archlinux"
- name: Include host packages
include_tasks: "{{ role_path }}/tasks/by_host/{{ ansible_hostname }}/main.yml"
when: host_file.stat.exists
- name: Test distribution packages file
stat: path="{{ role_path }}/tasks/by_os/{{ ansible_distribution|lower }}/main.yml"
register: distribution_file
- name: Include distribution packages
include_tasks: "{{ role_path }}/tasks/by_os/{{ ansible_distribution|lower }}/main.yml"
when: distribution_file.stat.exists

@ -1,7 +1,21 @@
# Specific OS packages
Add a tasks file named with hostname of target
```
echo <<\EOF > tasks/by_os/<archlinux|debian|centos|freebsd>/main.yml
---
- name: Install <archlinux|debian|centos|freebsd> packages
pacman: name={{item}} state=present
with_items:
- vim
become: True
EOF
```
# Specific hosts packages
Add a tasks file named with hostname of target
```
echo <<\EOF > tasks/$(hostname).yml
mkdir tasks/by_host/$(hostname)
echo <<\EOF > tasks/by_host/$(hostname)/main.yml
---
- name: Install $(hostname) packages
pacman: name={{item}} state=present
@ -10,4 +24,3 @@ echo <<\EOF > tasks/$(hostname).yml
become: True
EOF
```

@ -15,14 +15,18 @@
- ttf-hack
become: True
- name: Include Archlinux tasks [if Archlinux]
include_tasks: archlinux.yml
when: ansible_os_family == "Archlinux"
- name: Test host packages file
stat: path="{{ role_path }}/tasks/by_host/{{ ansible_hostname }}/main.yml"
register: host_file
- name: Test if hostname specific tasks exists
stat: path={{ playbook_dir }}roles/packages-desktop/tasks/{{ ansible_hostname }}.yml
register: hostname_packages_file
- name: Include distribution packages
include_tasks: "{{ role_path }}/tasks/by_host/{{ ansible_hostname }}/main.yml"
when: host_file.stat.exists
- name: Include node tasks [if exists]
include_tasks: "{{ playbook_dir }}roles/packages-desktop/tasks/{{ ansible_hostname }}.yml"
when: hostname_packages_file.stat.exists
- name: Test distribution packages file
stat: path="{{ role_path }}/tasks/by_os/{{ ansible_distribution|lower }}/main.yml"
register: distribution_file
- name: Include distribution packages
include_tasks: "{{ role_path }}/tasks/by_os/{{ ansible_distribution|lower }}/main.yml"
when: distribution_file.stat.exists

@ -18,15 +18,15 @@
copy: src=files/pkg.sh dest=~/.config/polybar/pkg.sh mode=0755
- name: Test if node specific template exists for launch.sh
stat: path="{{ playbook_dir }}/roles/polybar/templates/by_host/{{ ansible_hostname }}/launch.j2"
stat: path="{{ role_path }}/templates/by_host/{{ ansible_hostname }}/launch.j2"
register: launch_file
- name: Test if node specific template exists for modules top
stat: path="{{ playbook_dir }}/roles/polybar/templates/by_host/{{ ansible_hostname }}/modules-top.j2"
stat: path="{{ role_path }}/templates/by_host/{{ ansible_hostname }}/modules-top.j2"
register: polybar_top_file
- name: Test if node specific template exists for modules bottom
stat: path="{{ playbook_dir }}/roles/polybar/templates/by_host/{{ ansible_hostname }}/modules-bottom.j2"
stat: path="{{ role_path }}/templates/by_host/{{ ansible_hostname }}/modules-bottom.j2"
register: polybar_bottom_file
- name: Template launch file

@ -0,0 +1,4 @@
---
- name: Install termite terminfo [Archlinux]
pacman: name=termite-terminfo state=present
become: True

@ -0,0 +1,8 @@
---
- name: Install termite terminfo [Common]
shell: creates={{ item.creates }} {{ item.cmd }}
with_items:
- { creates: '/root/termite.terminfo', cmd: 'wget "https://raw.githubusercontent.com/thestinger/termite/master/termite.terminfo" -O /root/termite.terminfo' }
- { creates: '/root/.termite.terminfo', cmd: 'tic -x /root/termite.terminfo' }
- { creates: '/root/.termite.terminfo', cmd: 'touch /root/.termite.terminfo' }
become: True

@ -0,0 +1,10 @@
---
- name: Install termite termcap [FreeBSD]
# See: https://unix.stackexchange.com/questions/291412/how-can-i-use-terminfo-entries-on-freebsd
shell: creates=~/.termcap {{item}}
with_items:
- 'chmod 755 /usr/share/misc/termcap'
- 'cat {{ role_path }}/files/termite.termcap >> /usr/share/misc/termcap'
- 'cap_mkdb /usr/share/misc/termcap'
- 'touch ~/.termcap'
become: True

@ -1,25 +1,12 @@
---
- name: Install termite termcap [FreeBSD]
# See: https://unix.stackexchange.com/questions/291412/how-can-i-use-terminfo-entries-on-freebsd
shell: creates=~/.termcap {{item}}
with_items:
- 'chmod 755 /usr/share/misc/termcap'
- 'cat {{ playbook_dir }}/roles/terminfo/files/termite.termcap >> /usr/share/misc/termcap'
- 'cap_mkdb /usr/share/misc/termcap'
- 'touch ~/.termcap'
become: True
when: ansible_os_family == "FreeBSD"
- name: Test distribution packages file
stat: path="{{ role_path }}/tasks/by_os/{{ ansible_distribution|lower }}/main.yml"
register: distribution_file
- name: Install termite terminfo [Archlinux]
pacman: name=termite-terminfo state=present
become: True
when: ansible_os_family == "Archlinux"
- name: Include distribution packages
include_tasks: "{{ role_path }}/tasks/by_os/{{ ansible_distribution|lower }}/main.yml"
when: distribution_file.stat.exists
- name: Install termite terminfo [Common]
shell: creates={{ item.creates }} {{ item.cmd }}
with_items:
- { creates: '/root/termite.terminfo', cmd: 'wget "https://raw.githubusercontent.com/thestinger/termite/master/termite.terminfo" -O /root/termite.terminfo' }
- { creates: '/root/.termite.terminfo', cmd: 'tic -x /root/termite.terminfo' }
- { creates: '/root/.termite.terminfo', cmd: 'touch /root/.termite.terminfo' }
become: True
when: ansible_os_family != "Archlinux" and ansible_os_family != "FreeBSD"
- name: Include common packages
include_tasks: "{{ role_path }}/tasks/by_os/common/main.yml"
when: not distribution_file.stat.exists