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 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 # Snippets
@@ -24,9 +77,9 @@ Quick helpers to remember common tasks
```yaml ```yaml
# Detect Manjaro # Detect OS
- name: Configure Manjaro mirrorlist for linstore nginx proxy when: ansible_os_family == "Debian" and ansible_distribution_major_version == "10"
include_tasks: manjaro.yml when: ansible_distribution == "Ubuntu" and ansible_distribution_version == "16.04"
when: ansible_os_family == "Archlinux" and ansible_lsb.id == "ManjaroLinux" when: ansible_os_family == "Archlinux" and ansible_lsb.id == "ManjaroLinux"
# Copy profiles to /etc/profile.d/ # Copy profiles to /etc/profile.d/
@@ -45,6 +98,26 @@ Quick helpers to remember common tasks
mode: '0644' mode: '0644'
notify: restart nginx 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 # Install common apps for all debian machines
- name: Installing Debian common applications - name: Installing Debian common applications
apt: apt:
@@ -59,8 +132,8 @@ Quick helpers to remember common tasks
file: file:
path: /etc/nginx path: /etc/nginx
state: directory state: directory
owner: toor owner: '{{ superuser }}'
group: toor group: '{{ superuser }}'
mode: '0755' mode: '0755'
# Set chown toor:toor -R /etc/nginx # Set chown toor:toor -R /etc/nginx
@@ -69,7 +142,7 @@ Quick helpers to remember common tasks
path: /etc/nginx path: /etc/nginx
state: directory state: directory
recurse: yes recurse: yes
owner: toor owner: '{{ superuser }}'
group: toor group: '{{ superuser }}'
``` ```

View File

@@ -6,7 +6,7 @@
dest: /etc/mysql/mysql.conf.d/mysqld.cnf dest: /etc/mysql/mysql.conf.d/mysqld.cnf
owner: root owner: root
group: root group: root
mode: 0644 mode: '0644'
notify: restart mysql # Only reloads if file has changed! notify: restart mysql # Only reloads if file has changed!
# Create the confluence MySQL database # Create the confluence MySQL database

View File

@@ -6,7 +6,7 @@
dest: "/etc/mysql/percona-server.conf.d/mysqld.cnf" dest: "/etc/mysql/percona-server.conf.d/mysqld.cnf"
owner: root owner: root
group: root group: root
mode: 0644 #-rw-r--r-- mode: '0644' #-rw-r--r--
notify: restart mysql # Only runs if file changed! notify: restart mysql # Only runs if file changed!
# Create the servicedesk MySQL database # Create the servicedesk MySQL database

View File

@@ -10,14 +10,14 @@
file: file:
path: '{{ base }}' path: '{{ base }}'
state: directory state: directory
owner: toor owner: '{{ superuser }}'
group: toor group: '{{ superuser }}'
mode: '0755' mode: '0755'
# Run frappe bench init # Run frappe bench init
- name: Running frappe bench init - name: Running frappe bench init
# NOTICE: running as toor # NOTICE: running as superuser
become_user: toor become_user: '{{ superuser }}'
shell: bench init {{ projectname }} --frappe-branch version-12 --no-backups shell: bench init {{ projectname }} --frappe-branch version-12 --no-backups
args: args:
chdir: '{{ base }}' chdir: '{{ base }}'
@@ -27,8 +27,8 @@
# Run frappe bench init with custom repo # Run frappe bench init with custom repo
- name: Running frappe bench init with custom repo - name: Running frappe bench init with custom repo
# NOTICE: running as toor # NOTICE: running as superuser
become_user: toor become_user: '{{ superuser }}'
shell: bench init {{ projectname }} --frappe-path {{ frappe_repo }} --frappe-branch version-12 --no-backups shell: bench init {{ projectname }} --frappe-path {{ frappe_repo }} --frappe-branch version-12 --no-backups
args: args:
chdir: '{{ base }}' chdir: '{{ base }}'
@@ -38,7 +38,7 @@
# Create frappe-bench supervisor configs # Create frappe-bench supervisor configs
- name: Creating frappe-bench supervisor config - name: Creating frappe-bench supervisor config
become_user: toor become_user: '{{ superuser }}'
shell: bench setup supervisor shell: bench setup supervisor
args: args:
chdir: '{{ path }}' chdir: '{{ path }}'
@@ -54,7 +54,7 @@
# Get ERPNext app # Get ERPNext app
- name: Getting ERPNext app - name: Getting ERPNext app
become_user: toor become_user: '{{ superuser }}'
shell: bench get-app erpnext --branch version-12 shell: bench get-app erpnext --branch version-12
args: args:
chdir: '{{ path }}' chdir: '{{ path }}'
@@ -64,7 +64,7 @@
# Get ERPNext app from custom repo # Get ERPNext app from custom repo
- name: Getting ERPNext app from custom repo - name: Getting ERPNext app from custom repo
become_user: toor become_user: '{{ superuser }}'
shell: bench get-app erpnext {{ erpnext_repo }} --branch version-12 shell: bench get-app erpnext {{ erpnext_repo }} --branch version-12
args: args:
chdir: '{{ path }}' chdir: '{{ path }}'
@@ -74,7 +74,7 @@
# Settings frappe bench mariadb-host # Settings frappe bench mariadb-host
- name: Setting frappe bench mariadb-host - name: Setting frappe bench mariadb-host
become_user: toor become_user: '{{ superuser }}'
shell: bench set-mariadb-host {{ db_host }} shell: bench set-mariadb-host {{ db_host }}
args: args:
chdir: '{{ path }}' chdir: '{{ path }}'
@@ -82,7 +82,7 @@
# Create new site using local database # Create new site using local database
- name: Creating new frappe site using local database - name: Creating new frappe site using local database
become_user: toor become_user: '{{ superuser }}'
shell: bench new-site {{ site }} --admin-password {{ erpnext_admin_password }} --db-name {{ db_name }} --db-password {{ erpnext_db_password }} --mariadb-root-username root --mariadb-root-password {{ root_db_password }} --force shell: bench new-site {{ site }} --admin-password {{ erpnext_admin_password }} --db-name {{ db_name }} --db-password {{ erpnext_db_password }} --mariadb-root-username root --mariadb-root-password {{ root_db_password }} --force
args: args:
chdir: '{{ path }}' chdir: '{{ path }}'
@@ -92,7 +92,7 @@
# Create new site using remote database # Create new site using remote database
- name: Creating new frappe site using remote database - name: Creating new frappe site using remote database
become_user: toor become_user: '{{ superuser }}'
shell: bench new-site {{ site }} --admin-password {{ erpnext_admin_password }} --db-name {{ db_name }} --db-password {{ erpnext_db_password }} --mariadb-root-username root --mariadb-root-password {{ root_db_password }} --force --no-mariadb-socket shell: bench new-site {{ site }} --admin-password {{ erpnext_admin_password }} --db-name {{ db_name }} --db-password {{ erpnext_db_password }} --mariadb-root-username root --mariadb-root-password {{ root_db_password }} --force --no-mariadb-socket
args: args:
chdir: '{{ path }}' chdir: '{{ path }}'
@@ -102,7 +102,7 @@
# Adding ERPNext to site # Adding ERPNext to site
- name: Adding ERPNext to site - name: Adding ERPNext to site
become_user: toor become_user: '{{ superuser }}'
shell: bench --site {{ site }} install-app erpnext shell: bench --site {{ site }} install-app erpnext
args: args:
chdir: '{{ path }}' chdir: '{{ path }}'
@@ -111,7 +111,7 @@
# Create frappe-bench nginx configs # Create frappe-bench nginx configs
- name: Creating frappe-bench nginx config - name: Creating frappe-bench nginx config
become_user: toor become_user: '{{ superuser }}'
shell: bench setup nginx shell: bench setup nginx
args: args:
chdir: '{{ path }}' chdir: '{{ path }}'

View File

@@ -1,9 +1,9 @@
--- ---
# Copy ssh client config for toor user so we can git clone without confirmation # Copy ssh client config for superuser user so we can git clone without confirmation
- name: Copying toor SSH client config - name: Copying superuser SSH client config
copy: copy:
src: 'ssh.config' src: 'ssh.config'
dest: '/home/toor/.ssh/config' dest: '/home/{{ superuser }}/.ssh/config'
owner: toor owner: '{{ superuser }}'
group: toor group: '{{ superuser }}'
mode: '0644' mode: '0644'

View File

@@ -1,9 +1,9 @@
--- ---
# NOTICE: Commands like frappe bench and git clone need to run # NOTICE: Commands like frappe bench and git clone need to run
# as the toor user, not root. The playbook that runs this role # as the superuser user, not root. The playbook that runs this role
# should be logging in as toor, using become:yes with toors ssh key # should be logging in as superuser, using become:yes with superusers ssh key
# Because become:yes all command still run as root, until I use # Because become:yes all command still run as root, until I use
# become_user: toor below. # become_user: superuser below.
- include_tasks: configure-linux.yml - include_tasks: configure-linux.yml
- include_tasks: configure-mysql.yml - include_tasks: configure-mysql.yml

View File

@@ -13,8 +13,8 @@
file: file:
path: /var/www path: /var/www
state: directory state: directory
owner: toor owner: '{{ superuser }}'
group: toor group: '{{ superuser }}'
mode: '0755' mode: '0755'
# Create /var/www/konga folder # Create /var/www/konga folder
@@ -22,14 +22,14 @@
file: file:
path: /var/www/konga path: /var/www/konga
state: directory state: directory
owner: toor owner: '{{ superuser }}'
group: toor group: '{{ superuser }}'
mode: '0755' mode: '0755'
# Git clone https://github.com/pantsel/konga.git # Git clone https://github.com/pantsel/konga.git
- name: Git clone https://github.com/pantsel/konga.git tag 0.14.7 - name: Git clone https://github.com/pantsel/konga.git tag 0.14.7
# NOTICE: running as toor # NOTICE: running as superuser
become_user: toor become_user: '{{ superuser }}'
git: git:
clone: yes clone: yes
force: yes force: yes
@@ -38,13 +38,13 @@
version: 0.14.7 version: 0.14.7
depth: 1 depth: 1
# Ensure konga git contents owned by toor # Ensure konga git contents owned by superuser
- name: Ensuring konga git contents owned by toor - name: Ensuring konga git contents owned by superuser
file: file:
path: /var/www/konga path: /var/www/konga
state: directory state: directory
owner: toor owner: '{{ superuser }}'
group: toor group: '{{ superuser }}'
recurse: yes recurse: yes
# Delete package-lock.json # Delete package-lock.json
@@ -55,31 +55,31 @@
# Install konga npm packages # Install konga npm packages
- name: Installing konga NPM packages - name: Installing konga NPM packages
# NOTICE: running as toor # NOTICE: running as superuser
become_user: toor become_user: '{{ superuser }}'
npm: npm:
path: /var/www/konga path: /var/www/konga
# Install konga bower dependencies # Install konga bower dependencies
- name: Installing konga bower dependencies - name: Installing konga bower dependencies
# NOTICE: running as toor # NOTICE: running as superuser
become_user: toor become_user: '{{ superuser }}'
shell: npm run bower-deps shell: npm run bower-deps
args: args:
chdir: /var/www/konga chdir: /var/www/konga
# Ensure konga git contents owned by toor # Ensure konga git contents owned by superuser
- name: Ensuring konga git contents owned by toor - name: Ensuring konga git contents owned by superuser
file: file:
path: /var/www/konga path: /var/www/konga
state: directory state: directory
owner: toor owner: '{{ superuser }}'
group: toor group: '{{ superuser }}'
recurse: yes recurse: yes
# Copy konga systemd unit file # Copy konga systemd unit file
- name: Copying konga.service systemd unit file - name: Copying konga.service systemd unit file
copy: template:
src: konga.service src: konga.service
dest: "/etc/systemd/system/konga.service" dest: "/etc/systemd/system/konga.service"
owner: root owner: root

View File

@@ -4,7 +4,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
User=toor User={{ superuser }}
WorkingDirectory=/var/www/konga WorkingDirectory=/var/www/konga
ExecStart=/usr/bin/node --harmony app.js --prod ExecStart=/usr/bin/node --harmony app.js --prod
Restart=on-failure Restart=on-failure

View File

@@ -17,5 +17,5 @@
dest: /etc/opt/jfrog/artifactory/default dest: /etc/opt/jfrog/artifactory/default
owner: artifactory owner: artifactory
group: artifactory group: artifactory
mode: 0644 mode: '0644'
notify: restart artifactory notify: restart artifactory

View File

@@ -12,8 +12,4 @@ if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)" eval "$(pyenv init -)"
fi fi
# Python aliases for pv, activate and pips should already be defined in shared/server
# Python aliases
alias pv='echo "Version:" && python --version && echo && echo "Interpreter Path:" && python -c "import sys;print(sys.prefix)" && echo && echo "Paths:" && python -c "import sys;print(sys.path);"'
alias activate='source env/bin/activate && pv'
alias pips='pipenv shell && echo "pipenv shell has been deactivated" && echo && pv'

View File

@@ -17,6 +17,8 @@
- libgdbm-dev - libgdbm-dev
- libc6-dev - libc6-dev
- libbz2-dev - libbz2-dev
- libffi-dev
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "9"
# Debian 10 # Debian 10
- name: Installing build-essential and pyenv dependencies - name: Installing build-essential and pyenv dependencies
@@ -36,19 +38,17 @@
- libffi-dev - libffi-dev
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "10" when: ansible_os_family == "Debian" and ansible_distribution_major_version == "10"
# Install pyenv using git clone # Install pyenv using git clone
- name: Installing pyenv using git clone - name: Installing pyenv using git clone
git: git:
repo: https://github.com/pyenv/pyenv.git repo: https://github.com/pyenv/pyenv.git
dest: /usr/local/lib/pyenv dest: /usr/local/lib/pyenv
force: yes
depth: 1 depth: 1
# Set users and permissions # Set users and permissions
# There is also a files/bin/pyenv-fix-permissions.sh that mirror the below # There is also a files/bin/pyenv-fix-permissions.sh that mirror the below
# which you can run manually after you install a new version (pyenv sets mask and ignores setfacl) # which you can run manually after you install a new version (pyenv sets mask and ignores setfacl)
- command: chown toor:staff /usr/local/lib/pyenv -R - file: 'path=/usr/local/lib/pyenv owner={{ superuser }} group={{ supergroup }} state=directory recurse=yes mode=2775'
- command: chmod 2775 /usr/local/lib/pyenv
- command: find /usr/local/lib/pyenv -type d -exec chmod 2775 {} \; - command: find /usr/local/lib/pyenv -type d -exec chmod 2775 {} \;
- command: setfacl -R -d -m user::rwx,group::rwx /usr/local/lib/pyenv - command: setfacl -R -d -m user::rwx,group::rwx /usr/local/lib/pyenv

View File

@@ -0,0 +1,20 @@
---
# Pre output
- debug:
msg: 'Pyenv about to install python {{ item }}'
with_items: '{{ python_versions }}'
# Install python versions via pyenv
- name: 'Installing Python version(s) via pyenv'
become_user: '{{ superuser }}'
shell: 'source /etc/profile.d/pyenv.sh && /usr/local/lib/pyenv/bin/pyenv install --skip-existing {{ item }}'
args:
executable: /bin/bash
with_items: '{{ python_versions }}'
# Set pyenv global python versions
- name: 'Setting pyenv global python versions'
become_user: '{{ superuser }}'
shell: 'source /etc/profile.d/pyenv.sh && /usr/local/lib/pyenv/bin/pyenv global {{ python_global_versions }}'
args:
executable: /bin/bash

View File

@@ -1,9 +1,13 @@
--- ---
# Install pyenv
- include_tasks: install-pyenv.yml
# Copy profiles to /etc/profile.d/ # Copy profiles to /etc/profile.d/
- include_tasks: ../../../functions/copy_etc-profile.d.yml - include_tasks: ../../../functions/copy_etc-profile.d.yml
# Copy scripts to /usr/local/bin # Copy scripts to /usr/local/bin
- include_tasks: ../../../functions/copy_usr-local-bin.yml - include_tasks: ../../../functions/copy_usr-local-bin.yml
# Install pyenv
- include_tasks: install-pyenv.yml
# Install python versions
- include_tasks: install-python.yml

View File

@@ -7,7 +7,7 @@
# mReschke 2019-04-19 # mReschke 2019-04-19
path=/usr/local/lib/pyenv path=/usr/local/lib/pyenv
chown toor:staff $path -R chown {{ superuser }}:{{ supergroup }} $path -R
chmod 2775 $path chmod 2775 $path
find $path -type d -exec chmod 2775 {} \; find $path -type d -exec chmod 2775 {} \;
setfacl -R -d -m user::rwx,group::rwx $path setfacl -R -d -m user::rwx,group::rwx $path

View File

@@ -1,10 +1,24 @@
# Copy profiles to /etc/profile.d/ # Copy profiles to /etc/profile.d/
# Templates messes up a lot of back scripts (errors on odd chars)
# So copy all files/bin/* using COPY
- name: Copying profiles to /etc/profile.d - name: Copying profiles to /etc/profile.d
copy: copy:
src: "{{ item }}" src: "{{ item }}"
dest: /etc/profile.d/ dest: /etc/profile.d/
owner: root owner: root
group: root group: root
mode: 0755 mode: '0755'
with_fileglob: with_fileglob:
- profile.d/* - files/profile.d/*
# Template and copy profiles to /etc/profile.d/
# Careful here, as some script can mess up the template system (jinja2)
- name: Copy templated profiles to /etc/profile.d/
template:
src: "{{ item }}"
dest: /etc/profile.d/
owner: root
group: root
mode: '0755'
with_fileglob:
- templates/profile.d/*

View File

@@ -1,10 +1,24 @@
# Copy scripts to /usr/local/bin # Copy scripts to /usr/local/bin
# Templates messes up a lot of back scripts (errors on odd chars)
# So copy all files/bin/* using COPY
- name: Copying scripts to /usr/local/bin - name: Copying scripts to /usr/local/bin
copy: copy:
src: "{{ item }}" src: "{{ item }}"
dest: /usr/local/bin/ dest: /usr/local/bin/
owner: toor owner: '{{ superuser }}'
group: staff group: '{{ supergroup }}'
mode: 0775 mode: '0775'
with_fileglob: with_fileglob:
- bin/* - files/bin/*
# Template and copy scripts to /usr/local/bin
# Careful here, as some script can mess up the template system (jinja2)
- name: Copy templated scripts to /usr/local/bin
template:
src: "{{ item }}"
dest: /usr/local/bin/
owner: '{{ superuser }}'
group: '{{ supergroup }}'
mode: '0775'
with_fileglob:
- templates/bin/*

View File

@@ -1,7 +1,16 @@
--- ---
# Install getmail # Install getmail for Debian 9
- name: Installing getmail - name: Installing getmail for Debian 9
apt: apt:
update_cache: yes update_cache: yes
state: present state: present
name: getmail4 name: getmail4
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "9"
# Install getmail for Debian 10
- name: Installing getmail for Debian 10
apt:
update_cache: yes
state: present
name: getmail
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "10"

8
mail/mutt/tasks/main.yml Normal file
View File

@@ -0,0 +1,8 @@
---
# Install mutt email client
- name: Installing mutt email client
apt:
update_cache: yes
state: present
name: mutt

View File

@@ -43,3 +43,13 @@ alias rm='rm -Irv'
# What is my external IP address # What is my external IP address
alias whatismyip='curl -s http://icanhazip.com/' alias whatismyip='curl -s http://icanhazip.com/'
# Python
alias pv='echo "Version:" && python --version && echo && echo "Interpreter Path:" && python -c "import sys;print(sys.prefix)" && echo && echo "Paths:" && python -c "import sys;print(sys.path);"'
alias activate='source env/bin/activate && pv'
alias pips='pipenv shell && echo "pipenv shell has been deactivated" && echo && pv'
# Docker
alias dps="docker ps"
alias dpsa="docker ps -a"
alias dimg="docker images"
alias dimga="docker images -a"

View File

@@ -0,0 +1,8 @@
---
# Install tmux
- name: Installing tmux
apt:
update_cache: yes
state: present
name:
- tmux

View File

@@ -41,6 +41,6 @@
ssh_info: "" ssh_info: ""
add_sudo: no add_sudo: no
create: yes create: yes
ssh_keys: yes ssh_keys: no
ssh_authorize: no ssh_authorize: yes

View File

@@ -7,5 +7,4 @@
- "ID: {{ users[user]['id'] }}" - "ID: {{ users[user]['id'] }}"
- "GID: {{ users[user]['gid'] }}" - "GID: {{ users[user]['gid'] }}"
- "Groups: {{ user_groups }}" - "Groups: {{ user_groups }}"
- "Password: {{ users[user]['password'] }}" #- "Password: {{ users[user]['password'] }}"
#- "{{ network['netmask'] }}"

View File

@@ -1,6 +1,6 @@
--- ---
# Create users ~/.ssh directory # Create users ~/.ssh directory
- name: Creating {{ user }} ~/.ssh directory - name: Creating {{ user }} ~/.ssh directoryxx
file: file:
path: '{{ "~" + user | expanduser }}/.ssh' path: '{{ "~" + user | expanduser }}/.ssh'
state: directory state: directory
@@ -26,7 +26,7 @@
dest: '{{ "~" + user | expanduser }}/.ssh/id_rsa.pub' dest: '{{ "~" + user | expanduser }}/.ssh/id_rsa.pub'
owner: '{{ user }}' owner: '{{ user }}'
group: '{{ user }}' group: '{{ user }}'
mode: 0644 mode: '0644'
when: ssh_keys|default(false)|bool when: ssh_keys|default(false)|bool
# Create users private key # Create users private key
@@ -36,5 +36,5 @@
dest: '{{ "~" + user | expanduser }}/.ssh/id_rsa' dest: '{{ "~" + user | expanduser }}/.ssh/id_rsa'
owner: '{{ user }}' owner: '{{ user }}'
group: '{{ user }}' group: '{{ user }}'
mode: 0600 mode: '0600'
when: ssh_keys|default(false)|bool when: ssh_keys|default(false)|bool

View File

@@ -3,7 +3,7 @@
file: file:
path: '/etc/sudoers.d/{{ user }}' path: '/etc/sudoers.d/{{ user }}'
state: touch state: touch
mode: "0640" #-rw-r----- mode: '0640'
when: 'sudogroup in user_groups' when: 'sudogroup in user_groups'
- name: Setting user to nopasswd sudo access - name: Setting user to nopasswd sudo access

View File

@@ -66,4 +66,4 @@
dest: '/var/lib/one/.ssh/config' dest: '/var/lib/one/.ssh/config'
owner: 'oneadmin' owner: 'oneadmin'
group: 'oneadmin' group: 'oneadmin'
mode: 0644 mode: '0644'

View File

@@ -27,7 +27,7 @@
dest: '/etc/libvirt/libvirtd.conf' dest: '/etc/libvirt/libvirtd.conf'
owner: 'root' owner: 'root'
group: 'root' group: 'root'
mode: 0644 mode: '0644'
notify: restart libvirtd notify: restart libvirtd
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "10" when: ansible_os_family == "Debian" and ansible_distribution_major_version == "10"
@@ -38,7 +38,7 @@
dest: '/etc/libvirt/libvirtd.conf' dest: '/etc/libvirt/libvirtd.conf'
owner: 'root' owner: 'root'
group: 'root' group: 'root'
mode: 0644 mode: '0644'
notify: restart libvirtd notify: restart libvirtd
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "9" when: ansible_os_family == "Debian" and ansible_distribution_major_version == "9"
@@ -76,4 +76,4 @@
dest: '/var/lib/one/.ssh/config' dest: '/var/lib/one/.ssh/config'
owner: 'oneadmin' owner: 'oneadmin'
group: 'oneadmin' group: 'oneadmin'
mode: 0644 mode: '0644'

View File

@@ -6,7 +6,7 @@
dest: "/etc/mysql/mariadb.conf.d/50-server.cnf" dest: "/etc/mysql/mariadb.conf.d/50-server.cnf"
owner: root owner: root
group: root group: root
mode: 0644 #-rw-r--r-- mode: '0644' #-rw-r--r--
notify: restart mariadb # Only runs if file changed! notify: restart mariadb # Only runs if file changed!
# Set MySQL options defined in OpenNebula docs # Set MySQL options defined in OpenNebula docs

View File

@@ -6,5 +6,5 @@
dest: "/etc/redis/redis.conf" dest: "/etc/redis/redis.conf"
owner: root owner: root
group: root group: root
mode: 0644 # -rw-r--r-- mode: '0644' # -rw-r--r--
notify: restart redis # Only runs if file changed! notify: restart redis # Only runs if file changed!

View File

@@ -10,7 +10,7 @@
dest: "/etc/one/oned.conf" dest: "/etc/one/oned.conf"
owner: root owner: root
group: root group: root
mode: 0644 #-rw-r--r-- mode: '0644' #-rw-r--r--
notify: restart opennebula notify: restart opennebula
# Override sunstone CSS # Override sunstone CSS
@@ -20,7 +20,7 @@
dest: '/usr/lib/one/sunstone/public/css/custom.css' dest: '/usr/lib/one/sunstone/public/css/custom.css'
owner: 'oneadmin' owner: 'oneadmin'
group: 'oneadmin' group: 'oneadmin'
mode: 0644 mode: '0644'
notify: restart sunstone notify: restart sunstone
# Set oneadmin password (not linux password, but OpenNebula software password) # Set oneadmin password (not linux password, but OpenNebula software password)
@@ -45,7 +45,7 @@
dest: '/var/lib/one/.ssh/config' dest: '/var/lib/one/.ssh/config'
owner: 'oneadmin' owner: 'oneadmin'
group: 'oneadmin' group: 'oneadmin'
mode: 0644 mode: '0644'
# Authorize oneadmin user to SSH into itself # Authorize oneadmin user to SSH into itself
- name: Authorizing SSH keys for oneadmin - name: Authorizing SSH keys for oneadmin
@@ -62,7 +62,7 @@
dest: '/var/lib/one/.ssh/id_rsa.pub' dest: '/var/lib/one/.ssh/id_rsa.pub'
owner: 'oneadmin' owner: 'oneadmin'
group: 'oneadmin' group: 'oneadmin'
mode: 0644 mode: '0644'
# Create oneadmin private key # Create oneadmin private key
- name: Copying oneadmin SSH private key - name: Copying oneadmin SSH private key
@@ -71,4 +71,4 @@
dest: '/var/lib/one/.ssh/id_rsa' dest: '/var/lib/one/.ssh/id_rsa'
owner: 'oneadmin' owner: 'oneadmin'
group: 'oneadmin' group: 'oneadmin'
mode: 0600 mode: '0600'

View File

@@ -24,7 +24,7 @@
dest: /var/lib/one/.ssh/id_rsa.pub dest: /var/lib/one/.ssh/id_rsa.pub
owner: oneadmin owner: oneadmin
group: oneadmin group: oneadmin
mode: 0644 mode: '0644'
- name: Copying oneadmin SSH private key - name: Copying oneadmin SSH private key
copy: copy:
@@ -32,7 +32,7 @@
dest: /var/lib/one/.ssh/id_rsa dest: /var/lib/one/.ssh/id_rsa
owner: oneadmin owner: oneadmin
group: oneadmin group: oneadmin
mode: 0600 mode: '0600'
# Authorize oneadmin to SSH to self # Authorize oneadmin to SSH to self
- name: Authorizing oneadmin SSH keys - name: Authorizing oneadmin SSH keys

View File

@@ -38,7 +38,7 @@
dest: '/var/lib/one/.ssh/config' dest: '/var/lib/one/.ssh/config'
owner: 'oneadmin' owner: 'oneadmin'
group: 'oneadmin' group: 'oneadmin'
mode: 0644 mode: '0644'
# Authorize oneadmin user to SSH into itself # Authorize oneadmin user to SSH into itself
- name: Authorizing SSH keys for oneadmin - name: Authorizing SSH keys for oneadmin
@@ -55,7 +55,7 @@
dest: '/var/lib/one/.ssh/id_rsa.pub' dest: '/var/lib/one/.ssh/id_rsa.pub'
owner: 'oneadmin' owner: 'oneadmin'
group: 'oneadmin' group: 'oneadmin'
mode: 0644 mode: '0644'
# Create oneadmin private key # Create oneadmin private key
- name: Copying oneadmin SSH private key - name: Copying oneadmin SSH private key
@@ -64,7 +64,7 @@
dest: '/var/lib/one/.ssh/id_rsa' dest: '/var/lib/one/.ssh/id_rsa'
owner: 'oneadmin' owner: 'oneadmin'
group: 'oneadmin' group: 'oneadmin'
mode: 0600 mode: '0600'
# Copy libvirt.conf # Copy libvirt.conf
- name: Copying /etc/libvirt/libvirt.conf - name: Copying /etc/libvirt/libvirt.conf
@@ -73,19 +73,11 @@
dest: /etc/libvirt/libvirt.conf dest: /etc/libvirt/libvirt.conf
owner: root owner: root
group: root group: root
mode: 0644 mode: '0644'
notify: restart libvirtd # Only runs if file changed! notify: restart libvirtd # Only runs if file changed!
# Copy scripts to /usr/local/bin # Copy scripts to /usr/local/bin
- name: Copying scripts to /usr/local/bin - include_tasks: ../../../functions/copy_usr-local-bin.yml
template:
src: "{{ item }}"
dest: /usr/local/bin/
owner: toor
group: staff
mode: 0755
with_fileglob:
- files/bin/*
# Schedule cron # Schedule cron
- name: Scheduling cron cron-root-daily-12am - name: Scheduling cron cron-root-daily-12am

View File

@@ -60,4 +60,4 @@
dest: '/var/lib/one/.ssh/config' dest: '/var/lib/one/.ssh/config'
owner: 'oneadmin' owner: 'oneadmin'
group: 'oneadmin' group: 'oneadmin'
mode: 0644 mode: '0644'

View File

@@ -54,4 +54,4 @@
dest: '/var/lib/one/.ssh/config' dest: '/var/lib/one/.ssh/config'
owner: 'oneadmin' owner: 'oneadmin'
group: 'oneadmin' group: 'oneadmin'
mode: 0644 mode: '0644'

View File

@@ -13,7 +13,7 @@
dest: /etc/rsyslog.conf dest: /etc/rsyslog.conf
owner: root owner: root
group: root group: root
mode: 0644 # -rw-r--r-- mode: '0644' # -rw-r--r--
notify: restart rsyslog notify: restart rsyslog
# Copy /etc/rsyslog.d/49-haproxy.conf # Copy /etc/rsyslog.d/49-haproxy.conf
@@ -24,16 +24,8 @@
dest: /etc/rsyslog.d/49-haproxy.conf dest: /etc/rsyslog.d/49-haproxy.conf
owner: root owner: root
group: root group: root
mode: 0644 # -rw-r--r-- mode: '0644' # -rw-r--r--
notify: restart rsyslog notify: restart rsyslog
# Copy scripts to /usr/local/bin # Copy scripts to /usr/local/bin
- name: Copying scripts to /usr/local/bin - include_tasks: ../../../functions/copy_usr-local-bin.yml
copy:
src: "{{ item }}"
dest: /usr/local/bin/
owner: toor
group: staff
mode: 0775
with_fileglob:
- bin/*

View File

@@ -22,4 +22,4 @@ cat $log_src \
> $log_dest > $log_dest
chown toor:toor $log_dest chown {{ superuser }}:{{ superuser }} $log_dest