updated roles

This commit is contained in:
Paul 2020-04-26 19:30:39 +02:00
parent 3b3b274ab0
commit 83f0771733
28 changed files with 165 additions and 185 deletions

4
Vagrantfile vendored
View File

@ -2,9 +2,9 @@
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "boxcutter/ubuntu1604-desktop"
config.vm.box = "fasmat/ubuntu2004-desktop"
config.vm.box_version = "20.0425.1"
config.vm.provision "ansible" do |ansible|
#ansible.verbose = "vv"
ansible.playbook = "test.yml"
end
end

2
hosts
View File

@ -1 +1 @@
localhost ansible_connection=local
localhost ansible_connection=local

View File

@ -5,15 +5,14 @@
- common
- samba
- pam
- lightdm
vars:
- kbdlang: "fr"
- kbdmodel: "pc105"
- kbdvariant: "latin9"
- localelang: "fr_FR"
- localelanguage: "fr_FR:"
- timezone: "Europe/Paris"
- languagepacks:
kbdlang: "fr"
kbdmodel: "pc105"
kbdvariant: "latin9"
localelang: "fr_FR"
localelanguage: "fr_FR:"
timezone: "Europe/Paris"
languagepacks:
- language-pack-fr
- language-pack-fr-base
vars_prompt:
@ -21,16 +20,16 @@
prompt: "Timezone "
default: "Europe/Paris"
- name: "ad_dns_domain"
prompt: "Active Directory DNS domain name "
prompt: "Active Directory DNS domain name : "
private: no
default: "organization.int"
- name: "ad_nt_domain"
prompt: "NT domain name "
prompt: "NT domain name : "
private: no
default: "ORGANIZATION"
- name: "ad_admin_username"
prompt: "Admin username "
prompt: "Admin username : "
private: no
default: "Administrator"
- name: "ad_admin_password"
prompt: "Admin password "
prompt: "Admin password : "

View File

@ -0,0 +1,17 @@
---
apt_pkgs:
- htop
- ntp
- ntpdate
- ncdu
- tmux
kbdlang: "fr"
kbdmodel: "pc105"
kbdvariant: "latin9"
localelang: "fr_FR"
localelanguage: "fr_FR:"
timezone: "Europe/Paris"
languagepacks:
- language-pack-fr
- language-pack-fr-base

View File

@ -1,26 +1,18 @@
---
- name: Update apt sources
apt:
update_cache=yes
upgrade=yes
update_cache: yes
tags:
- prereqs
- apt
- apt_prereqs
- name: Install utils main utils
apt: name={{ item }}
with_items:
- "{{ apt_pkgs }}"
apt:
name: "{{ apt_pkgs }}"
tags:
- prereqs
- apt
- apt_prereqs
- name: Install needed language packs
apt: name={{ item }}
with_items:
- language-pack-fr
- language-pack-fr-base
apt:
name: "{{ languagepacks }}"
tags:
- prereqs
- apt
- apt_prereqs

View File

@ -1,26 +1,25 @@
---
- name: Set hostname
shell: hostname {{ ansible_hostname }}.{{ ad_dns_domain }}
shell: "hostname {{ ansible_hostname }}.{{ ad_dns_domain }}"
- name: Set hostname file
template:
src=hostname.j2
dest=/etc/hostname
mode=0644
owner=root
group=root
src: hostname.j2
dest: /etc/hostname
mode: 0644
owner: root
group: root
tags:
- prereqs
- hostname
- name: Set hosts file
template:
src=hosts.j2
dest=/etc/hosts
mode=0644
owner=root
group=root
src: hosts.j2
dest: /etc/hosts
mode: 0644
owner: root
group: root
tags:
- prereqs
- hostname
- hostname

View File

@ -1,12 +1,11 @@
---
- name: Set keyboard layouts
template:
src=keyboard.j2
dest=/etc/default/keyboard
mode=0644
owner=root
group=root
src: keyboard.j2
dest: /etc/default/keyboard
mode: 0644
owner: root
group: root
tags:
- prereqs
- keyboard
- keyboard

View File

@ -1,7 +1,4 @@
---
- name: Install aptitude
command: apt-get install -y aptitude
- name: Update lists, upgrade and install needed packages
include: apt.yml
@ -12,5 +9,4 @@
include: hostname.yml
- name: Include time configuration
include: time.yml
include: time.yml

View File

@ -1,10 +1,10 @@
---
- name: Set Timezone
file:
src=/usr/share/zoneinfo/{{ timezone }}
dest=/etc/localtime
force=yes
state=link
src: "/usr/share/zoneinfo/{{ timezone }}"
dest: "/etc/localtime"
force: yes
state: link
tags:
- prereqs
- timezone
- timezone

View File

@ -1 +1 @@
{{ ansible_hostname }}.{{ ad_dns_domain }}
{{ ansible_hostname }}.{{ ad_dns_domain }}

View File

@ -7,5 +7,4 @@ XKBLAYOUT="{{ kbdlang }}"
XKBVARIANT="{{ kbdvariant }}"
XKBOPTIONS=""
BACKSPACE="guess"
BACKSPACE="guess"

View File

@ -1,7 +1 @@
---
apt_pkgs:
- htop
- ntp
- ntpdate
- ncdu
- tmux
---

View File

@ -1 +0,0 @@
---

View File

@ -1,6 +0,0 @@
[SeatDefaults]
allow-guest=false
greeter-hide-users=true
greeter-show-manual-login=true
autologin-user=

View File

@ -1,15 +0,0 @@
#
# User accounts configuration
#
# NOTE: If you have AccountsService installed on your system, then LightDM will
# use this instead and these settings will be ignored
#
# minimum-uid = Minimum UID required to be shown in greeter
# hidden-users = Users that are not shown to the user
# hidden-shells = Shells that indicate a user cannot login
#
[UserList]
minimum-uid=500
hidden-users=nobody nobody4 noaccess
hidden-shells=/bin/false /usr/sbin/nologin

View File

@ -0,0 +1 @@
---

View File

@ -1,18 +1,24 @@
---
- name: Create lightdm config dir
file:
path: /etc/lightdm
state: directory
tags: lightdm
- name: Set lightdm main configuration file
template:
src=lightdm.conf.j2
dest=/etc/lightdm/lightdm.conf
mode=0644
owner=root
group=root
src: lightdm.conf.j2
dest: /etc/lightdm/lightdm.conf
mode: 0644
owner: root
group: root
tags: lightdm
- name: Set lightdm users.conf file
template:
src=users.conf.j2
dest=/etc/lightdm/users.conf
mode=0644
owner=root
group=root
src: users.conf.j2
dest: /etc/lightdm/users.conf
mode: 0644
owner: root
group: root
tags: lightdm

View File

@ -2,5 +2,4 @@
allow-guest=false
greeter-hide-users=true
greeter-show-manual-login=true
autologin-user=
autologin-user=

View File

@ -11,5 +11,4 @@
[UserList]
minimum-uid=500
hidden-users=nobody nobody4 noaccess
hidden-shells=/bin/false /usr/sbin/nologin
hidden-shells=/bin/false /usr/sbin/nologin

View File

@ -0,0 +1 @@
---

View File

@ -0,0 +1 @@
---

View File

@ -1,46 +1,45 @@
---
- name: Install common-account
template:
src=common-account.j2
dest=/etc/pam.d/common-account
mode=0644
owner=root
group=root
src: common-account.j2
dest: /etc/pam.d/common-account
mode: 0644
owner: root
group: root
tags: pam
- name: Install common-auth
template:
src=common-auth.j2
dest=/etc/pam.d/common-auth
mode=0644
owner=root
group=root
src: common-auth.j2
dest: /etc/pam.d/common-auth
mode: 0644
owner: root
group: root
tags: pam
- name: Install common-password
template:
src=common-password.j2
dest=/etc/pam.d/common-password
mode=0644
owner=root
group=root
src: common-password.j2
dest: /etc/pam.d/common-password
mode: 0644
owner: root
group: root
tags: pam
- name: Install common-session
template:
src=common-session.j2
dest=/etc/pam.d/common-session
mode=0644
owner=root
group=root
src: common-session.j2
dest: /etc/pam.d/common-session
mode: 0644
owner: root
group: root
tags: pam
- name: Install common-session-noninteractive
template:
src=common-session-noninteractive.j2
dest=/etc/pam.d/common-session-noninteractive
mode=0644
owner=root
group=root
tags: pam
src: common-session-noninteractive.j2
dest: /etc/pam.d/common-session-noninteractive
mode: 0644
owner: root
group: root
tags: pam

View File

@ -30,4 +30,4 @@ session required pam_unix.so
session required pam_mkhomedir.so skel=/etc/skel umask=0022 silent
session optional pam_winbind.so
session optional pam_systemd.so
# end of pam-auth-update config
# end of pam-auth-update config

1
roles/pam/vars/main.yml Normal file
View File

@ -0,0 +1 @@
---

View File

@ -0,0 +1,14 @@
---
samba_packages:
- heimdal-clients
- libnss-winbind
- libpam-winbind
- ntp
- ntpdate
- samba
- winbind
samba_daemons:
- smbd
- nmbd
- winbind

View File

@ -1,8 +1,6 @@
- name: restart samba
---
- name: Restart samba
service:
name={{ item }}
state=restarted
with_items:
- smbd
- nmbd
- winbind
name: "{{ item }}"
state: restarted
loop: "{{ samba_daemons }}"

View File

@ -1,75 +1,62 @@
---
- name: Install samba and required tools
apt:
name={{ item }}
state=present
with_items:
- heimdal-clients
- libnss-winbind
- libpam-winbind
- ntp
- ntpdate
- samba
- winbind
tags:
- samba
name: "{{ item }}"
state: present
loop: "{{ samba_packages }}"
tags: samba
- name: Install nsswitch passwd config
lineinfile:
dest=/etc/nsswitch.conf
regexp="^passwd:"
line="passwd{{ ':' }} files winbind"
notify: restart samba
dest: /etc/nsswitch.conf
regexp: "^passwd:"
line: "passwd{{ ':' }} files winbind"
notify: Restart samba
tags:
- samba
- nsswitch
- name: Install nsswitch group config
lineinfile:
dest=/etc/nsswitch.conf
regexp="^group:"
line="group{{ ':' }} files winbind"
notify: restart samba
dest: /etc/nsswitch.conf
regexp: "^group:"
line: "group{{ ':' }} files winbind"
notify: Restart samba
tags:
- samba
- nsswitch
- name: Install nsswitch shadow config
lineinfile:
dest=/etc/nsswitch.conf
regexp="^shadow:"
line="shadow{{ ':' }} files winbind"
notify: restart samba
dest: /etc/nsswitch.conf
regexp: "^shadow:"
line: "shadow{{ ':' }} files winbind"
notify: Restart samba
tags:
- samba
- nsswitch
- name: Install samba configuration
template:
src=smb.conf.j2
dest=/etc/samba/smb.conf
mode=0644
owner=root
group=root
notify: restart samba
src: smb.conf.j2
dest: /etc/samba/smb.conf
mode: 0644
owner: root
group: root
notify: Restart samba
tags:
- samba
- smbconf
- name: Enable samba services
service:
name={{ item }}
enabled=yes
with_items:
- smbd
- nmbd
- winbind
tags:
- samba
- name: Join domain
shell: net ads join -U {{ ad_admin_username }}%{{ ad_admin_password }}
notify: restart samba
register: join_domain
name: "{{ item }}"
enabled: yes
loop: "{{ samba_daemons }}"
tags: samba
- name: Join domain
shell: "net ads join -U {{ ad_admin_username }}%{{ ad_admin_password }}"
notify: Restart samba
register: join_domain
tags: samba

View File

@ -0,0 +1 @@
---