Compare commits

...

3 Commits

40 changed files with 134 additions and 725 deletions

View File

@ -4,18 +4,27 @@
become: true
vars_files:
- vars/users.yml
vars:
users:
- "{{ me }}"
- "{{ admin }}"
- vars/combava.yml
pre_tasks:
- name: update pacman cache
community.general.pacman:
update_cache: yes
roles:
- arch_aur
- core
- workstation
- users
- dotfiles
#- gnome
tasks:
- name: Set up aur env
include_role: arch_aur
- name: Install core packages
include_role: core
- name: Set up workstation
include_role: workstation
- name: Include user
include_role:
name: "user"
loop:
- "{{ me }}"
- "{{ admin }}"
loop_control:
loop_var: user

View File

@ -1,33 +0,0 @@
---
# Based on ansible-lint config
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable

View File

@ -1,4 +0,0 @@
---
username: 'user1'
config2stow: ["nvim", "tmux", "zsh"]

View File

@ -1,33 +0,0 @@
---
# Based on ansible-lint config
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable

View File

@ -1,23 +0,0 @@
*********************************
Vagrant driver installation guide
*********************************
Requirements
============
* Vagrant
* Virtualbox, Parallels, VMware Fusion, VMware Workstation or VMware Desktop
Install
=======
Please refer to the `Virtual environment`_ documentation for installation best
practices. If not using a virtual environment, please consider passing the
widely recommended `'--user' flag`_ when invoking ``pip``.
.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
.. code-block:: bash
$ pip install 'molecule_vagrant'

View File

@ -1,43 +0,0 @@
---
- name: Converge
hosts: all
vars:
users:
- username: user1
config2stow: ["nvim", "tmux", "zsh"]
password: "$y$j9T$PR8GfM2MjGudOCd7hF9NP1$/qRGtuNuWaRVVGmB1A4rgtaT0MMB9IoB4fnaxW1kvf4" #plop
- username: user2
password: "$y$j9T$PR8GfM2MjGudOCd7hF9NP1$/qRGtuNuWaRVVGmB1A4rgtaT0MMB9IoB4fnaxW1kvf4" #plop
config2stow: ["nvim", "tmux"]
pre_tasks:
- name: update_cache for arch
pacman:
update_cache: yes
become: yes
when: ansible_os_family == "Archlinux"
- name: update_cache for debian
apt:
update_cache: yes
become: yes
when: ansible_os_family == "Debian"
- name: Create user
ansible.builtin.user:
name: "{{ item.username }}"
password: "{{ item.password }}" #plop
state: present
with_items: "{{ users }}"
become: yes
tasks:
- name: "Include dotfiles"
include_role:
name: "dotfiles"
vars:
username: "{{ user.username }}"
config2stow: "{{ user.config2stow }}"
loop: "{{ users }}"
loop_control:
loop_var: user

View File

@ -1,16 +0,0 @@
---
dependency:
name: galaxy
driver:
name: vagrant
platforms:
- name: archlinux
box: "archlinux/archlinux"
- name: Debian
box: "debian/bullseye64"
provisioner:
name: ansible
verifier:
name: testinfra
options:
sudo: true

View File

@ -1,22 +0,0 @@
"""PyTest Fixtures."""
from __future__ import absolute_import
import os
import pytest
def pytest_runtest_setup(item):
"""Run tests only when under molecule with testinfra installed."""
try:
import testinfra
except ImportError:
pytest.skip("Test requires testinfra", allow_module_level=True)
if "MOLECULE_INVENTORY_FILE" in os.environ:
pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("all")
else:
pytest.skip(
"Test should run only from inside molecule.", allow_module_level=True
)

View File

@ -1,39 +0,0 @@
"""Role testing files using testinfra."""
USER1 = "user1"
USER2 = "user2"
def test_stow_installed(host):
stow = host.package("stow")
assert stow.is_installed
def test_dotfile_cloned(host):
dotfiles = host.file(f"/home/{USER1}/.dotfiles")
assert dotfiles.exists
assert dotfiles.user == USER1
dotfiles = host.file(f"/home/{USER2}/.dotfiles")
assert dotfiles.exists
assert dotfiles.user == USER2
def test_dotfile_stowed(host):
homepath = f"/home/{USER1}"
nvim = host.file(homepath + "/.config/nvim/")
assert nvim.exists
tmux = host.file(homepath + "/.tmux/")
assert tmux.exists
zshenv = host.file(homepath + "/.zshenv")
assert zshenv.exists
zsh = host.file(homepath + "/.config/zsh/")
assert zsh.exists
homepath = f"/home/{USER2}"
nvim = host.file(homepath + "/.config/nvim/")
assert nvim.exists
tmux = host.file(homepath + "/.tmux/")
assert tmux.exists
zshenv = host.file(homepath + "/.zshenv")
assert not zshenv.exists
zsh = host.file(homepath + "/.config/zsh/")
assert not zsh.exists

View File

@ -1,12 +0,0 @@
---
- name: Install stow
community.general.pacman:
name: stow
state: present
become: true
- name: Install git
community.general.pacman:
name: git
state: present
become: true

View File

@ -1,14 +0,0 @@
---
- name: Install stow
apt:
name: stow
state: present
update_cache: yes
become: true
- name: Install git
apt:
name: git
state: present
update_cache: yes
become: true

View File

@ -1,42 +0,0 @@
---
- name: <super + q> to close window
dconf:
key: "/org/gnome/desktop/wm/keybindings/close"
value: "['<Super>q']"
state: present
- name: <super + enter> to fire a terminal - binding
dconf:
key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/binding"
value: "'<Super>Return'"
state: present
- name: <super + enter> to fire a terminal - command
dconf:
key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/command"
value: "'urxvt'"
state: present
- name: <super + enter> to fire a terminal - name
dconf:
key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/name"
value: "'Terminal'"
state: present
- name: Shell theme
dconf:
key: "/org/gnome/shell/extensions/user-theme/name"
value: "'Materia-dark-compact'"
state: present
- name: Gtk theme
dconf:
key: "/org/gnome/desktop/interface/gkt-theme"
value: "'Materia-dark-compact'"
state: present
- name: Icon theme
dconf:
key: "/org/gnome/desktop/interface/icon-theme"
value: "'Tela-orange-dark'"
state: present

View File

@ -1,33 +0,0 @@
---
- name: Install for arch
import_tasks: arch.yml
when: ansible_os_family == "Archlinux"
- name: Install for debian
import_tasks: debian.yml
when: ansible_os_family == "Debian"
- name: Clone dotfiles
ansible.builtin.git:
repo: 'https://git.opytex.org/lafrite/dotfiles.git'
dest: "/home/{{ username }}/.dotfiles"
become: yes
- name: user owns its dotfiles
ansible.builtin.file:
path: "/home/{{ username }}/.dotfiles"
owner: "{{ username }}"
become: yes
- name: stow configs
ansible.builtin.command:
cmd: stow {{ item }}
chdir: "/home/{{ username }}/.dotfiles"
with_items: "{{ config2stow }}"
become: yes
- name: Gnome config
import_tasks: gnome.yml
#become: true
become_user: "{{ username }}"
when: no # soucis avec la version de psutil

View File

@ -1,29 +0,0 @@
---
language: python
python: "2.7"
# Use the new container infrastructure
sudo: false
# Install ansible
addons:
apt:
packages:
- python-pip
install:
# Install ansible
- pip install ansible
# Check ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg
script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@ -1,33 +0,0 @@
---
# Based on ansible-lint config
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable

View File

@ -1,38 +0,0 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -1,19 +0,0 @@
---
# defaults file for gnome
pacman_gnome:
- gnome
- gdm
- gnome-tweaks
- gparted
- transmission-gtk
- quodlibet
- networkmanager
- network-manager-applet
- gnome-keyring
- grsync
- soundconverter
- picard
- shotwell
- pitivi
- seahorse
- python-psutil

View File

@ -1,2 +0,0 @@
---
# handlers file for gnome

View File

@ -1,23 +0,0 @@
*********************************
Vagrant driver installation guide
*********************************
Requirements
============
* Vagrant
* Virtualbox, Parallels, VMware Fusion, VMware Workstation or VMware Desktop
Install
=======
Please refer to the `Virtual environment`_ documentation for installation best
practices. If not using a virtual environment, please consider passing the
widely recommended `'--user' flag`_ when invoking ``pip``.
.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
.. code-block:: bash
$ pip install 'molecule_vagrant'

View File

@ -1,7 +0,0 @@
---
- name: Converge
hosts: all
tasks:
- name: "Include gnome"
include_role:
name: "gnome"

View File

@ -1,11 +0,0 @@
---
dependency:
name: galaxy
driver:
name: vagrant
platforms:
- name: instance
provisioner:
name: ansible
verifier:
name: testinfra

View File

@ -1,22 +0,0 @@
"""PyTest Fixtures."""
from __future__ import absolute_import
import os
import pytest
def pytest_runtest_setup(item):
"""Run tests only when under molecule with testinfra installed."""
try:
import testinfra
except ImportError:
pytest.skip("Test requires testinfra", allow_module_level=True)
if "MOLECULE_INVENTORY_FILE" in os.environ:
pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("all")
else:
pytest.skip(
"Test should run only from inside molecule.", allow_module_level=True
)

View File

@ -1,10 +0,0 @@
"""Role testing files using testinfra."""
def test_hosts_file(host):
"""Validate /etc/hosts file."""
f = host.file("/etc/hosts")
assert f.exists
assert f.user == "root"
assert f.group == "root"

View File

@ -1,35 +0,0 @@
---
# tasks file for gnome
- name: Install gnome packages
pacman:
name: "{{ item }}"
state: present
with_items: "{{ pacman_gnome }}"
- name: Install look and feel
pacman:
name:
- materia-gtk-theme
- gnome-icon-theme-extras
- arc-solid-gtk-theme
- arc-gtk-theme
- gnome-themes-extra
- gnome-icon-theme-symbolic
- gnome-icon-theme
- adwaita-icon-theme
state: present
- name: Install AUR Icons and gtk themes
aur:
name: "{{ item }}"
use: makepkg
state: present
with_items:
- plata-theme
- gnome-colors-icon-theme
- numix-icon-theme-git
- numix-circle-icon-theme-git
- tela-icon-theme-git
become: yes
become_user: aur_builder

View File

@ -1,81 +0,0 @@
---
# tasks file for gnome
- name: Install gnome for arch
import_tasks: arch.yml
when: ansible_os_family == "Archlinux"
- name: enable service gdm
systemd:
name: gdm
enabled: yes
- name: disable old network services
systemd:
name: '{{ item }}'
enabled: no
with_items:
- dhcpcd
ignore_errors: yes
- name: enable service NetworkManager
systemd:
name: NetworkManager
enabled: yes
- name: <super + q> to close window
dconf:
key: "/org/gnome/desktop/wm/keybindings/close"
value: "['<Super>q']"
state: present
become: true
become_user: "{{ me.username }}"
- name: <super + enter> to fire a terminal - binding
dconf:
key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/binding"
value: "'<Super>Return'"
state: present
become: true
become_user: "{{ me.username }}"
- name: <super + enter> to fire a terminal - command
dconf:
key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/command"
value: "'urxvt'"
state: present
become: true
become_user: "{{ me.username }}"
- name: <super + enter> to fire a terminal - name
dconf:
key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/name"
value: "'Terminal'"
state: present
become: true
become_user: "{{ me.username }}"
- name: Shell theme
dconf:
key: "/org/gnome/shell/extensions/user-theme/name"
value: "'Materia-dark-compact'"
state: present
become: true
become_user: "{{ me.username }}"
- name: Gtk theme
dconf:
key: "/org/gnome/desktop/interface/gkt-theme"
value: "'Materia-dark-compact'"
state: present
become: true
become_user: "{{ me.username }}"
- name: Icon theme
dconf:
key: "/org/gnome/desktop/interface/icon-theme"
value: "'Tela-orange-dark'"
state: present
become: true
become_user: "{{ me.username }}"

View File

@ -1,2 +0,0 @@
localhost

View File

@ -1,5 +0,0 @@
---
- hosts: localhost
remote_user: root
roles:
- gnome

View File

@ -1,2 +0,0 @@
---
# vars file for gnome

View File

@ -7,6 +7,7 @@ pacman_utils:
- cups-pdf
- avahi
- nss-mdns
- networkmanager
pacman_cli:
- git-annex
@ -94,6 +95,23 @@ pacman_programming:
- nodejs
- yarn
pacman_gnome:
- gnome
- gdm
- gnome-tweaks
- gparted
- transmission-gtk
- quodlibet
- network-manager-applet
- gnome-keyring
- grsync
- soundconverter
- picard
- shotwell
- pitivi
- seahorse
- python-psutil
pacman_pkgs:
- "{{ pacman_utils }}"
- "{{ pacman_cli }}"
@ -125,7 +143,11 @@ aur_pkgs:
- "{{ aur_fonts }}"
- "{{ aur_work }}"
# Gnome
gnome_environnement: false
# Autofs
autofs:
host: nas
- host: nas

View File

@ -1,52 +0,0 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -1,17 +1,23 @@
---
- name: Converge
hosts: all
become: true
vars:
pacman_pkgs:
- "{{ pacman_utils }}"
aur_pkgs:
- "{{ aur_utils }}"
pre_tasks:
- name: Install pkgs
- name: Update cache
community.general.pacman:
update_cache: true
become: true
- name: set AUR
include_role:
name: "../arch_aur"
tasks:
- name: "Include workstation"
include_role:
name: "workstation"

View File

@ -4,8 +4,11 @@ dependency:
driver:
name: vagrant
platforms:
- name: instance
- name: archlinux
box: "archlinux/archlinux"
provisioner:
name: ansible
verifier:
name: testinfra
options:
sudo: true

View File

@ -21,3 +21,7 @@
with_items: "{{ aur_pkgs }}"
become: yes
become_user: aur_builder
- name: Install gnome environnement
import_tasks: gnome.yml
when: gnome_environnement

View File

@ -0,0 +1,13 @@
---
# tasks file for gnome
- name: Install gnome pkgs
community.general.pacman:
name: "{{ item }}"
state: present
with_items: "{{ pacman_gnome }}"
when: ansible_os_family == "Archlinux"
- name: enable service gdm
systemd:
name: gdm
enabled: yes

View File

@ -1,18 +1,30 @@
---
- name: Create NAS share directory
- name: Create auto host share directory
file:
path: "/media/{{ item.host }}"
state: directory
with_items: "{{ autofs }}"
- name: Activate NAS shares for autofs
- name: Activate host shares for autofs
lineinfile:
path: /etc/autofs/auto.master
line: "/media/{{ item.host }} /etc/autofs/auto.{{ item.host }} --timeout=60 --browse"
with_items: "{{ autofs }}"
- name: NAS autofs config file
- name: autofs config file
template:
src: "files/autofs.{{ item.host }}"
dest: "/etc/autofs/auto.{{ item.host }}"
with_items: "{{ autofs }}"
- name: enable service nfs
systemd:
name: nfs-client.target
enabled: yes
state: started
- name: Enable autofs daemon
service:
name: autofs
state: started
enabled: yes

View File

@ -2,7 +2,6 @@
# tasks file for workstation
- name: Install for arch
import_tasks: arch.yml
when: ansible_os_family == "Archlinux"
- name: enable service cups
systemd:
@ -23,14 +22,19 @@
enabled: yes
state: started
- name: enable service nfs
- name: disable old network services
systemd:
name: nfs-client.target
enabled: yes
state: started
name: '{{ item }}'
enabled: no
with_items:
- dhcpcd
ignore_errors: yes
- name: Enable autofs daemon
service:
name: autofs
state: started
- name: enable service NetworkManager
systemd:
name: NetworkManager
enabled: yes
- name: activate autofs
import_tasks: home_mounts.yml
when: autofs | length > 0

6
vars/combava.yml Normal file
View File

@ -0,0 +1,6 @@
---
gnome_environnement: yes
autofs:
- host: nas

View File

@ -1,14 +1,29 @@
$ANSIBLE_VAULT;1.1;AES256
63303466623263633539616565666333636165333836633033336165356132343330313165343632
6265626135323761646136623161623930656639623164310a656633353463346362656662643537
61653534386433363763643939343636623039393632663566363535626432666164646437363932
6365666534326433320a336264346437353033346432386134653832343234666565336439333834
32663035333465326337653931343962333662656465653863303938363432623832303937343237
33313939356361643235313735336361316631633933613134323833373034343365646131333062
66396161313233333261366662376332343963323432396464663037393265373233346361623530
31366363373033383236353830333238306232343331313439393436613035323337626361623639
32646564336435663137656436326237643636646430333336366637666630363762643165393237
34343238346230326435363435313165386434376465343932383966326138643766353033643935
30663762613166373233333062636563623363346666333363313835376536613736386566623836
65333839353038386539323963336464326264353631666262333136666532313430316535663731
31643262663436323461396363343564313636373237333932663930666262303838
63626664646236643164303430333632326363336639346236366239653331313461306464383366
3231306334393461613636363439303965623962306263320a623132386136643131373262356633
30313139653038383066353861633165636365376337633461623837386563323731323335646530
6437383964386662660a656139633464646266336164383766343332653831636362366533353861
36303966326465383161373032366266653361313830356438393835353031336630623330653961
66306535666331633636343638626634383861356137316236396333613665323963636566316661
31643165633932643465333061383335613336623635366331366438393835383430396465353934
63626335663139616234613461653636316139386435653133643065383866323462363936333330
61653031316538343165333137356137346238306663333665363665663037323233323135343139
30633636656133656562363366376539303937623937353935386532356165633231333365303735
34313236373435393237643838383362653032306334383761666539323963613565653331393966
36366634383965633832306537323630313238663430393138306438623864633238663633363461
30396337666438326166653739306637393330373633613830336638393238643332633031343865
66303264326362343964383864653035656533326134653063613833326333666262396561616135
34616233343264396439363861663166393139663763303866356366316461363361366333323532
33353361663963616436303132316336386632613836613838663063666433653635393066303662
63613961373336353062653066393866343765383636303133393032663866663738343263373531
32376261653632353036316132396164643339363435666365393139386636353630626364663233
38323163616561336661313731666262376234386662383139326538386464613635663964396461
37393661646466313730396436343962343633313537393365343661663434643033323564646133
33323561636662373536363533626437633736323636653335653932666335396662393239396165
61363737363064386332353235666262653939313932323735366233363261656364666430656631
35376463386537383966396231653664346334346139303736333730303961326337666465363333
39326239653166393431306166346532663231303562383237646132666164343566343039303866
37653662643037656437643532303039613765396538376238336337653831366339356635376138
33363566656361383735316261383637663262333739626531383863653836613836316536626433
34633966376361643263306163626231366638346535633230393631656561323561333436653965
39633966383863613664