Lots of updated roles

This commit is contained in:
2020-05-12 17:07:38 -06:00
parent 5a9254097e
commit 6bb3e3f34f
35 changed files with 264 additions and 125 deletions

View File

@@ -15,7 +15,60 @@ ln -s ~/Code/ansible-shared ~/Code/ansible/playbooks/roles/shared
These shared roles are geared toward Debian 9 and 10 with a few compatible with Ubuntu.
These shared roles assume a fresh stock Debian base with the main user being `toor`.
File `playbooks/group_vars/all` has user directory like so...add all your users here
```
users:
# Root and toor
root:
id: 0
gid: 0
password: '{{ root_linux_password }}'
toor:
id: 1000
gid: 1000
password: '{{ toor_linux_password }}'
groups: '{{ superuser_groups }}'
```
File `playbooks/group_vars/Debian.yml` like so
```
# ------------------------------------------------------------------------------
# Debian specific variables
# ------------------------------------------------------------------------------
superuser: toor
supergroup: staff
sudogroup: sudo
superuser_groups: [sudo,users,staff,adm,cdrom,floppy,audio,dip,video,plugdev,netdev]
```
Make one for each of your OS types, a `ManjroLinux.yml` may look like so
```
# ------------------------------------------------------------------------------
# Manjaro specific variables
# ------------------------------------------------------------------------------
superuser: toor
supergroup: staff
sudogroup: wheel
superuser_groups: [wheel,users,staff,adm,sys,network,power,video,storage,lp,input,audio]
```
Your `ansible.cfg` should look about like so.
```
# Ansible configuration for defaults and path modifications
# mReschke 2020-04-02
[defaults]
remote_user = root
remote_tmp = /tmp/ansible-$USER
roles_path = ./roles
private_key_file = ~/.ssh/mreschke-root.key
vault_password_file = ~/.files/configs/ansible/vault.passwd
retry_files_enabled = False
display_skipped_hosts = False
force_color = 1
nocows = 1
```
# Snippets
@@ -24,10 +77,10 @@ Quick helpers to remember common tasks
```yaml
# Detect Manjaro
- name: Configure Manjaro mirrorlist for linstore nginx proxy
include_tasks: manjaro.yml
when: ansible_os_family == "Archlinux" and ansible_lsb.id == "ManjaroLinux"
# Detect OS
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "10"
when: ansible_distribution == "Ubuntu" and ansible_distribution_version == "16.04"
when: ansible_os_family == "Archlinux" and ansible_lsb.id == "ManjaroLinux"
# Copy profiles to /etc/profile.d/
- include_tasks: ../../../functions/copy_etc-profile.d.yml
@@ -45,6 +98,26 @@ Quick helpers to remember common tasks
mode: '0644'
notify: restart nginx
# Template in a loop
- name: Templating ~/.getmail/config
template:
src: getmail
dest: '{{ "~" + item.username | expanduser }}/.getmail/config'
owner: '{{ item.username }}'
group: 'users'
mode: '0644'
with_items: "{{ getmail_users }}"
# Symlink in a loop
- name: Symlinking /store/apps/getmail to ~/Mail
file:
src: '/store/apps/getmail/{ item.email }'
dest: '{{ "~" + item.username | expanduser }}/Mail'
state: link
owner: '{{ item.username }}'
group: 'users'
with_items: "{{ getmail_users }}"
# Install common apps for all debian machines
- name: Installing Debian common applications
apt:
@@ -59,8 +132,8 @@ Quick helpers to remember common tasks
file:
path: /etc/nginx
state: directory
owner: toor
group: toor
owner: '{{ superuser }}'
group: '{{ superuser }}'
mode: '0755'
# Set chown toor:toor -R /etc/nginx
@@ -69,7 +142,7 @@ Quick helpers to remember common tasks
path: /etc/nginx
state: directory
recurse: yes
owner: toor
group: toor
owner: '{{ superuser }}'
group: '{{ superuser }}'
```