From 200680e7c8cbd6b4426c3ce232568b1e06446bde Mon Sep 17 00:00:00 2001 From: boom2 Date: Thu, 21 Dec 2023 15:49:16 -0500 Subject: - renamed playbook to follow convention -- add /etc/rc.d/rc.M in 'fetch file playbook' for future clamav playbook --- .../system/12-playbook-replace-text.yml | 42 ++ ansible-practice/system/12-replace-text.yml | 42 -- ansible-practice/system/13-create-update-user.yml | 42 -- .../system/13-playbook-create-update-user.yml | 42 ++ .../system/13_1-create-update-user-with-prompt.yml | 73 ---- ...3_1-playbook-create-update-user-with-prompt.yml | 73 ++++ .../13_2-create-update-user-authorized_key.yml | 29 -- ...-playbook-create-update-user-authorized_key.yml | 29 ++ .../system/14-playbook-verify-user.yml | 31 ++ ansible-practice/system/14-verify-user.yml | 31 -- ansible-practice/system/15-fetch-file.yml | 48 --- ansible-practice/system/15-playbook-fetch-file.yml | 49 +++ .../system/16-playbook-test-slackware-version.yml | 52 +++ .../system/16-test-slackware-version.yml | 52 --- .../system/17-playbook-slackbuild-rsync-repo.yml | 92 +++++ .../system/17-rsync-slackbuilds-repo.yml | 92 ----- .../system/192.168.0.220/etc/rc.d/rc.M | 423 +++++++++++++++++++++ 17 files changed, 833 insertions(+), 409 deletions(-) create mode 100644 ansible-practice/system/12-playbook-replace-text.yml delete mode 100644 ansible-practice/system/12-replace-text.yml delete mode 100644 ansible-practice/system/13-create-update-user.yml create mode 100644 ansible-practice/system/13-playbook-create-update-user.yml delete mode 100644 ansible-practice/system/13_1-create-update-user-with-prompt.yml create mode 100644 ansible-practice/system/13_1-playbook-create-update-user-with-prompt.yml delete mode 100644 ansible-practice/system/13_2-create-update-user-authorized_key.yml create mode 100644 ansible-practice/system/13_2-playbook-create-update-user-authorized_key.yml create mode 100644 ansible-practice/system/14-playbook-verify-user.yml delete mode 100644 ansible-practice/system/14-verify-user.yml delete mode 100644 ansible-practice/system/15-fetch-file.yml create mode 100644 ansible-practice/system/15-playbook-fetch-file.yml create mode 100644 ansible-practice/system/16-playbook-test-slackware-version.yml delete mode 100644 ansible-practice/system/16-test-slackware-version.yml create mode 100644 ansible-practice/system/17-playbook-slackbuild-rsync-repo.yml delete mode 100644 ansible-practice/system/17-rsync-slackbuilds-repo.yml create mode 100644 ansible-practice/system/192.168.0.220/etc/rc.d/rc.M (limited to 'ansible-practice') diff --git a/ansible-practice/system/12-playbook-replace-text.yml b/ansible-practice/system/12-playbook-replace-text.yml new file mode 100644 index 0000000..4ae07a6 --- /dev/null +++ b/ansible-practice/system/12-playbook-replace-text.yml @@ -0,0 +1,42 @@ +# +# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/replace_module.html +# +--- +- name: "12 - custom ansible - replace text" + hosts: dev + tasks: + - name: update slackpg blacklist - blacklist kernels + ansible.builtin.replace: + path: "{{ backup_etc_dir }}/blacklist" + regexp: '#kernel' + replace: 'kernel' + tags: ['slackpkg_blacklist_kernels'] + + - name: update slackpg blacklist - blacklist SBo packages + ansible.builtin.replace: + path: "{{ backup_etc_dir }}/blacklist" + regexp: '#\[0-9\]' + replace: '[0-9]' + tags: ['slackpkg_blacklist_sbo'] + + # this will add a line to a file if it does not exist !! + - name: update slackpg blacklist - blacklist alienbob packages + ansible.builtin.lineinfile: + path: "{{ backup_etc_dir }}/blacklist" + search_string: '\[0-9\]\+alien' + line: '[0-9]+alien' + tags: ['slackpkg_blacklist_alien'] + + - name: update slackpg blacklist - blacklist sbopkg packages + ansible.builtin.lineinfile: + path: "{{ backup_etc_dir }}/blacklist" + search_string: 'sbopkg' + line: 'sbopkg' + tags: ['slackpkg_blacklist_sbopkg'] + + - name: update slackpg blacklist - blacklist kde packages + ansible.builtin.lineinfile: + path: "{{ backup_etc_dir }}/blacklist" + search_string: 'kde\/' + line: 'kde/' + tags: ['slackpkg_blacklist_kde'] diff --git a/ansible-practice/system/12-replace-text.yml b/ansible-practice/system/12-replace-text.yml deleted file mode 100644 index 4ae07a6..0000000 --- a/ansible-practice/system/12-replace-text.yml +++ /dev/null @@ -1,42 +0,0 @@ -# -# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/replace_module.html -# ---- -- name: "12 - custom ansible - replace text" - hosts: dev - tasks: - - name: update slackpg blacklist - blacklist kernels - ansible.builtin.replace: - path: "{{ backup_etc_dir }}/blacklist" - regexp: '#kernel' - replace: 'kernel' - tags: ['slackpkg_blacklist_kernels'] - - - name: update slackpg blacklist - blacklist SBo packages - ansible.builtin.replace: - path: "{{ backup_etc_dir }}/blacklist" - regexp: '#\[0-9\]' - replace: '[0-9]' - tags: ['slackpkg_blacklist_sbo'] - - # this will add a line to a file if it does not exist !! - - name: update slackpg blacklist - blacklist alienbob packages - ansible.builtin.lineinfile: - path: "{{ backup_etc_dir }}/blacklist" - search_string: '\[0-9\]\+alien' - line: '[0-9]+alien' - tags: ['slackpkg_blacklist_alien'] - - - name: update slackpg blacklist - blacklist sbopkg packages - ansible.builtin.lineinfile: - path: "{{ backup_etc_dir }}/blacklist" - search_string: 'sbopkg' - line: 'sbopkg' - tags: ['slackpkg_blacklist_sbopkg'] - - - name: update slackpg blacklist - blacklist kde packages - ansible.builtin.lineinfile: - path: "{{ backup_etc_dir }}/blacklist" - search_string: 'kde\/' - line: 'kde/' - tags: ['slackpkg_blacklist_kde'] diff --git a/ansible-practice/system/13-create-update-user.yml b/ansible-practice/system/13-create-update-user.yml deleted file mode 100644 index b00af34..0000000 --- a/ansible-practice/system/13-create-update-user.yml +++ /dev/null @@ -1,42 +0,0 @@ -# -# https://www.howtouselinux.com/post/create-user-with-ansible -# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html -# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html -# https://docs.ansible.com/ansible/latest/collections/community/crypto/openssh_keypair_module.html -# https://www.codesandnotes.be/2020/01/13/generate-ssh-keys-using-ansible/ -# ---- -- name: "13 - custom ansible - create/update user" - hosts: dev - become: yes # Run tasks with root/sudo privileges - vars: - username: testuser1 - password: mypassword - passphrase: one two three - - tasks: - - name: create user - ansible.builtin.user: - name: "{{ username }}" - password: "{{ password | password_hash('sha512') }}" # encrypted password - state: present # ensure the user is present - createhome: true # create the users home directory - shell: /bin/bash - group: users # slackware default - groups: audio,cdrom,floppy,input,lp,netdev,plugdev,power,scanner,video,wheel - generate_ssh_key: true - ssh_key_type: ed25519 - ssh_key_passphrase: "{{ passphrase }}" - -# -# received the following when running this playbook: -# -# TASK [create user] ************************************************* -# -# [DEPRECATION WARNING]: Encryption using the Python crypt module is -# deprecated. The Python crypt module is deprecated and will be removed -# from Python 3.13. Install the passlib library for continued encryption -# functionality. This feature will be removed in version -# 2.17. Deprecation warnings can be disabled by setting -# deprecation_warnings=False in ansible.cfg. -# diff --git a/ansible-practice/system/13-playbook-create-update-user.yml b/ansible-practice/system/13-playbook-create-update-user.yml new file mode 100644 index 0000000..b00af34 --- /dev/null +++ b/ansible-practice/system/13-playbook-create-update-user.yml @@ -0,0 +1,42 @@ +# +# https://www.howtouselinux.com/post/create-user-with-ansible +# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html +# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html +# https://docs.ansible.com/ansible/latest/collections/community/crypto/openssh_keypair_module.html +# https://www.codesandnotes.be/2020/01/13/generate-ssh-keys-using-ansible/ +# +--- +- name: "13 - custom ansible - create/update user" + hosts: dev + become: yes # Run tasks with root/sudo privileges + vars: + username: testuser1 + password: mypassword + passphrase: one two three + + tasks: + - name: create user + ansible.builtin.user: + name: "{{ username }}" + password: "{{ password | password_hash('sha512') }}" # encrypted password + state: present # ensure the user is present + createhome: true # create the users home directory + shell: /bin/bash + group: users # slackware default + groups: audio,cdrom,floppy,input,lp,netdev,plugdev,power,scanner,video,wheel + generate_ssh_key: true + ssh_key_type: ed25519 + ssh_key_passphrase: "{{ passphrase }}" + +# +# received the following when running this playbook: +# +# TASK [create user] ************************************************* +# +# [DEPRECATION WARNING]: Encryption using the Python crypt module is +# deprecated. The Python crypt module is deprecated and will be removed +# from Python 3.13. Install the passlib library for continued encryption +# functionality. This feature will be removed in version +# 2.17. Deprecation warnings can be disabled by setting +# deprecation_warnings=False in ansible.cfg. +# diff --git a/ansible-practice/system/13_1-create-update-user-with-prompt.yml b/ansible-practice/system/13_1-create-update-user-with-prompt.yml deleted file mode 100644 index 5b16906..0000000 --- a/ansible-practice/system/13_1-create-update-user-with-prompt.yml +++ /dev/null @@ -1,73 +0,0 @@ -# -# https://www.howtouselinux.com/post/create-user-with-ansible -# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html -# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html -# https://docs.ansible.com/ansible/latest/collections/community/crypto/openssh_keypair_module.html -# https://www.codesandnotes.be/2020/01/13/generate-ssh-keys-using-ansible/ -# https://docs.ansible.com/ansible/latest/collections/ansible/posix/authorized_key_module.html -# -# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html -# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/find_module.html -# -# https://stackoverflow.com/questions/4411457/how-do-i-verify-check-test-validate-my-ssh-passphrase -# -# - an issue i found while trying to update a user's ssh key -# - although the docs state that this can be done...it did not work for me ! -# - the only thing that worked was to remove previous keys and then add new ones -# -# ---- -- name: "13.1 -- custom ansible - create/update user with a prompt" - hosts: dev - become: yes # Run tasks with root/sudo privileges - vars: - username: testuser1 - - vars_prompt: - - name: "passphrase" - prompt: "enter the passphrase for the ssh key" - - tasks: -# - name: backup users ssh keys -# ansible.builtin.shell: | -# sudo mv /home/{{ username }}/.ssh/id_ed25519 /home/{{ username }}/.ssh/id_ed25519_BAK -# mv /home/{{ username }}/.ssh/id_ed25519.pub /home/{{ username }}/.ssh/id_ed25519.pub_BAK -# exit 0 -# tags: ['backup_ssh_files'] - - - name: find files to delete w/ wildcard - ansible.builtin.find: - path: /home/{{ username }}/.ssh - patterns: 'id_ed25519*' - register: ssh_keys - - - name: remove users ssh keys - ansible.builtin.file: - path: "{{ item.path }}" - state: absent - with_items: "{{ ssh_keys.files }}" - tags: ['remove_ssh_files'] - - - name: update user - ansible.builtin.user: - name: "{{ username }}" - state: present # ensure the user is present - generate_ssh_key: true - force: true - ssh_key_type: ed25519 - ssh_key_passphrase: "{{ passphrase }}" - ssh_key_file: .ssh/id_ed25519 - tags: ['update_user'] - -# -# received the following when running this playbook: -# -# TASK [create user] ************************************************* -# -# [DEPRECATION WARNING]: Encryption using the Python crypt module is -# deprecated. The Python crypt module is deprecated and will be removed -# from Python 3.13. Install the passlib library for continued encryption -# functionality. This feature will be removed in version -# 2.17. Deprecation warnings can be disabled by setting -# deprecation_warnings=False in ansible.cfg. -# diff --git a/ansible-practice/system/13_1-playbook-create-update-user-with-prompt.yml b/ansible-practice/system/13_1-playbook-create-update-user-with-prompt.yml new file mode 100644 index 0000000..5b16906 --- /dev/null +++ b/ansible-practice/system/13_1-playbook-create-update-user-with-prompt.yml @@ -0,0 +1,73 @@ +# +# https://www.howtouselinux.com/post/create-user-with-ansible +# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html +# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html +# https://docs.ansible.com/ansible/latest/collections/community/crypto/openssh_keypair_module.html +# https://www.codesandnotes.be/2020/01/13/generate-ssh-keys-using-ansible/ +# https://docs.ansible.com/ansible/latest/collections/ansible/posix/authorized_key_module.html +# +# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html +# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/find_module.html +# +# https://stackoverflow.com/questions/4411457/how-do-i-verify-check-test-validate-my-ssh-passphrase +# +# - an issue i found while trying to update a user's ssh key +# - although the docs state that this can be done...it did not work for me ! +# - the only thing that worked was to remove previous keys and then add new ones +# +# +--- +- name: "13.1 -- custom ansible - create/update user with a prompt" + hosts: dev + become: yes # Run tasks with root/sudo privileges + vars: + username: testuser1 + + vars_prompt: + - name: "passphrase" + prompt: "enter the passphrase for the ssh key" + + tasks: +# - name: backup users ssh keys +# ansible.builtin.shell: | +# sudo mv /home/{{ username }}/.ssh/id_ed25519 /home/{{ username }}/.ssh/id_ed25519_BAK +# mv /home/{{ username }}/.ssh/id_ed25519.pub /home/{{ username }}/.ssh/id_ed25519.pub_BAK +# exit 0 +# tags: ['backup_ssh_files'] + + - name: find files to delete w/ wildcard + ansible.builtin.find: + path: /home/{{ username }}/.ssh + patterns: 'id_ed25519*' + register: ssh_keys + + - name: remove users ssh keys + ansible.builtin.file: + path: "{{ item.path }}" + state: absent + with_items: "{{ ssh_keys.files }}" + tags: ['remove_ssh_files'] + + - name: update user + ansible.builtin.user: + name: "{{ username }}" + state: present # ensure the user is present + generate_ssh_key: true + force: true + ssh_key_type: ed25519 + ssh_key_passphrase: "{{ passphrase }}" + ssh_key_file: .ssh/id_ed25519 + tags: ['update_user'] + +# +# received the following when running this playbook: +# +# TASK [create user] ************************************************* +# +# [DEPRECATION WARNING]: Encryption using the Python crypt module is +# deprecated. The Python crypt module is deprecated and will be removed +# from Python 3.13. Install the passlib library for continued encryption +# functionality. This feature will be removed in version +# 2.17. Deprecation warnings can be disabled by setting +# deprecation_warnings=False in ansible.cfg. +# diff --git a/ansible-practice/system/13_2-create-update-user-authorized_key.yml b/ansible-practice/system/13_2-create-update-user-authorized_key.yml deleted file mode 100644 index c046fe9..0000000 --- a/ansible-practice/system/13_2-create-update-user-authorized_key.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# https://www.codesandnotes.be/2020/01/13/generate-ssh-keys-using-ansible/ -# https://docs.ansible.com/ansible/latest/collections/ansible/posix/authorized_key_module.html -# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_lookups.html -# -# - i couldnt really understand why we would use this module 'after' we created the -# 'testuser' w/ an ssh key. -# -# tldr; you don't !!!! -# -# - the correct way to use this is if u have a list of users and their public keys -# stored on the controller node. then when you create a managed node -# you can loop thru creating new users on it and add their public keys to that -# new node in a playbook. -# ---- -- name: "13.2 -- custom ansible - create/update user with a prompt" - hosts: dev - become: yes # Run tasks with root/sudo privileges - vars: - username: testuser1 - ssh_path: "keys/{{ username }}/id_ed25519.pub" - - tasks: - - name: set authorized key taken from file - ansible.posix.authorized_key: - user: "{{ username }}" - state: present # ensure the user is present - key: "{{ lookup('file', ssh_path) }}" diff --git a/ansible-practice/system/13_2-playbook-create-update-user-authorized_key.yml b/ansible-practice/system/13_2-playbook-create-update-user-authorized_key.yml new file mode 100644 index 0000000..c046fe9 --- /dev/null +++ b/ansible-practice/system/13_2-playbook-create-update-user-authorized_key.yml @@ -0,0 +1,29 @@ +# +# https://www.codesandnotes.be/2020/01/13/generate-ssh-keys-using-ansible/ +# https://docs.ansible.com/ansible/latest/collections/ansible/posix/authorized_key_module.html +# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_lookups.html +# +# - i couldnt really understand why we would use this module 'after' we created the +# 'testuser' w/ an ssh key. +# +# tldr; you don't !!!! +# +# - the correct way to use this is if u have a list of users and their public keys +# stored on the controller node. then when you create a managed node +# you can loop thru creating new users on it and add their public keys to that +# new node in a playbook. +# +--- +- name: "13.2 -- custom ansible - create/update user with a prompt" + hosts: dev + become: yes # Run tasks with root/sudo privileges + vars: + username: testuser1 + ssh_path: "keys/{{ username }}/id_ed25519.pub" + + tasks: + - name: set authorized key taken from file + ansible.posix.authorized_key: + user: "{{ username }}" + state: present # ensure the user is present + key: "{{ lookup('file', ssh_path) }}" diff --git a/ansible-practice/system/14-playbook-verify-user.yml b/ansible-practice/system/14-playbook-verify-user.yml new file mode 100644 index 0000000..f617843 --- /dev/null +++ b/ansible-practice/system/14-playbook-verify-user.yml @@ -0,0 +1,31 @@ +# +# https://www.howtouselinux.com/post/create-user-with-ansible +# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html +# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html +# +--- +- name: "14 - custom ansible - verify user" + hosts: dev + become: yes # Run tasks with root/sudo privileges + vars: + username: testuser1 + + tasks: + - name: check if user exists + ansible.builtin.command: id {{ username }} +# ansible.builtin.shell: id {{ username }} + register: user_check + ignore_errors: true + + - name: display user information + ansible.builtin.debug: + msg: user '{{ username }}' exists ! + when: user_check.rc == 0 + tags: ['user_exists'] + + - name: display error message if user does not exist + ansible.builtin.debug: + msg: user '{{ username }}' does not exist ! + when: user_check.rc != 0 + tags: ['user_does_not_exist'] + diff --git a/ansible-practice/system/14-verify-user.yml b/ansible-practice/system/14-verify-user.yml deleted file mode 100644 index f617843..0000000 --- a/ansible-practice/system/14-verify-user.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# https://www.howtouselinux.com/post/create-user-with-ansible -# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html -# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html -# ---- -- name: "14 - custom ansible - verify user" - hosts: dev - become: yes # Run tasks with root/sudo privileges - vars: - username: testuser1 - - tasks: - - name: check if user exists - ansible.builtin.command: id {{ username }} -# ansible.builtin.shell: id {{ username }} - register: user_check - ignore_errors: true - - - name: display user information - ansible.builtin.debug: - msg: user '{{ username }}' exists ! - when: user_check.rc == 0 - tags: ['user_exists'] - - - name: display error message if user does not exist - ansible.builtin.debug: - msg: user '{{ username }}' does not exist ! - when: user_check.rc != 0 - tags: ['user_does_not_exist'] - diff --git a/ansible-practice/system/15-fetch-file.yml b/ansible-practice/system/15-fetch-file.yml deleted file mode 100644 index 0236efe..0000000 --- a/ansible-practice/system/15-fetch-file.yml +++ /dev/null @@ -1,48 +0,0 @@ -# fetch/download a file(s) from managed nodes to the controller node -# -# - use cases: -# - pulling log files -# - grabbing public keys -# -# ---- -- name: "15 - custom ansible - fetch file" - hosts: dev - become: yes # Run tasks with root/sudo privileges - vars: - sys_file_list: - - /etc/rc.d/rc.firewall - - /etc/ssh/sshd_config - -# -# - playing w/ loops as well -# - tasks: - - name: pull sshd & firewall configs - ansible.builtin.fetch: - src: "{{ item }}" - dest: ~/repos/ansible_repo/ansible-practice/system/ - loop: "{{ sys_file_list }}" - tags: ['fetch_sys_configs'] - -# -# - essentially, the same code as above except done one task at a time -# -# - name: pull sshd config -# ansible.builtin.fetch: -# src: /etc/ssh/sshd_config -# dest: ~/repos/ansible_repo/ansible-practice/system/ -# tags: ['fetch_sshd_config'] -# -# - name: pull firewall config -# ansible.builtin.fetch: -# src: /etc/rc.d/rc.firewall -# dest: ~/repos/ansible_repo/ansible-practice/system/ -# tags: ['fetch_firewall_config'] -# - -# References -# -# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/fetch_module.html -# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html -# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#list-variables diff --git a/ansible-practice/system/15-playbook-fetch-file.yml b/ansible-practice/system/15-playbook-fetch-file.yml new file mode 100644 index 0000000..6d93219 --- /dev/null +++ b/ansible-practice/system/15-playbook-fetch-file.yml @@ -0,0 +1,49 @@ +# fetch/download a file(s) from managed nodes to the controller node +# +# - use cases: +# - pulling log files +# - grabbing public keys +# +# +--- +- name: "15 - custom ansible - fetch file" + hosts: dev + become: yes # Run tasks with root/sudo privileges + vars: + sys_file_list: + - /etc/rc.d/rc.firewall + - /etc/rc.d/rc.M + - /etc/ssh/sshd_config + +# +# - playing w/ loops as well +# + tasks: + - name: pull sshd & firewall configs + ansible.builtin.fetch: + src: "{{ item }}" + dest: ~/repos/ansible_repo/ansible-practice/system/ + loop: "{{ sys_file_list }}" + tags: ['fetch_sys_configs'] + +# +# - essentially, the same code as above except done one task at a time +# +# - name: pull sshd config +# ansible.builtin.fetch: +# src: /etc/ssh/sshd_config +# dest: ~/repos/ansible_repo/ansible-practice/system/ +# tags: ['fetch_sshd_config'] +# +# - name: pull firewall config +# ansible.builtin.fetch: +# src: /etc/rc.d/rc.firewall +# dest: ~/repos/ansible_repo/ansible-practice/system/ +# tags: ['fetch_firewall_config'] +# + +# References +# +# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/fetch_module.html +# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html +# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#list-variables diff --git a/ansible-practice/system/16-playbook-test-slackware-version.yml b/ansible-practice/system/16-playbook-test-slackware-version.yml new file mode 100644 index 0000000..ed19c03 --- /dev/null +++ b/ansible-practice/system/16-playbook-test-slackware-version.yml @@ -0,0 +1,52 @@ +# test slackware version on host w/ conditonals +# +# - use cases: +# - set conditions depending on the version +# +--- +- name: "16 - custom ansible - test slackware version" + hosts: dev + + tasks: + - name: Print os info + ansible.builtin.debug: + msg: + - "distro = {{ ansible_distribution }}" + - "distro major version = {{ ansible_distribution_major_version }}" + - "distro release = {{ ansible_distribution_release }}" + - "distro version = {{ ansible_distribution_version }}" + + - name: is os version '-current' + ansible.builtin.debug: + msg: this slackware distro is '-current ! + when: + - ansible_facts['distribution'] == "Slackware" + - ansible_facts['distribution_release'] == "current" + tags: ['is_current'] + + - name: os version is not '-current' + ansible.builtin.debug: + msg: this slackware distro is NOT '-current ! + when: + - ansible_facts['distribution'] == "Slackware" + - ansible_facts['distribution_release'] != "current" + tags: ['is_not_current'] + + +# "ansible_distribution": "Slackware", +# "ansible_distribution_major_version": "15", +# "ansible_distribution_release": "current", +# "ansible_distribution_version": "15.0+", +# +# +# "ansible_distribution": "Slackware", +# "ansible_distribution_major_version": "15", +# "ansible_distribution_release": "stable", +# "ansible_distribution_version": "15.0", + + +# References +# +# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html +# +# diff --git a/ansible-practice/system/16-test-slackware-version.yml b/ansible-practice/system/16-test-slackware-version.yml deleted file mode 100644 index ed19c03..0000000 --- a/ansible-practice/system/16-test-slackware-version.yml +++ /dev/null @@ -1,52 +0,0 @@ -# test slackware version on host w/ conditonals -# -# - use cases: -# - set conditions depending on the version -# ---- -- name: "16 - custom ansible - test slackware version" - hosts: dev - - tasks: - - name: Print os info - ansible.builtin.debug: - msg: - - "distro = {{ ansible_distribution }}" - - "distro major version = {{ ansible_distribution_major_version }}" - - "distro release = {{ ansible_distribution_release }}" - - "distro version = {{ ansible_distribution_version }}" - - - name: is os version '-current' - ansible.builtin.debug: - msg: this slackware distro is '-current ! - when: - - ansible_facts['distribution'] == "Slackware" - - ansible_facts['distribution_release'] == "current" - tags: ['is_current'] - - - name: os version is not '-current' - ansible.builtin.debug: - msg: this slackware distro is NOT '-current ! - when: - - ansible_facts['distribution'] == "Slackware" - - ansible_facts['distribution_release'] != "current" - tags: ['is_not_current'] - - -# "ansible_distribution": "Slackware", -# "ansible_distribution_major_version": "15", -# "ansible_distribution_release": "current", -# "ansible_distribution_version": "15.0+", -# -# -# "ansible_distribution": "Slackware", -# "ansible_distribution_major_version": "15", -# "ansible_distribution_release": "stable", -# "ansible_distribution_version": "15.0", - - -# References -# -# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html -# -# diff --git a/ansible-practice/system/17-playbook-slackbuild-rsync-repo.yml b/ansible-practice/system/17-playbook-slackbuild-rsync-repo.yml new file mode 100644 index 0000000..597d8c0 --- /dev/null +++ b/ansible-practice/system/17-playbook-slackbuild-rsync-repo.yml @@ -0,0 +1,92 @@ +# rsync slackbuilds repo +# +# - use cases: +# - get slackware hosts slackbuilds repo up-to-date +# +--- +- name: "17 - custom ansible - rsync slackbuilds repo" + become: yes # Run tasks with root/sudo privileges + hosts: dev + vars: + sbopkg_command: /usr/sbin/sbopkg + sbopkg_config: /etc/sbopkg/sbopkg.conf + + tasks: + - name: fail - if not a slackware host ! + ansible.builtin.fail: + msg: this host is not running Slackware + when: ansible_facts['distribution'] != "Slackware" + tags: ['test_slackware_host'] + + - name: "test - to see if '{{ sbopkg_command }}' exists" + ansible.builtin.stat: + path: "{{ sbopkg_command }}" + register: usr_sbin_sbopkg + tags: ['register_usr_sbin_sbopkg'] + + - name: "fail - if the '{{ sbopkg_command }}' command does not exist !" + ansible.builtin.fail: + msg: "this host does not have {{ sbopkg_command }} installed" + when: usr_sbin_sbopkg.stat.isreg is not defined + tags: ['test_sbopkg_exists'] + + - name: "test - to see if '{{ sbopkg_config }}' exists" + ansible.builtin.stat: + path: "{{ sbopkg_config }}" + register: etc_sbopkg_sbopkg_conf + tags: ['register_etc_sbopkg_sbopkg_conf'] + + - name: "fail - if '{{ sbopkg_config }}' does not exist !" + ansible.builtin.fail: + msg: "this host does not have {{ sbopkg_config }}" + when: etc_sbopkg_sbopkg_conf.stat.isreg is not defined + tags: ['test_sbopkg_conf_exists'] + + - name: "retrieve - the REPO_ROOT and REPO_NAME from {{ sbopkg_config }}" + ansible.builtin.shell: "grep -E '^REPO_ROOT|^REPO_NAME*' {{ sbopkg_config }} | cut -d ':' -f 2 | cut -c2- | rev | cut -c2- | rev | tr '\n' '/' | sed 's/.$//'" + register: sbopkg_conf_contents + when: usr_sbin_sbopkg.stat.isdir is defined + tags: ['get_repo_contents'] + + - name: remove - the sbopkg repo directory (when on a slackware-current host) + ansible.builtin.file: + path: "{{ sbopkg_conf_contents.stdout }}" + state: absent + when: ansible_facts['distribution_release'] == "current" + tags: ['delete_repo'] + + - name: "execute - rsync of our sbopkg repo inside of {{ sbopkg_conf_contents.stdout }} !" + ansible.builtin.shell: "{{ sbopkg_command }} -r" + tags: ['rsync_sbopkg'] + + +# - name: debugging info: reporting if sbopkg_conf_contents exists +# ansible.builtin.debug: +# msg: "{{ sbopkg_conf_contents.stdout }}" +# when: +# - sbopkg_conf_contents.stdout != "" +# tags: ['repo_recon2'] + +# - if our directory exists and it ends w/ -git remove it !! +# - name: remove if using -current repo +# ansible.builtin.debug: +# msg: "{{ sbopkg_conf_dir.stat }} is a directory" +# when: +# - sbopkg_conf_dir.stat.isdir is defined +# tags: ['repo_recon3'] + +# - if our directory exists and it ends w/ -git remove it !! +# - name: if on slackware-current: remove the sbopkg repo directory +# ansible.builtin.shell: rm -rf /var/lib/sbopkg/SBo-git +# when: +# - ansible_facts['distribution'] == "Slackware" +# - ansible_facts['distribution_release'] == "current" +# - sbopkg_conf_dir.stat.isdir is defined +# tags: ['delete_repo'] + +# References +# +# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html +# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/fail_module.html +# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/stat_module.html +# diff --git a/ansible-practice/system/17-rsync-slackbuilds-repo.yml b/ansible-practice/system/17-rsync-slackbuilds-repo.yml deleted file mode 100644 index 597d8c0..0000000 --- a/ansible-practice/system/17-rsync-slackbuilds-repo.yml +++ /dev/null @@ -1,92 +0,0 @@ -# rsync slackbuilds repo -# -# - use cases: -# - get slackware hosts slackbuilds repo up-to-date -# ---- -- name: "17 - custom ansible - rsync slackbuilds repo" - become: yes # Run tasks with root/sudo privileges - hosts: dev - vars: - sbopkg_command: /usr/sbin/sbopkg - sbopkg_config: /etc/sbopkg/sbopkg.conf - - tasks: - - name: fail - if not a slackware host ! - ansible.builtin.fail: - msg: this host is not running Slackware - when: ansible_facts['distribution'] != "Slackware" - tags: ['test_slackware_host'] - - - name: "test - to see if '{{ sbopkg_command }}' exists" - ansible.builtin.stat: - path: "{{ sbopkg_command }}" - register: usr_sbin_sbopkg - tags: ['register_usr_sbin_sbopkg'] - - - name: "fail - if the '{{ sbopkg_command }}' command does not exist !" - ansible.builtin.fail: - msg: "this host does not have {{ sbopkg_command }} installed" - when: usr_sbin_sbopkg.stat.isreg is not defined - tags: ['test_sbopkg_exists'] - - - name: "test - to see if '{{ sbopkg_config }}' exists" - ansible.builtin.stat: - path: "{{ sbopkg_config }}" - register: etc_sbopkg_sbopkg_conf - tags: ['register_etc_sbopkg_sbopkg_conf'] - - - name: "fail - if '{{ sbopkg_config }}' does not exist !" - ansible.builtin.fail: - msg: "this host does not have {{ sbopkg_config }}" - when: etc_sbopkg_sbopkg_conf.stat.isreg is not defined - tags: ['test_sbopkg_conf_exists'] - - - name: "retrieve - the REPO_ROOT and REPO_NAME from {{ sbopkg_config }}" - ansible.builtin.shell: "grep -E '^REPO_ROOT|^REPO_NAME*' {{ sbopkg_config }} | cut -d ':' -f 2 | cut -c2- | rev | cut -c2- | rev | tr '\n' '/' | sed 's/.$//'" - register: sbopkg_conf_contents - when: usr_sbin_sbopkg.stat.isdir is defined - tags: ['get_repo_contents'] - - - name: remove - the sbopkg repo directory (when on a slackware-current host) - ansible.builtin.file: - path: "{{ sbopkg_conf_contents.stdout }}" - state: absent - when: ansible_facts['distribution_release'] == "current" - tags: ['delete_repo'] - - - name: "execute - rsync of our sbopkg repo inside of {{ sbopkg_conf_contents.stdout }} !" - ansible.builtin.shell: "{{ sbopkg_command }} -r" - tags: ['rsync_sbopkg'] - - -# - name: debugging info: reporting if sbopkg_conf_contents exists -# ansible.builtin.debug: -# msg: "{{ sbopkg_conf_contents.stdout }}" -# when: -# - sbopkg_conf_contents.stdout != "" -# tags: ['repo_recon2'] - -# - if our directory exists and it ends w/ -git remove it !! -# - name: remove if using -current repo -# ansible.builtin.debug: -# msg: "{{ sbopkg_conf_dir.stat }} is a directory" -# when: -# - sbopkg_conf_dir.stat.isdir is defined -# tags: ['repo_recon3'] - -# - if our directory exists and it ends w/ -git remove it !! -# - name: if on slackware-current: remove the sbopkg repo directory -# ansible.builtin.shell: rm -rf /var/lib/sbopkg/SBo-git -# when: -# - ansible_facts['distribution'] == "Slackware" -# - ansible_facts['distribution_release'] == "current" -# - sbopkg_conf_dir.stat.isdir is defined -# tags: ['delete_repo'] - -# References -# -# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html -# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/fail_module.html -# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/stat_module.html -# diff --git a/ansible-practice/system/192.168.0.220/etc/rc.d/rc.M b/ansible-practice/system/192.168.0.220/etc/rc.d/rc.M new file mode 100644 index 0000000..a0d371d --- /dev/null +++ b/ansible-practice/system/192.168.0.220/etc/rc.d/rc.M @@ -0,0 +1,423 @@ +#!/bin/bash +# +# rc.M This file is executed by init(8) when the system is being +# initialized for one of the "multi user" run levels (i.e. +# levels 1 through 6). It usually does mounting of file +# systems et al. +# +# Version: @(#)/etc/rc.d/rc.M 15.0 Fri Nov 12 18:51:28 UTC 2021 +# +# Author: Fred N. van Kempen, +# Heavily modified by Patrick Volkerding +# + +# Tell the viewers what's going to happen. +echo "Going multiuser..." + +# If we are in an lxc container, set $container to skip parts of the script. +# Thanks to Matteo Bernardini and Chris Willing for +# the initial work making this script lxc compatible. +if grep -aq container=lxc /proc/1/environ 2> /dev/null ; then + container="lxc" +fi + +# Update all the shared library links: +if [ -x /sbin/ldconfig ]; then + echo "Updating shared library links: /sbin/ldconfig &" + /sbin/ldconfig & +fi + +# Call the setterm init script to set screen blanking and power management +# defaults: +if [ -x /etc/rc.d/rc.setterm -a -z "$container" ]; then + /etc/rc.d/rc.setterm +fi + +# Set the hostname: +if [ -z "$container" ]; then + if [ -r /etc/HOSTNAME ]; then + /bin/hostname $(cat /etc/HOSTNAME) + else + # fall back on this old default: + echo "darkstar.example.net" > /etc/HOSTNAME + /bin/hostname $(cat /etc/HOSTNAME) + fi +fi + +# Set the permissions on /var/log/dmesg according to whether the kernel +# permits non-root users to access kernel dmesg information: +if [ -r /proc/sys/kernel/dmesg_restrict ]; then + if [ $(cat /proc/sys/kernel/dmesg_restrict) = 1 ]; then + touch /var/log/dmesg + chmod 640 /var/log/dmesg + fi +else + touch /var/log/dmesg + chmod 644 /var/log/dmesg +fi +# Save the contents of 'dmesg': +/bin/dmesg -s 65536 > /var/log/dmesg + +# Initialize PCMCIA devices: +# +# NOTE: This used to be started near the top of rc.S so that PCMCIA devices +# could be fsck'ed along with the other drives. This had some unfortunate +# side effects, however, since root isn't yet read-write, and /var might not +# even be mounted the .pid files can't be correctly written in /var/run and +# the pcmcia system can't be correctly shut down. If you want some PCMCIA +# partition to be mounted at boot (or when the card is inserted) then add +# the appropriate lines to /etc/pcmcia/scsi.opts. +# +# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using +# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a +# wireless card you might need to set options in /etc/pcmcia OR in +# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with +# extra options if needed for the encryption key, ESSID, etc.) +# +# Hopefully this situation will be unified in the future, but for now +# that's how it is... +# +if [ -x /etc/rc.d/rc.pcmcia -a -z "$container" ]; then + /etc/rc.d/rc.pcmcia start + # The cards might need a little extra time here to initialize. + sleep 5 +fi + +# Start the system logger. +if [ -x /etc/rc.d/rc.syslog ]; then + /etc/rc.d/rc.syslog start +fi + +# Update the X font indexes: +if [ -x /usr/bin/fc-cache ]; then + echo "Updating X font indexes: /usr/bin/fc-cache -f &" + /usr/bin/fc-cache -f & +fi + +# Run rc.udev again. This will start udev if it is not already running +# (for example, upon return from runlevel 1), otherwise it will trigger it +# to look for device changes and to generate persistent rules if needed. +if grep -wq sysfs /proc/mounts && grep -q devtmpfs /proc/filesystems ; then + if ! grep -wq nohotplug /proc/cmdline ; then + if [ -x /etc/rc.d/rc.udev -a -z "$container" ]; then + /etc/rc.d/rc.udev start + fi + fi +fi + +# Start the haveged entropy daemon: +if [ -x /etc/rc.d/rc.haveged -a -z "$container" ]; then + /etc/rc.d/rc.haveged start +fi + +# Start the rngd entropy daemon: +if [ -x /etc/rc.d/rc.rngd -a -z "$container" ]; then + /etc/rc.d/rc.rngd start +fi + +# Initialize the networking hardware. +if [ -x /etc/rc.d/rc.inet1 ]; then + /etc/rc.d/rc.inet1 +fi + +# Start D-Bus: +if [ -x /etc/rc.d/rc.messagebus ]; then + /etc/rc.d/rc.messagebus start +fi + +# Start the session/seat daemon: +if [ -x /etc/rc.d/rc.elogind -a -x /bin/loginctl ]; then + /etc/rc.d/rc.elogind start +elif [ -x /etc/rc.d/rc.consolekit -a -x /usr/sbin/console-kit-daemon ]; then + /etc/rc.d/rc.consolekit start +fi + +# Start Bluetooth: +if [ -x /etc/rc.d/rc.bluetooth ]; then + /etc/rc.d/rc.bluetooth start +fi + +# Start wicd or networkmanager: +if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then + /etc/rc.d/rc.wicd start +elif [ -x /etc/rc.d/rc.networkmanager ]; then + /etc/rc.d/rc.networkmanager start +fi + +# Start networking daemons: +if [ -x /etc/rc.d/rc.inet2 ]; then + /etc/rc.d/rc.inet2 +fi + +# Mount any additional filesystem types that haven't already been mounted: +mount -a -v 2> /dev/null | grep -v -e "already mounted" -e "ignored" | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done + +# Start the Control Script for automounter: +if [ -x /etc/rc.d/rc.autofs ]; then + /etc/rc.d/rc.autofs start +fi + +# Start the Network Time Protocol daemon: +if [ -x /etc/rc.d/rc.ntpd ]; then + /etc/rc.d/rc.ntpd start +fi + +# Remove stale locks and junk files (must be done after mount -a!) +/bin/rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/.X11-unix/* 2> /dev/null + +# Remove stale hunt sockets so the game can start. +if [ -r /tmp/hunt -o -r /tmp/hunt.stats ]; then + echo "Removing your stale hunt sockets from /tmp." + /bin/rm -f /tmp/hunt* +fi + +# Ensure basic filesystem permissions sanity. +chmod 755 / 2> /dev/null +chmod 1777 /tmp /var/tmp + +# Start ACPI daemon. +if [ -x /etc/rc.d/rc.acpid -a -z "$container" ]; then + /etc/rc.d/rc.acpid start +fi + +# Enable CPU frequency scaling: +if [ -x /etc/rc.d/rc.cpufreq -a -z "$container" ]; then + /etc/rc.d/rc.cpufreq start +fi + +# Update any existing icon cache files: +if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; then + for theme_dir in /usr/share/icons/* ; do + if [ -r ${theme_dir}/icon-theme.cache ]; then + echo "Updating icon-theme.cache in ${theme_dir}..." + /usr/bin/gtk-update-icon-cache -t -f ${theme_dir} 1> /dev/null 2> /dev/null & + fi + done + # This would be a large file and probably shouldn't be there. + if [ -r /usr/share/icons/icon-theme.cache ]; then + echo "Deleting icon-theme.cache in /usr/share/icons..." + #/usr/bin/gtk-update-icon-cache -t -f /usr/share/icons 1> /dev/null 2> /dev/null & + rm -f /usr/share/icons/icon-theme.cache + fi +fi + +# Update mime database: +if [ -x /usr/bin/update-mime-database -a -d /usr/share/mime ]; then + echo "Updating MIME database: /usr/bin/update-mime-database /usr/share/mime &" + /usr/bin/update-mime-database /usr/share/mime 1> /dev/null 2> /dev/null & +fi + +# Start HAL: +if [ -x /etc/rc.d/rc.hald ]; then + /etc/rc.d/rc.hald start +fi + +# Start system-wide PulseAudio daemon (not recommended, nor required in +# order to use PulseAudio -- see the script for details): +if [ -x /etc/rc.d/rc.pulseaudio ]; then + /etc/rc.d/rc.pulseaudio start +fi + +# These GTK+/pango files need to be kept up to date for +# proper input method, pixbuf loaders, and font support. +if [ -x /usr/bin/update-gtk-immodules ]; then + echo "Updating gtk.immodules:" + echo " /usr/bin/update-gtk-immodules &" + /usr/bin/update-gtk-immodules > /dev/null 2>&1 & +fi +if [ -x /usr/bin/update-gdk-pixbuf-loaders ]; then + echo "Updating gdk-pixbuf.loaders:" + echo " /usr/bin/update-gdk-pixbuf-loaders &" + HOME=/root /usr/bin/update-gdk-pixbuf-loaders > /dev/null 2>&1 & +fi +if [ -x /usr/bin/update-pango-querymodules ]; then + echo "Updating pango.modules:" + echo " /usr/bin/update-pango-querymodules &" + /usr/bin/update-pango-querymodules > /dev/null 2>&1 & +fi +if [ -x /usr/bin/glib-compile-schemas ]; then + echo "Compiling GSettings XML schema files:" + echo " /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas &" + /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas >/dev/null 2>&1 & +fi + +# Start dnsmasq, a simple DHCP/DNS server: +if [ -x /etc/rc.d/rc.dnsmasq ]; then + /etc/rc.d/rc.dnsmasq start +fi + +# Start snmpd: +if [ -x /etc/rc.d/rc.snmpd ]; then + /etc/rc.d/rc.snmpd start +fi + +# Start the print spooling system. This will usually be LPRng (lpd) or CUPS. +if [ -x /etc/rc.d/rc.cups ]; then + # Start CUPS: + /etc/rc.d/rc.cups start +elif [ -x /etc/rc.d/rc.lprng ]; then + # Start LPRng (lpd): + /etc/rc.d/rc.lprng start +fi + +# Start netatalk. (a file/print server for Macs using Appletalk) +if [ -x /etc/rc.d/rc.atalk ]; then + /etc/rc.d/rc.atalk start +fi + +# Start smartd, which monitors the status of S.M.A.R.T. compatible +# hard drives and reports any problems: +if [ -x /etc/rc.d/rc.smartd -a -z "$container" ]; then + /etc/rc.d/rc.smartd start +fi + +# Monitor the UPS with genpowerd. +# To use this, uncomment this section and edit your settings in +# /etc/genpowerd.conf (serial device, UPS type, etc). For more information, +# see "man genpowerd" or the extensive documentation in the +# /usr/doc/genpower-*/ directory. +# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want +# support for stopping the UPS's inverter after the machine halts. +#if [ -x /sbin/genpowerd -a -z "$container" ]; then +# echo "Starting genpowerd daemon..." +# /sbin/genpowerd +#fi + +# Turn on process accounting. To enable process accounting, make sure the +# option for BSD process accounting is enabled in your kernel, and then +# create the file /var/log/pacct (touch /var/log/pacct). By default, process +# accounting is not enabled (since /var/log/pacct does not exist). This is +# because the log file can get VERY large. +if [ -x /sbin/accton -a -r /var/log/pacct ]; then + chmod 640 /var/log/pacct + /sbin/accton /var/log/pacct +fi + +# Start crond (Dillon's crond): +if [ -x /etc/rc.d/rc.crond ]; then + /etc/rc.d/rc.crond start +fi + +# Start atd (manages jobs scheduled with 'at'): +if [ -x /etc/rc.d/rc.atd ]; then + /etc/rc.d/rc.atd start +fi + +# Slackware-Mini-Quota-HOWTO: +# To really activate quotas, you'll need to add 'usrquota' and/or 'grpquota' to +# the appropriate partitions as listed in /etc/fstab. Here's an example: +# +# /dev/hda2 /home ext3 defaults,usrquota 1 1 +# +# You'll then need to setup initial quota files at the top of the partitions +# to support quota, like this: +# touch /home/aquota.user /home/aquota.group +# chmod 600 /home/aquota.user /home/aquota.group +# +# Then, reboot to activate the system. +# To edit user quotas, use 'edquota'. See 'man edquota'. Also, the +# official Quota Mini-HOWTO has lots of useful information. That can be found +# here: /usr/doc/Linux-HOWTOs/Quota + +# Check quotas and then turn quota system on: +if grep -q quota /etc/fstab ; then + for quotafs in $(awk '/quota/ {print $2}' /etc/fstab) ; do + /bin/rm -f $quotafs/{a,}quota.{group,user}.new + done + if [ -x /sbin/quotacheck ]; then + echo "Checking filesystem quotas: /sbin/quotacheck -avugm" + /sbin/quotacheck -avugm + fi + if [ -x /sbin/quotaon ]; then + echo "Activating filesystem quotas: /sbin/quotaon -avug" + /sbin/quotaon -avug + fi +fi + +# Load ALSA (sound) defaults: +if [ -x /etc/rc.d/rc.alsa -a -z "$container" ]; then + /etc/rc.d/rc.alsa +fi + +# Load a custom screen font if the user has an rc.font script. +if [ -x /etc/rc.d/rc.font ]; then + /etc/rc.d/rc.font +fi + +# Load a custom keymap if the user has an rc.keymap script. +if [ -x /etc/rc.d/rc.keymap ]; then + /etc/rc.d/rc.keymap +fi + +# Start the MariaDB database: +if [ -x /etc/rc.d/rc.mysqld ]; then + /etc/rc.d/rc.mysqld start +fi + +# Start the SASL authentication server. This provides SASL +# authentication services for sendmail/postfix: +if [ -x /etc/rc.d/rc.saslauthd ]; then + /etc/rc.d/rc.saslauthd start +fi + +# Start OpenLDAP: +if [ -x /etc/rc.d/rc.openldap ]; then + /etc/rc.d/rc.openldap start +fi + +# Start local LDAP name service daemon (from nss-pam-ldapd): +if [ -x /etc/rc.d/rc.nslcd ]; then + /etc/rc.d/rc.nslcd start +fi + +# Start Dovecot: +if [ -x /etc/rc.d/rc.dovecot ]; then + /etc/rc.d/rc.dovecot start +fi + +# Start the mail server. Try the rc.sendmail script first, then try rc.postfix. +if [ -x /etc/rc.d/rc.sendmail -a -x usr/sbin/makemap ]; then + /etc/rc.d/rc.sendmail start +elif [ -x /etc/rc.d/rc.postfix -a -x usr/sbin/postdrop ]; then + /etc/rc.d/rc.postfix start +fi + +# Start Apache web server: +if [ -x /etc/rc.d/rc.httpd ]; then + /etc/rc.d/rc.httpd start +fi + +# Start Samba (a file/print server for Windows machines). +# Samba can be started in /etc/inetd.conf instead. +if [ -x /etc/rc.d/rc.samba ]; then + /etc/rc.d/rc.samba start +fi + +# Start the GPM mouse server: +if [ -x /etc/rc.d/rc.gpm ]; then + /etc/rc.d/rc.gpm start +fi + +# Start the Icecream scheduler. This needs to run on only one machine that is +# part of the compile cluster: +if [ -x /etc/rc.d/rc.icecc-scheduler ]; then + /etc/rc.d/rc.icecc-scheduler start +fi + +# Start the Icecream daemon. This needs to run on every machine that will be +# part of the compile cluster (including the machine running the scheduler): +if [ -x /etc/rc.d/rc.iceccd ]; then + /etc/rc.d/rc.iceccd start +fi + +# If there are SystemV init scripts for this runlevel, run them. +if [ -x /etc/rc.d/rc.sysvinit ]; then + /etc/rc.d/rc.sysvinit +fi + +# Start the local setup procedure. +if [ -x /etc/rc.d/rc.local ]; then + /etc/rc.d/rc.local +fi + +# All done. -- cgit v1.2.3-54-g00ecf