ã¬ããããããã½ãªã¥ã¼ã·ã§ã³ã¢ã¼ããã¯ãç³åã§ãã
ããã§ã¯ã RHEL System Roles ã«ã¤ãã¦ç´¹ä»ããã¾ãã
ã·ã¹ãã é¢é£ã®ä½æ¥ã§ããµã¼ãã«ãã°ã¤ã³ãã¦æ§ç¯ä½æ¥ãå®æ½ãããããã°ã¤ã³ãã¦ãããé©ç¨ãè¨å®ãã¡ã¤ã«ã®å¤æ´ä½æ¥ãªã©ãå®æ½ãããã¨ã¯æ¥å¸¸çã«ããã¨æãã¾ãã
対象ã·ã¹ãã ãæ°å°ç¨åº¦ã§ããã°ããã§ãåé¡ã¯ç¡ããããããªãã§ãããå¤æ°ã®ã·ã¹ãã ãåãããã«ãããããã°ã¤ã³ãã¦ã¡ã³ããã³ã¹ãã¦ãããã¨ã¯é常ã«éå´åã§ããã人æã§å¯¾å¿ãããã¨ã§è¨å®ãã¹ãä½æ¥æ¼ããªã©ãçºçããã¡ã§ãã
RHEL System Roles ã¯ããã®ãããªã¤ã³ãã©ä½æ¥ãå¹çåããç®çã§éçºããã¦ãã¾ãã
RHEL System Roles ã¨ã¯ã Red Hat Enterprise Linux ã管çããã³è¨å®ããå®å®ããè¨å®ã¤ã³ã¿ã¼ãã§ã¤ã¹ãæä¾ãã Ansible ãã¼ã«ãã¢ã¸ã¥ã¼ã«ãããã³ Playbook ã®ã³ã¬ã¯ã·ã§ã³ã§ãã
Red Hat ã«ã¦éçºããã RHEL System Roles ãæ´»ç¨ãããã¨ã§ãã·ã¹ãã ã«ãã°ã¤ã³ãããã¨ç¡ãã対象ã·ã¹ãã ã®ã¡ã³ããã³ã¹ãå®æ½ãããã¨ãå¯è½ã§ãã
2022å¹´10æç¾å¨ã RHEL System Roles ã§ã¯ä»¥ä¸ã®ã©ã¤ã³ããããããããã®æ°ã¯æ¥ã
å¢ãã¦ãã¾ãã
åèï¼
Red Hat Enterprise Linux (RHEL) System Roles - Red Hat Customer Portal
- ä¸é¨ Tech preview ã®ãã®ãã RHEL ã®ãã¼ã¸ã§ã³ã«ãã£ã¦å©ç¨ã§ããªããã®ãããã®ã§ã詳細ã¯ä¸è¨ URL ãã確èªãã ããã
ãã¼ã«å | 説æ |
---|---|
timesync | æå»åæè¨å®ç¨ãã¼ã« |
selinux | SELinuxæä½ç¨ãã¼ã« |
network | Networkæä½ç¨ãã¼ã« |
kdump | Kernel dumpsæä½ç¨ãã¼ã« |
storage | Storageæä½ç¨ãã¼ã« |
postfix | Postfix (mail transfer agent)æä½ç¨ãã¼ã« |
sap_general_preconfigure | SAP å ±éNoteé©ç¨ãã¼ã« |
sap_netweaver_preconfigure | SAP NetWeaver Noteé©ç¨ãã¼ã« |
sap_hana_preconfigure | SAP HANA Noteé©ç¨ãã¼ã« |
sap_hana_install | SAP HANA ã¤ã³ã¹ãã¼ã«ç¨ãã¼ã« |
kernel_settings | Kernel settingsç¨ãã¼ã« |
logging | Logging (rsyslog)æä½ç¨ãã¼ã« |
metrics | Metrics (Performance Co-Pilot)æä½ç¨ãã¼ã« |
nbde_client | Network bound disk encryption clientæä½ç¨ãã¼ã« |
nbde_server | Network bound disk encryption serveræä½ç¨ãã¼ã« |
certificate | Certificate issuance and renewalæä½ç¨ãã¼ã« |
tlog | Terminal session recordingæä½ç¨ãã¼ã« |
ssh | Secure Shell (SSH) clientæä½ç¨ãã¼ã« |
sshd | Secure Shell (SSH) serveræä½ç¨ãã¼ã« |
crypto_policies | System-wide cryptographic policiesæä½ç¨ãã¼ã« |
ha_cluster | High availability clusteringæä½ç¨ãã¼ã« |
vpn | Virtual private networksæä½ç¨ãã¼ã« |
microsoft.sql.server | Microsoft SQL Serverè¨å®ç¨ãã¼ã« |
cockpit | Web consoleè¨å®ç¨ãã¼ã« |
firewall | Firewallè¨å®ç¨ãã¼ã« |
ã·ã¹ãã 管çè
ãã¤ã³ãã©ã¨ã³ã¸ãã¢ã®æ¹ãå®æ½ããä½æ¥ããã¼ã«ã¨ãã¦æä¾ããã¦ãã¾ãã
ã¾ããMicrosoft 社㮠SQL Server ããSAP 社㮠S/4HANA åãã®ãã¼ã«ãããã¤ããªãªã¼ã¹ããã¦ãã¾ãã
ã§ã¯ãå®éã« RHEL System Roles ã使ã£ã¦ã¿ããã¨æãã¾ãã
以ä¸ã® 3 ã¹ãããã§å©ç¨ãã§ãã¾ãã
- Ansible Core ã RHEL System Roles ã®ã¤ã³ã¹ãã¼ã«
- Role ãå¼ã³åºã Playbook ãä½æ
- Playbook ã®å®è¡
ä¸ã¤ãã¤ãå®éã®ããæ¹ããç´¹ä»ãã¾ãã
* ä»åã¯RHEL9.0 ã§ä½æ¥ãå®æ½ãã¦ãã¾ãããRHEL 7, 8, 9 ã§åãæé ã§æä½ã§ãã¾ãã
ãOS ã®ãã¼ã¸ã§ã³ã«ããã Ansible Core ãå«ã¾ãããªãã¸ããªãç°ãªãå ´åãããã¾ãã®ã§ããã®ç¹ã¯ã注æãã ããã
1. Ansible Core ã RHEL System Roles ã®ã¤ã³ã¹ãã¼ã«
ä½æ¥å¯¾è±¡ã« Ansible Core 㨠RHEL System Roles ãã¤ã³ã¹ãã¼ã«ãã¾ãã
ãåç¥ã®ããã«ãAnsible 㯠IT èªååãã¼ã«ã§ãã
Ansible ã®æ´»ç¨ã«ãããã·ã¹ãã ã®æ§æãã½ããã¦ã§ã¢ã®å±éãããé«åº¦ãª IT ã¿ã¹ã¯ (ç¶ç¶çãªãããã¤ã¡ã³ãããã¦ã³ã¿ã¤ã ãªãã®ãã¼ãªã³ã°æ´æ°ãªã©) ã®ãªã¼ã±ã¹ãã¬ã¼ã·ã§ã³ãå¯è½ã«ãªãã¾ãã
ããã対象ã®ç°å¢ãæ¢ã« Ansible ãå©ç¨ããèªååç°å¢ãæ§æãã¦ããã®ã§ããã°ãæ¢åã®ã³ã³ããã¼ã«ãã¼ããã Playbook ãå®è¡ããã°è¯ãã§ãããã
ããã§ã¯ Ansible ã«ããèªååç°å¢ãæ§æããã¦ããªãæ³å®ã¨ããèªãã¼ãã« Ansible Core ãå°å
¥ãã¦ãã¾ãã
Ansible Core 㯠Ansible ã®ä¸»è¦ãªãã«ãã£ã³ã°ãããã¯ããã³ã¢ã¼ããã¯ãã£ã¼ã§ãããCLI ãã¼ã«ã Ansible ãã©ã°ã¤ã³ãå«ã¾ãã¾ãã
ãªãã RHEL ã®ãµãã¹ã¯ãªãã·ã§ã³ããæã¡ã§ããã°ã Ansible Automation Platform ã®ãµãã¹ã¯ãªãã·ã§ã³ã¯è³¼å
¥ãã¦ããªãã¦ãã RHEL System Roles ã®ãµãã¼ããåãããã¨ãå¯è½ã§ãã
詳細ã¯ä»¥ä¸ãã確èªãã ããã
Scope of support for the Ansible Core package included in the RHEL 9 and RHEL 8.6 and later AppStream repositories - Red Hat Customer Portal
RHEL System Roles ã¨ãå¿ è¦ã¨ãªã Ansible Core ãã¤ã³ã¹ãã¼ã«ãã¾ãã
# dnf install rhel-system-roles ansible-core
Ansible Core ã®ã¤ã³ã¹ãã¼ã«ãçµããã¨ãansible
ã³ãã³ããå©ç¨å¯è½ã«ãªãã¾ãã
# ansible --version ansible [core 2.12.2] config file = /etc/ansible/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.9/site-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /bin/ansible python version = 3.9.10 (main, Feb 9 2022, 00:00:00) [GCC 11.2.1 20220127 (Red Hat 11.2.1-9)] jinja version = 2.11.3 libyaml = True
ã¾ããRHEL System Roles ã¯ã/usr/share/ansible/roles/
以ä¸ã«å±éããã¾ãã
# ls /usr/share/ansible/roles | grep rhel-system-roles rhel-system-roles.certificate rhel-system-roles.cockpit rhel-system-roles.crypto_policies rhel-system-roles.firewall rhel-system-roles.ha_cluster rhel-system-roles.kdump rhel-system-roles.kernel_settings rhel-system-roles.logging rhel-system-roles.metrics rhel-system-roles.nbde_client rhel-system-roles.nbde_server rhel-system-roles.network rhel-system-roles.postfix rhel-system-roles.selinux rhel-system-roles.ssh rhel-system-roles.sshd rhel-system-roles.storage rhel-system-roles.timesync rhel-system-roles.tlog rhel-system-roles.vpn
- ããã¥ã¡ã³ãã¨ãå¹¾ã¤ãã®ãµã³ãã« Playbook ã¯ã
/usr/share/doc/rhel-system-roles/
以ä¸ã«å±éããã¾ãã - SQL Server ãã S/4HANA ã®ãããªãµã¼ããã¼ãã£ã¼ã¢ããªã±ã¼ã·ã§ã³ã® Role ã¯ãããããã
ansible-collection-microsoft-sql
ãrhel-system-roles-sap
ã®ã¤ã³ã¹ãã¼ã«ãå¿ è¦ã§ãã
ã(S/4HANAç¨ã®ãã®ã¯ãå°ç¨ã®RHEL for SAP Solutionsãµãã¹ã¯ãªãã·ã§ã³ãå¿ è¦ã¨ãªãã¾ãã)
2. Role ãå¼ã³åºã Playbook ãä½æ
æ°ãã RHEL System Roles ã®ä¸ã§ãä»å㯠storage Role ãå©ç¨ãã¦ã®ããã¡ã¤ã«ã·ã¹ãã æ¡å¼µãå®æ½ãã¦ã¿ã¾ãã
ä¾ã¨ãã¦ã/dev/sdb
ã«/app/data
ã100GBã§ã/app/log
ã20GBã§ä½æãããã¨ã«ãã¾ãã
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 100G 0 disk ââsda1 8:1 0 1G 0 part /boot ââsda2 8:2 0 99G 0 part âârhel-root 253:0 0 65.1G 0 lvm / âârhel-swap 253:1 0 2G 0 lvm [SWAP] âârhel-home 253:2 0 31.8G 0 lvm /home sdb 8:16 0 200G 0 disk sr0 11:0 1 1024M 0 rom
å®è¡ãã Playbook ãä½æãã¾ãã
ä¸èº«ã¯ä»¥ä¸ã§ãã
å®è¡å¯¾è±¡ã¯localhost
ãã¾ãã Ansible å¤æ°ã§ãä½æ対象ã®ããªã¥ã¼ã ãµã¤ãºã Mount Point ããã¡ã¤ã«ã·ã¹ãã ãã©ã¼ããããæå®ãã storage Role ãå¼ã³åºãããã«ãã¾ãã
# cat app-storage-prepare.yml --- - hosts: localhost vars: storage_pools: - name: app-area disks: - sdb volumes: - name: appdata size: "100 GiB" mount_point: "/app/data" fs_type: xfs state: present - name: applog size: "50 GiB" mount_point: "/app/log" fs_type: ext4 state: present roles: - rhel-system-roles.storage
3. Playbook ã®å®è¡
æºåãåºæ¥ããPlaybookãå®è¡ãã¾ãã
# ansible-playbook app-storage-prepare.yml [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ************************************************************************************************************** TASK [Gathering Facts] ******************************************************************************************************** ok: [localhost] TASK [rhel-system-roles.storage : Set version specific variables] ************************************************************* ok: [localhost] TASK [rhel-system-roles.storage : define an empty list of pools to be used in testing] **************************************** ok: [localhost] TASK [rhel-system-roles.storage : define an empty list of volumes to be used in testing] ************************************** ok: [localhost] TASK [rhel-system-roles.storage : include the appropriate provider tasks] ***************************************************** included: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml for localhost TASK [rhel-system-roles.storage : get a list of rpm packages installed on host machine] *************************************** skipping: [localhost] TASK [rhel-system-roles.storage : make sure blivet is available] ************************************************************** ok: [localhost] TASK [rhel-system-roles.storage : show storage_pools] ************************************************************************* ok: [localhost] => { "storage_pools": [ { "disks": [ "sdb" ], "name": "app-area", "volumes": [ { "fs_type": "xfs", "mount_point": "/app/data", "name": "appdata", "size": "100 GiB", "state": "present" }, { "fs_type": "ext4", "mount_point": "/app/log", "name": "applog", "size": "50 GiB", "state": "present" } ] } ] } TASK [rhel-system-roles.storage : show storage_volumes] *********************************************************************** ok: [localhost] => { "storage_volumes": "VARIABLE IS NOT DEFINED!" } ã» ã» ã» (ä¸ç¥) ã» ã» ã» TASK [rhel-system-roles.storage : set up new/current mounts] ****************************************************************** changed: [localhost] => (item={'src': '/dev/mapper/app--area-appdata', 'path': '/app/data', 'fstype': 'xfs', 'opts': 'defaults', 'dump': 0, 'passno': 0, 'state': 'mounted'}) changed: [localhost] => (item={'src': '/dev/mapper/app--area-applog', 'path': '/app/log', 'fstype': 'ext4', 'opts': 'defaults', 'dump': 0, 'passno': 0, 'state': 'mounted'}) TASK [rhel-system-roles.storage : tell systemd to refresh its view of /etc/fstab] ********************************************* ok: [localhost] TASK [rhel-system-roles.storage : retrieve facts for the /etc/crypttab file] ************************************************** ok: [localhost] TASK [rhel-system-roles.storage : manage /etc/crypttab to account for changes we just made] *********************************** TASK [rhel-system-roles.storage : Update facts] ******************************************************************************* ok: [localhost] PLAY RECAP ******************************************************************************************************************** localhost : ok=22 changed=2 unreachable=0 failed=0 skipped=9 rescued=0 ignored=0
ç¨ãªããã¦å¦çãçµããã¾ãã å®éã«ç¢ºèªããã¦ã¿ãã¨ã
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 100G 0 disk ââsda1 8:1 0 1G 0 part /boot ââsda2 8:2 0 99G 0 part âârhel-root 253:0 0 65.1G 0 lvm / âârhel-swap 253:1 0 2G 0 lvm [SWAP] âârhel-home 253:2 0 31.8G 0 lvm /home sdb 8:16 0 200G 0 disk ââapp--area-applog 253:3 0 50G 0 lvm /app/log ââapp--area-appdata 253:4 0 100G 0 lvm /app/data sr0 11:0 1 1024M 0 rom
# grep app--area /etc/fstab /dev/mapper/app--area-appdata /app/data xfs defaults 0 0 /dev/mapper/app--area-applog /app/log ext4 defaults 0 0
ããªã¥ã¼ã ã®ä½æã ãã§ãªãã Mount Point ãã£ã¬ã¯ããªã®ä½æãã fstab ã®æ´æ°ã¾ã§å¦çããããã¨ããããã¾ãã
ä½æãã Playbook ã¯åå©ç¨ãå¯è½ã§ãã®ã§ãä¼¼ããããªè¨å®ãå¿
è¦ãªã·ã¹ãã ã§ã¯åã Playbook ãå©ç¨ãã¦è¨å®ãè¡ããã¨ã§ã人æã§è¡ãäºã«èµ·å ãã¦çºçãããè¨å®ãã¹ãä½æ¥æ¼ããªã©ãæå¶ã§ããã®ããç解ããã ããã¨æãã¾ãã
ã¾ãã対象ã·ã¹ãã ãå¤ããã°å¤ãã»ã©ãèªååã®å¹æã¯çµ¶å¤§ãªå¹æãçºæ®ãã¾ãã
RHEL System Roles ã Ansible ã§æ´»ç¨ãããã¨ã«ããä½æ¥ã®éå´ååãææ¢ããä½æ¥å質ã®å®å®åãå®ç¾ã§ãã¾ãã