This Ansible role provided the Application base (disques, LVM, FS, Directories, users, etc ...)
This role :
- Configures Applications disques, lvms, files systemes
- Create Applications groups, Users, etc ...
- Configure Applications directories
$ molecule --version
molecule <green>4.0.3</green> using python 3.10
ansible:2.13.5
delegated:4.0.3 from molecule
docker:2.1.0 from molecule_docker requiring collections: community.docker>=3.0.2 ansible.posix>=1.4.0
Available variables are listed below, along with default values (see
defaults/main.yml
)
This dictionary gathers all Application variables.
It should be declare on inventorygroup_vars
.
This dictionary is mendatory !
Warning ! Only One application must be set on this dictonary ( Future update should improve that ! )
(This dictionary vars should normaly be provided by the Configuration management database (CMDB))application: - name: "My Test Application" tag: APTEST id: aptest comment: "My TEST Application"The application Name.
This is the application's TAG.
It's suppose to be a capital quadrigram on my organisation.
But your free to use what you wanted !This is the application's id.
It's supposed to be a tiny quadrigram equal to theapplication.tag
but in tiny.The application Name and Description
This bolean variable used to enable or disable groups creation.
This variable should be declare on inventorygroup_vars
.
This variable is mendatory !
If this variable is set totrue
you must set theapplication_groups
Dictionary !
This dictionary is used, ang group created only if the
application_groups_create
var is set to true. This dictionary gathers all Application Groups variables.
This dictionary should be declare on inventorygroup_vars
.
This dictionary is mendatory ifapplication_groups_create
is set to true !
(This dictionary vars should normaly be provided by the Configuration management database (CMDB))application_groups: - name: groupe_one - name: groupe_two - name: groupe_threeThe groups name.
This dictionary gathers all Application Users variables.
This dictionary should be declare on inventorygroup_vars
.
This dictionary is mendatory !
(This dictionary vars should normaly be provided by the Configuration management database (CMDB))application_users: - login: "user_one" comment: "This is User One account" home_directory: "/app/user_one" shell: "/usr/sbin/nologin" group: "user_one" groups: - groupe_one - groupe_two - login: "user_two" comment: "This is User Two account" home_directory: "/app/user_two" shell: "/usr/sbin/nologin" group: "user_two" groups: - groupe_threeThe user's login.
The user's description.
The user's home directory.
The user's default shell
The user's default group
The user's extra groups
This dictionary gathers all Application Directories variables.
This dictionary should be declare on inventorygroup_vars
.
This dictionary is mendatory !
(This dictionary vars should normaly be provided by the Configuration management database (CMDB))application_directories: - path: "/app/APTEST/application" owner: "user_one" group: "user_one" mode: 755 - path: "/app/APTEST/log" owner: "user_one" group: "user_one" mode: 755 - path: "/app/APTEST/data" owner: "user_one" group: "user_one" mode: 755The directory path.
The directory owner.
The directory group.
The directory mode.
This bolean variable used to enable or disable lvm creation.
This variable should be declare on inventorygroup_vars
.
This variable is mendatory !
If this variable is set totrue
you must set theapplication_vgs
Dictionary !
This dictionary gathers all Application Volume Groupe's (VGs) variables.
This dictionary should be declare on inventorygroup_vars
.
Volumes groups are created by picking disk's path ondisks
dictonaries if disks.tag equal to vgs.tag. This dictionary is mendatory ifapplication_lvms_create
is set totrue
!
(This dictionary vars should normaly be provided by the Configuration management database (CMDB))application_vgs: - name : "vg_app" tag: "APTEST" lvs : - name: "lv_app" size: '10g' fstype: 'xfs' owner: "user_one" group: "user_one" mode: 755 mount_point: /app/APTEST/application - name: "lv_log" size: '10g' fstype: 'xfs' owner: "user_one" group: "user_one" mode: 755 mount_point: /app/APTEST/log - name: "lv_data" size: '10g' fstype: 'xfs' owner: "user_one" group: "user_one" mode: 755 mount_point: /app/APTEST/data
This dictionary gathers all host Physical volumes variables.
This dictionary should be declare on inventoryhost_vars
.
This dictionary is mendatory ifapplication_lvms_create
is set totrue
!
(This dictionary vars should normaly be provided by the Configuration management database (CMDB))disks: - path: '/dev/disk/azure/scsi1/lun1' tag: APTEST - path: '/dev/sdc' tag: APTEST - path: '/dev/sde' tag: AFFFF
- ansible.builtin
- ansible.posix
- hosts: server
roles:
- { role: shmii.app-common }
RHEL_ACCOUNT_USER='<MyRedhatAccountUser>' RHEL_ACCOUNT_PASSWORD='<MyRedhatAccountPassword>' molecule check
/!\ To validate this role with "molecule" from Ubuntu @ WSL/WSL2 it is necessary to create the folder /sys/fs/cgroup/systemd
on the host linux subsystem. This directory is necessary for some os (RHEL9, Rocky9, etc...) and not existing on local Ubuntu WSL sub Systeme !
$ sudo mkdir /sys/fs/cgroup/systemd
Redde Caesari quae sunt Caesaris, et quae sunt Dei Deo !
- Jeff GEERLING ( https://www.linkedin.com/in/jeff-geerling-086bb2a/ --- https://github.com/geerlingguy)
- Stephane ROBERT ( https://www.linkedin.com/in/stephanerobert1/ --- https://blog.stephane-robert.info)
- Ansible - Automation for everyone : ( https://www.ansible.com )
- Ansible - Ansible Documentation : ( https://docs.ansible.com )
- Molecule - Ansible Molecule Documentation : ( https://molecule.readthedocs.io/en/latest/ )
- Molecule - Ansible Molecule Community Documentation : ( https://github.com/ansible-community/molecule)
- Molecule/Ansible : Stephane Robert's Blog : ( https://blog.stephane-robert.info/tags/ansible/ )
GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
This role was created in 2022 by [Thomas CHALMEL] (https://www.thomas.chalmel.org/).