1
0
mirror of https://github.com/eoli3n/dotfiles synced 2024-11-15 13:33:56 +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 ### Role list
- package-common - packages-common
- screen - screen
- ssh-agent - ssh-agent
- authorized_keys - authorized_keys
- terminfo - terminfo
- vim - vim
- zsh - zsh
- package-desktop - packages-desktop
- compton - compton
- cursor - cursor
- gtk - gtk
@ -114,7 +114,7 @@ To use dark theme, go to graphical configuration and click ``Use GTK+ Theme``
### Role list ### Role list
- package-common - packages-common
- screen - screen
- terminfo - terminfo
- vim - vim

3
TODO

@ -6,6 +6,8 @@
- powerline: check best install method all distrib - powerline: check best install method all distrib
- zsh: check neon specific alias and others - zsh: check neon specific alias and others
- playbook: update all vagrant specific task to match docker hosts - 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 # TOFIX
@ -13,6 +15,7 @@
- powerline: not working with centos|debian|freebsd - powerline: not working with centos|debian|freebsd
- playbook: add {{ tag }} to fail module to print in "limit to distrib" task - playbook: add {{ tag }} to fail module to print in "limit to distrib" task
- vagrant: tty in qwerty for debian keyboard - vagrant: tty in qwerty for debian keyboard
- playbook: {{playbook_dir}} -> {{role_path}}
# TOTEST # 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 - wget
become: True become: True
- name: Include CentOS packages [if CentOS] - name: Test host packages file
include_tasks: centos.yml stat: path="{{ role_path }}/tasks/by_host/{{ ansible_hostname }}/main.yml"
when: ansible_distribution == "CentOS" register: host_file
- name: Include Archlinux packages [if Archlinux] - name: Include host packages
include_tasks: archlinux.yml include_tasks: "{{ role_path }}/tasks/by_host/{{ ansible_hostname }}/main.yml"
when: ansible_os_family == "Archlinux" 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 # Specific hosts packages
Add a tasks file named with hostname of target 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 - name: Install $(hostname) packages
pacman: name={{item}} state=present pacman: name={{item}} state=present
@ -10,4 +24,3 @@ echo <<\EOF > tasks/$(hostname).yml
become: True become: True
EOF EOF
``` ```

@ -15,14 +15,18 @@
- ttf-hack - ttf-hack
become: True become: True
- name: Include Archlinux tasks [if Archlinux] - name: Test host packages file
include_tasks: archlinux.yml stat: path="{{ role_path }}/tasks/by_host/{{ ansible_hostname }}/main.yml"
when: ansible_os_family == "Archlinux" register: host_file
- name: Test if hostname specific tasks exists - name: Include distribution packages
stat: path={{ playbook_dir }}roles/packages-desktop/tasks/{{ ansible_hostname }}.yml include_tasks: "{{ role_path }}/tasks/by_host/{{ ansible_hostname }}/main.yml"
register: hostname_packages_file when: host_file.stat.exists
- name: Include node tasks [if exists] - name: Test distribution packages file
include_tasks: "{{ playbook_dir }}roles/packages-desktop/tasks/{{ ansible_hostname }}.yml" stat: path="{{ role_path }}/tasks/by_os/{{ ansible_distribution|lower }}/main.yml"
when: hostname_packages_file.stat.exists 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 copy: src=files/pkg.sh dest=~/.config/polybar/pkg.sh mode=0755
- name: Test if node specific template exists for launch.sh - 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 register: launch_file
- name: Test if node specific template exists for modules top - 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 register: polybar_top_file
- name: Test if node specific template exists for modules bottom - 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 register: polybar_bottom_file
- name: Template launch 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] - name: Test distribution packages file
# See: https://unix.stackexchange.com/questions/291412/how-can-i-use-terminfo-entries-on-freebsd stat: path="{{ role_path }}/tasks/by_os/{{ ansible_distribution|lower }}/main.yml"
shell: creates=~/.termcap {{item}} register: distribution_file
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: Install termite terminfo [Archlinux] - name: Include distribution packages
pacman: name=termite-terminfo state=present include_tasks: "{{ role_path }}/tasks/by_os/{{ ansible_distribution|lower }}/main.yml"
become: True when: distribution_file.stat.exists
when: ansible_os_family == "Archlinux"
- name: Install termite terminfo [Common] - name: Include common packages
shell: creates={{ item.creates }} {{ item.cmd }} include_tasks: "{{ role_path }}/tasks/by_os/common/main.yml"
with_items: when: not distribution_file.stat.exists
- { 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"